@hasna/machines 0.0.44 → 0.0.46
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/README.md +27 -4
- package/dist/agent/index.d.ts +0 -1
- package/dist/agent/index.js +249 -14
- package/dist/agent/runtime.d.ts +0 -1
- package/dist/cli/index.d.ts +0 -1
- package/dist/cli/index.js +1316 -213
- package/dist/cli-utils.d.ts +0 -1
- package/dist/commands/apps.d.ts +7 -5
- package/dist/commands/backup.d.ts +0 -1
- package/dist/commands/cert.d.ts +0 -1
- package/dist/commands/clipboard-daemon.d.ts +0 -1
- package/dist/commands/clipboard-server.d.ts +0 -1
- package/dist/commands/clipboard.d.ts +0 -1
- package/dist/commands/daemon.d.ts +0 -1
- package/dist/commands/diff.d.ts +0 -1
- package/dist/commands/dns.d.ts +0 -1
- package/dist/commands/doctor.d.ts +0 -1
- package/dist/commands/heal-daemon.d.ts +0 -1
- package/dist/commands/heal.d.ts +0 -1
- package/dist/commands/install-claude.d.ts +5 -3
- package/dist/commands/install-tailscale.d.ts +5 -3
- package/dist/commands/manifest.d.ts +0 -1
- package/dist/commands/mutation-approval.d.ts +54 -0
- package/dist/commands/notifications.d.ts +14 -2
- package/dist/commands/ports.d.ts +0 -1
- package/dist/commands/runtime.d.ts +15 -1
- package/dist/commands/screen.d.ts +4 -1
- package/dist/commands/self-test.d.ts +0 -1
- package/dist/commands/serve.d.ts +0 -1
- package/dist/commands/setup.d.ts +5 -3
- package/dist/commands/ssh.d.ts +8 -1
- package/dist/commands/status.d.ts +0 -1
- package/dist/commands/sync.d.ts +5 -3
- package/dist/commands/workspace.d.ts +0 -1
- package/dist/compatibility.d.ts +0 -1
- package/dist/consumer-schema.d.ts +0 -1
- package/dist/consumer.d.ts +0 -1
- package/dist/consumer.js +253 -12
- package/dist/cross-project-types.d.ts +0 -1
- package/dist/db.d.ts +0 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1108 -189
- package/dist/manifests.d.ts +0 -1
- package/dist/mcp/http.d.ts +26 -2
- package/dist/mcp/index.d.ts +0 -1
- package/dist/mcp/index.js +1021 -167
- package/dist/mcp/server.d.ts +5 -3
- package/dist/paths.d.ts +0 -1
- package/dist/pg-migrations.d.ts +0 -1
- package/dist/redaction.d.ts +0 -1
- package/dist/remote-storage.d.ts +0 -1
- package/dist/remote.d.ts +14 -5
- package/dist/storage-sync.d.ts +0 -1
- package/dist/storage.d.ts +0 -1
- package/dist/storage.js +18 -0
- package/dist/topology.d.ts +0 -1
- package/dist/types.d.ts +3 -1
- package/dist/version.d.ts +0 -1
- package/package.json +5 -3
- package/dist/agent/index.d.ts.map +0 -1
- package/dist/agent/runtime.d.ts.map +0 -1
- package/dist/cli/index.d.ts.map +0 -1
- package/dist/cli-utils.d.ts.map +0 -1
- package/dist/commands/apps.d.ts.map +0 -1
- package/dist/commands/backup.d.ts.map +0 -1
- package/dist/commands/cert.d.ts.map +0 -1
- package/dist/commands/clipboard-daemon.d.ts.map +0 -1
- package/dist/commands/clipboard-server.d.ts.map +0 -1
- package/dist/commands/clipboard.d.ts.map +0 -1
- package/dist/commands/daemon.d.ts.map +0 -1
- package/dist/commands/diff.d.ts.map +0 -1
- package/dist/commands/dns.d.ts.map +0 -1
- package/dist/commands/doctor.d.ts.map +0 -1
- package/dist/commands/heal-daemon.d.ts.map +0 -1
- package/dist/commands/heal.d.ts.map +0 -1
- package/dist/commands/install-claude.d.ts.map +0 -1
- package/dist/commands/install-tailscale.d.ts.map +0 -1
- package/dist/commands/manifest.d.ts.map +0 -1
- package/dist/commands/notifications.d.ts.map +0 -1
- package/dist/commands/ports.d.ts.map +0 -1
- package/dist/commands/runtime.d.ts.map +0 -1
- package/dist/commands/screen.d.ts.map +0 -1
- package/dist/commands/self-test.d.ts.map +0 -1
- package/dist/commands/serve.d.ts.map +0 -1
- package/dist/commands/setup.d.ts.map +0 -1
- package/dist/commands/ssh.d.ts.map +0 -1
- package/dist/commands/status.d.ts.map +0 -1
- package/dist/commands/sync.d.ts.map +0 -1
- package/dist/commands/workspace.d.ts.map +0 -1
- package/dist/compatibility.d.ts.map +0 -1
- package/dist/consumer-schema.d.ts.map +0 -1
- package/dist/consumer.d.ts.map +0 -1
- package/dist/cross-project-types.d.ts.map +0 -1
- package/dist/db.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/manifests.d.ts.map +0 -1
- package/dist/mcp/http.d.ts.map +0 -1
- package/dist/mcp/index.d.ts.map +0 -1
- package/dist/mcp/server.d.ts.map +0 -1
- package/dist/paths.d.ts.map +0 -1
- package/dist/pg-migrations.d.ts.map +0 -1
- package/dist/redaction.d.ts.map +0 -1
- package/dist/remote-storage.d.ts.map +0 -1
- package/dist/remote.d.ts.map +0 -1
- package/dist/storage-sync.d.ts.map +0 -1
- package/dist/storage.d.ts.map +0 -1
- package/dist/topology.d.ts.map +0 -1
- package/dist/types.d.ts.map +0 -1
- package/dist/version.d.ts.map +0 -1
package/dist/consumer.js
CHANGED
|
@@ -96,6 +96,7 @@ class SqliteAdapter {
|
|
|
96
96
|
raw;
|
|
97
97
|
constructor(path) {
|
|
98
98
|
this.raw = new Database(path);
|
|
99
|
+
this.raw.exec("PRAGMA busy_timeout = 5000");
|
|
99
100
|
}
|
|
100
101
|
close() {
|
|
101
102
|
this.raw.close();
|
|
@@ -161,6 +162,23 @@ function createTables(db) {
|
|
|
161
162
|
updated_at TEXT NOT NULL
|
|
162
163
|
)
|
|
163
164
|
`);
|
|
165
|
+
db.exec(`
|
|
166
|
+
CREATE TABLE IF NOT EXISTS mutation_approval_nonces (
|
|
167
|
+
nonce_sha256 TEXT PRIMARY KEY,
|
|
168
|
+
token_sha256 TEXT NOT NULL,
|
|
169
|
+
surface TEXT NOT NULL,
|
|
170
|
+
operation TEXT NOT NULL,
|
|
171
|
+
caller_id TEXT NOT NULL,
|
|
172
|
+
run_id TEXT NOT NULL,
|
|
173
|
+
transport TEXT NOT NULL,
|
|
174
|
+
expires_at INTEGER NOT NULL,
|
|
175
|
+
used_at INTEGER NOT NULL
|
|
176
|
+
)
|
|
177
|
+
`);
|
|
178
|
+
db.exec(`
|
|
179
|
+
CREATE INDEX IF NOT EXISTS mutation_approval_nonces_expires_at_idx
|
|
180
|
+
ON mutation_approval_nonces (expires_at)
|
|
181
|
+
`);
|
|
164
182
|
}
|
|
165
183
|
function migrateAgentHeartbeats(db) {
|
|
166
184
|
const columns = db.query("PRAGMA table_info(agent_heartbeats)").all();
|
|
@@ -5990,12 +6008,24 @@ function validateMachinesConsumerEnvelope(envelope, value) {
|
|
|
5990
6008
|
}
|
|
5991
6009
|
// src/remote.ts
|
|
5992
6010
|
import { spawnSync as spawnSync2 } from "child_process";
|
|
5993
|
-
import {
|
|
6011
|
+
import { existsSync as existsSync5, mkdtempSync, readFileSync as readFileSync3, rmSync } from "fs";
|
|
6012
|
+
import { hostname as hostname4, tmpdir } from "os";
|
|
6013
|
+
import { join as join3 } from "path";
|
|
5994
6014
|
|
|
5995
6015
|
// src/commands/ssh.ts
|
|
5996
6016
|
function shellQuote2(value) {
|
|
5997
6017
|
return `'${value.replace(/'/g, "'\\''")}'`;
|
|
5998
6018
|
}
|
|
6019
|
+
function validateSshTarget(target) {
|
|
6020
|
+
const trimmed = target.trim();
|
|
6021
|
+
if (!trimmed || trimmed.startsWith("-") || /[\s"'`$\\;&|<>()[\]{}]/.test(trimmed)) {
|
|
6022
|
+
throw new Error(`Unsafe SSH target: ${target}`);
|
|
6023
|
+
}
|
|
6024
|
+
if (!/^(?:[A-Za-z0-9._%+-]+@)?[A-Za-z0-9._:-]+$/.test(trimmed)) {
|
|
6025
|
+
throw new Error(`Unsafe SSH target: ${target}`);
|
|
6026
|
+
}
|
|
6027
|
+
return trimmed;
|
|
6028
|
+
}
|
|
5999
6029
|
function resolveSshTarget(machineId, options = {}) {
|
|
6000
6030
|
const resolved = resolveMachineRoute(machineId, options);
|
|
6001
6031
|
if (!resolved.ok || !resolved.target) {
|
|
@@ -6006,15 +6036,28 @@ function resolveSshTarget(machineId, options = {}) {
|
|
|
6006
6036
|
}
|
|
6007
6037
|
return {
|
|
6008
6038
|
machineId: resolved.machine_id ?? machineId,
|
|
6009
|
-
target: resolved.command_target ?? resolved.target,
|
|
6039
|
+
target: validateSshTarget(resolved.command_target ?? resolved.target),
|
|
6010
6040
|
route: resolved.route,
|
|
6011
6041
|
confidence: resolved.confidence,
|
|
6012
6042
|
warnings: resolved.warnings
|
|
6013
6043
|
};
|
|
6014
6044
|
}
|
|
6015
6045
|
function buildSshCommand(machineId, remoteCommand, options = {}) {
|
|
6046
|
+
return buildSshCommandPlan(machineId, remoteCommand, options).shellCommand;
|
|
6047
|
+
}
|
|
6048
|
+
function buildSshCommandArgs(machineId, remoteCommand, options = {}) {
|
|
6049
|
+
return buildSshCommandPlan(machineId, remoteCommand, options).args;
|
|
6050
|
+
}
|
|
6051
|
+
function buildSshCommandPlan(machineId, remoteCommand, options = {}) {
|
|
6016
6052
|
const resolved = resolveSshTarget(machineId, options);
|
|
6017
|
-
|
|
6053
|
+
const args = remoteCommand ? [resolved.target, remoteCommand] : [resolved.target];
|
|
6054
|
+
const shellCommand2 = `ssh ${args.map(shellQuote2).join(" ")}`;
|
|
6055
|
+
return {
|
|
6056
|
+
...resolved,
|
|
6057
|
+
command: "ssh",
|
|
6058
|
+
args,
|
|
6059
|
+
shellCommand: shellCommand2
|
|
6060
|
+
};
|
|
6018
6061
|
}
|
|
6019
6062
|
|
|
6020
6063
|
// src/remote.ts
|
|
@@ -6026,35 +6069,233 @@ function machineIsLocal(machineId, localMachineId) {
|
|
|
6026
6069
|
}
|
|
6027
6070
|
function resolveMachineCommand(machineId, command, localMachineId = getLocalMachineId()) {
|
|
6028
6071
|
if (machineIsLocal(machineId, localMachineId)) {
|
|
6029
|
-
return { source: "local", shellCommand: command };
|
|
6072
|
+
return { source: "local", command: "bash", args: ["-c", command], shellCommand: command, usesShell: true };
|
|
6030
6073
|
}
|
|
6031
6074
|
try {
|
|
6075
|
+
const plan = buildSshCommandPlan(machineId, command);
|
|
6032
6076
|
return {
|
|
6033
|
-
source:
|
|
6034
|
-
|
|
6077
|
+
source: plan.route,
|
|
6078
|
+
command: plan.command,
|
|
6079
|
+
args: plan.args,
|
|
6080
|
+
shellCommand: plan.shellCommand,
|
|
6081
|
+
usesShell: false
|
|
6035
6082
|
};
|
|
6036
6083
|
} catch (error) {
|
|
6037
6084
|
const message = String(error.message ?? error);
|
|
6038
6085
|
if (message.includes("Machine route not found") || message.includes("Machine not found in manifest")) {
|
|
6039
|
-
|
|
6086
|
+
const target = validateSshTarget(machineId);
|
|
6087
|
+
return {
|
|
6088
|
+
source: "ssh",
|
|
6089
|
+
command: "ssh",
|
|
6090
|
+
args: [target, command],
|
|
6091
|
+
shellCommand: `ssh ${shellQuote3(target)} ${shellQuote3(command)}`,
|
|
6092
|
+
usesShell: false
|
|
6093
|
+
};
|
|
6040
6094
|
}
|
|
6041
6095
|
throw error;
|
|
6042
6096
|
}
|
|
6043
6097
|
}
|
|
6044
|
-
function runMachineCommand(machineId, command) {
|
|
6098
|
+
function runMachineCommand(machineId, command, options = {}) {
|
|
6045
6099
|
const resolved = resolveMachineCommand(machineId, command);
|
|
6046
|
-
|
|
6100
|
+
if (options.timeoutMs && options.timeoutMs > 0 && process.platform !== "win32") {
|
|
6101
|
+
return runMachineCommandWithProcessGroupTimeout(machineId, resolved, options);
|
|
6102
|
+
}
|
|
6103
|
+
const result = spawnSync2(resolved.command, resolved.args, {
|
|
6047
6104
|
encoding: "utf8",
|
|
6048
|
-
env: process.env
|
|
6105
|
+
env: process.env,
|
|
6106
|
+
timeout: options.timeoutMs,
|
|
6107
|
+
killSignal: "SIGTERM"
|
|
6049
6108
|
});
|
|
6109
|
+
const timedOut = Boolean(result.error && "code" in result.error && result.error.code === "ETIMEDOUT");
|
|
6110
|
+
const timeoutMessage = timedOut ? `Command timed out after ${options.timeoutMs}ms.` : "";
|
|
6111
|
+
const stderr = [result.stderr || "", timeoutMessage].filter(Boolean).join(result.stderr ? `
|
|
6112
|
+
` : "");
|
|
6050
6113
|
return {
|
|
6051
6114
|
machineId,
|
|
6052
6115
|
source: resolved.source,
|
|
6053
6116
|
stdout: result.stdout || "",
|
|
6054
|
-
stderr
|
|
6055
|
-
exitCode: result.status ?? 1
|
|
6117
|
+
stderr,
|
|
6118
|
+
exitCode: timedOut ? 124 : result.status ?? 1,
|
|
6119
|
+
timedOut,
|
|
6120
|
+
signal: result.signal
|
|
6056
6121
|
};
|
|
6057
6122
|
}
|
|
6123
|
+
function runMachineCommandWithProcessGroupTimeout(machineId, resolved, options) {
|
|
6124
|
+
const timeoutMs = Math.max(1, options.timeoutMs ?? 1);
|
|
6125
|
+
const killGraceMs = Math.max(1, options.killGraceMs ?? 1000);
|
|
6126
|
+
const helperDir = mkdtempSync(join3(tmpdir(), "machines-timeout-helper-"));
|
|
6127
|
+
const pgidFile = join3(helperDir, "pgid");
|
|
6128
|
+
const helper = spawnSync2(process.execPath, ["--eval", PROCESS_GROUP_TIMEOUT_HELPER], {
|
|
6129
|
+
input: JSON.stringify({ command: resolved.command, args: resolved.args }),
|
|
6130
|
+
encoding: "utf8",
|
|
6131
|
+
env: {
|
|
6132
|
+
...process.env,
|
|
6133
|
+
HASNA_MACHINES_COMMAND_TIMEOUT_MS: String(timeoutMs),
|
|
6134
|
+
HASNA_MACHINES_COMMAND_KILL_GRACE_MS: String(killGraceMs),
|
|
6135
|
+
HASNA_MACHINES_COMMAND_PGID_FILE: pgidFile
|
|
6136
|
+
},
|
|
6137
|
+
timeout: timeoutMs + killGraceMs + 2000,
|
|
6138
|
+
killSignal: "SIGKILL",
|
|
6139
|
+
maxBuffer: 64 * 1024 * 1024
|
|
6140
|
+
});
|
|
6141
|
+
try {
|
|
6142
|
+
const parsed = parseHelperResult(helper.stdout);
|
|
6143
|
+
if (parsed) {
|
|
6144
|
+
return {
|
|
6145
|
+
machineId,
|
|
6146
|
+
source: resolved.source,
|
|
6147
|
+
stdout: parsed.stdout,
|
|
6148
|
+
stderr: parsed.stderr,
|
|
6149
|
+
exitCode: parsed.exitCode,
|
|
6150
|
+
timedOut: parsed.timedOut,
|
|
6151
|
+
signal: parsed.signal
|
|
6152
|
+
};
|
|
6153
|
+
}
|
|
6154
|
+
const helperTimedOut = Boolean(helper.error && "code" in helper.error && helper.error.code === "ETIMEDOUT");
|
|
6155
|
+
if (helperTimedOut)
|
|
6156
|
+
killPublishedProcessGroup(pgidFile);
|
|
6157
|
+
const timeoutMessage = helperTimedOut ? `Command timed out after ${timeoutMs}ms; timeout helper exceeded cleanup grace ${killGraceMs}ms.` : "";
|
|
6158
|
+
const stderr = [helper.stderr || "", timeoutMessage].filter(Boolean).join(helper.stderr ? `
|
|
6159
|
+
` : "");
|
|
6160
|
+
return {
|
|
6161
|
+
machineId,
|
|
6162
|
+
source: resolved.source,
|
|
6163
|
+
stdout: "",
|
|
6164
|
+
stderr,
|
|
6165
|
+
exitCode: helperTimedOut ? 124 : helper.status ?? 1,
|
|
6166
|
+
timedOut: helperTimedOut,
|
|
6167
|
+
signal: helper.signal
|
|
6168
|
+
};
|
|
6169
|
+
} finally {
|
|
6170
|
+
rmSync(helperDir, { recursive: true, force: true });
|
|
6171
|
+
}
|
|
6172
|
+
}
|
|
6173
|
+
function killPublishedProcessGroup(pgidFile) {
|
|
6174
|
+
if (!existsSync5(pgidFile))
|
|
6175
|
+
return;
|
|
6176
|
+
try {
|
|
6177
|
+
const pid = Number.parseInt(readFileSync3(pgidFile, "utf8").trim(), 10);
|
|
6178
|
+
if (!Number.isInteger(pid) || pid <= 1)
|
|
6179
|
+
return;
|
|
6180
|
+
process.kill(-pid, "SIGKILL");
|
|
6181
|
+
} catch {}
|
|
6182
|
+
}
|
|
6183
|
+
function parseHelperResult(stdout) {
|
|
6184
|
+
if (!stdout)
|
|
6185
|
+
return null;
|
|
6186
|
+
try {
|
|
6187
|
+
const parsed = JSON.parse(stdout);
|
|
6188
|
+
if (typeof parsed.stdout !== "string" || typeof parsed.stderr !== "string" || typeof parsed.exitCode !== "number")
|
|
6189
|
+
return null;
|
|
6190
|
+
return {
|
|
6191
|
+
machineId: "",
|
|
6192
|
+
source: "local",
|
|
6193
|
+
stdout: parsed.stdout,
|
|
6194
|
+
stderr: parsed.stderr,
|
|
6195
|
+
exitCode: parsed.exitCode,
|
|
6196
|
+
timedOut: parsed.timedOut === true,
|
|
6197
|
+
signal: typeof parsed.signal === "string" ? parsed.signal : null
|
|
6198
|
+
};
|
|
6199
|
+
} catch {
|
|
6200
|
+
return null;
|
|
6201
|
+
}
|
|
6202
|
+
}
|
|
6203
|
+
var PROCESS_GROUP_TIMEOUT_HELPER = `
|
|
6204
|
+
const { spawn } = require("node:child_process");
|
|
6205
|
+
const { readFileSync, writeFileSync } = require("node:fs");
|
|
6206
|
+
|
|
6207
|
+
const plan = JSON.parse(readFileSync(0, "utf8"));
|
|
6208
|
+
const command = String(plan.command || "");
|
|
6209
|
+
const args = Array.isArray(plan.args) ? plan.args.map(String) : [];
|
|
6210
|
+
const timeoutMs = Math.max(1, Number.parseInt(process.env.HASNA_MACHINES_COMMAND_TIMEOUT_MS || "1", 10));
|
|
6211
|
+
const killGraceMs = Math.max(1, Number.parseInt(process.env.HASNA_MACHINES_COMMAND_KILL_GRACE_MS || "1000", 10));
|
|
6212
|
+
const pgidFile = process.env.HASNA_MACHINES_COMMAND_PGID_FILE || "";
|
|
6213
|
+
let stdout = "";
|
|
6214
|
+
let stderr = "";
|
|
6215
|
+
let timedOut = false;
|
|
6216
|
+
let finished = false;
|
|
6217
|
+
let timeoutTimer;
|
|
6218
|
+
let killTimer;
|
|
6219
|
+
let sigkillSent = false;
|
|
6220
|
+
let pendingExit = null;
|
|
6221
|
+
|
|
6222
|
+
const child = spawn(command, args, {
|
|
6223
|
+
detached: true,
|
|
6224
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
6225
|
+
env: process.env,
|
|
6226
|
+
});
|
|
6227
|
+
|
|
6228
|
+
if (pgidFile && child.pid) {
|
|
6229
|
+
try {
|
|
6230
|
+
writeFileSync(pgidFile, String(child.pid), { mode: 0o600 });
|
|
6231
|
+
} catch {}
|
|
6232
|
+
}
|
|
6233
|
+
|
|
6234
|
+
function appendText(target, chunk) {
|
|
6235
|
+
return target + String(chunk);
|
|
6236
|
+
}
|
|
6237
|
+
|
|
6238
|
+
function killTarget(signal) {
|
|
6239
|
+
if (!child.pid) return;
|
|
6240
|
+
if (process.platform === "win32") {
|
|
6241
|
+
try {
|
|
6242
|
+
process.kill(child.pid, signal);
|
|
6243
|
+
} catch {}
|
|
6244
|
+
return;
|
|
6245
|
+
}
|
|
6246
|
+
try {
|
|
6247
|
+
process.kill(-child.pid, signal);
|
|
6248
|
+
} catch {}
|
|
6249
|
+
}
|
|
6250
|
+
|
|
6251
|
+
function finish(code, signal) {
|
|
6252
|
+
if (finished) return;
|
|
6253
|
+
if (timedOut && !sigkillSent) {
|
|
6254
|
+
pendingExit = { code, signal };
|
|
6255
|
+
return;
|
|
6256
|
+
}
|
|
6257
|
+
finished = true;
|
|
6258
|
+
if (timeoutTimer) clearTimeout(timeoutTimer);
|
|
6259
|
+
if (killTimer) clearTimeout(killTimer);
|
|
6260
|
+
if (timedOut) {
|
|
6261
|
+
stderr = [stderr, "Command timed out after " + timeoutMs + "ms."].filter(Boolean).join(stderr ? "\\n" : "");
|
|
6262
|
+
}
|
|
6263
|
+
const exitCode = timedOut ? 124 : code ?? 1;
|
|
6264
|
+
process.stdout.write(JSON.stringify({
|
|
6265
|
+
stdout,
|
|
6266
|
+
stderr,
|
|
6267
|
+
exitCode,
|
|
6268
|
+
timedOut,
|
|
6269
|
+
signal: signal ?? null,
|
|
6270
|
+
}), () => process.exit(exitCode));
|
|
6271
|
+
}
|
|
6272
|
+
|
|
6273
|
+
child.stdout.setEncoding("utf8");
|
|
6274
|
+
child.stderr.setEncoding("utf8");
|
|
6275
|
+
child.stdout.on("data", (chunk) => { stdout = appendText(stdout, chunk); });
|
|
6276
|
+
child.stderr.on("data", (chunk) => { stderr = appendText(stderr, chunk); });
|
|
6277
|
+
let childExit = { code: null, signal: null };
|
|
6278
|
+
child.on("error", (error) => {
|
|
6279
|
+
stderr = [stderr, error instanceof Error ? error.message : String(error)].filter(Boolean).join(stderr ? "\\n" : "");
|
|
6280
|
+
finish(1, null);
|
|
6281
|
+
});
|
|
6282
|
+
child.on("exit", (code, signal) => {
|
|
6283
|
+
childExit = { code, signal };
|
|
6284
|
+
});
|
|
6285
|
+
child.on("close", (code, signal) => {
|
|
6286
|
+
finish(code ?? childExit.code, signal ?? childExit.signal);
|
|
6287
|
+
});
|
|
6288
|
+
|
|
6289
|
+
timeoutTimer = setTimeout(() => {
|
|
6290
|
+
timedOut = true;
|
|
6291
|
+
killTarget("SIGTERM");
|
|
6292
|
+
killTimer = setTimeout(() => {
|
|
6293
|
+
sigkillSent = true;
|
|
6294
|
+
killTarget("SIGKILL");
|
|
6295
|
+
if (pendingExit) finish(pendingExit.code, pendingExit.signal);
|
|
6296
|
+
}, killGraceMs);
|
|
6297
|
+
}, timeoutMs);
|
|
6298
|
+
`;
|
|
6058
6299
|
function describeMachineCommandFailure(operation, result) {
|
|
6059
6300
|
const detail = (result.stderr || result.stdout || "").trim();
|
|
6060
6301
|
const suffix = detail ? `: ${detail}` : "";
|
package/dist/db.d.ts
CHANGED
|
@@ -49,4 +49,3 @@ export declare function countRuns(table: "setup_runs" | "sync_runs"): number;
|
|
|
49
49
|
export declare function setHeartbeatStatus(machineId: string, pid: number, status: "online" | "offline"): void;
|
|
50
50
|
export declare function recordSetupRun(machineId: string, status: string, details: unknown): void;
|
|
51
51
|
export declare function recordSyncRun(machineId: string, status: string, actions: unknown): void;
|
|
52
|
-
//# sourceMappingURL=db.d.ts.map
|
package/dist/index.d.ts
CHANGED
|
@@ -14,10 +14,11 @@ export * from "./commands/dns.js";
|
|
|
14
14
|
export * from "./commands/daemon.js";
|
|
15
15
|
export * from "./commands/doctor.js";
|
|
16
16
|
export * from "./commands/manifest.js";
|
|
17
|
+
export * from "./commands/mutation-approval.js";
|
|
17
18
|
export * from "./commands/diff.js";
|
|
18
19
|
export * from "./commands/install-claude.js";
|
|
19
20
|
export * from "./commands/install-tailscale.js";
|
|
20
|
-
export
|
|
21
|
+
export { addNotificationChannel, dispatchNotificationEvent, getDefaultNotificationConfig, listNotificationChannels, readNotificationConfig, removeNotificationChannel, testNotificationChannel, writeNotificationConfig, } from "./commands/notifications.js";
|
|
21
22
|
export * from "./commands/ports.js";
|
|
22
23
|
export * from "./commands/runtime.js";
|
|
23
24
|
export * from "./commands/self-test.js";
|
|
@@ -32,4 +33,3 @@ export * from "./mcp/server.js";
|
|
|
32
33
|
export { MACHINES_STORAGE_ENV, MACHINES_STORAGE_FALLBACK_ENV, MACHINES_STORAGE_MODE_ENV, MACHINES_STORAGE_MODE_FALLBACK_ENV, MACHINES_STORAGE_TABLES, STORAGE_DATABASE_ENV, STORAGE_MODE_ENV, STORAGE_TABLES, getStorageDatabaseEnv, getStorageDatabaseEnvName, getStorageDatabaseUrl, getStorageMode, getStoragePg, getStorageStatus, getSyncMetaAll, parseStorageTables, resolveTables, runStorageMigrations, storagePull, storagePush, storageSync, } from "./storage.js";
|
|
33
34
|
export type { StorageEnv, StorageMode, StorageStatus, SyncMeta, SyncResult as StorageSyncResult } from "./storage.js";
|
|
34
35
|
export * from "./version.js";
|
|
35
|
-
//# sourceMappingURL=index.d.ts.map
|