@monoclaw/machine 1.1.0-rc.4 → 1.1.0-rc.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/cli.js +130 -61
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1637,7 +1637,7 @@ import path6 from "node:path";
|
|
|
1637
1637
|
import { z as z10 } from "zod";
|
|
1638
1638
|
|
|
1639
1639
|
// src/version.ts
|
|
1640
|
-
var APP_VERSION = true ? "1.1.0-rc.
|
|
1640
|
+
var APP_VERSION = true ? "1.1.0-rc.5" : fromPackage();
|
|
1641
1641
|
var CLAUDE_CODE_VERSION = true ? "0.3.302" : claudeCodeFromPackage();
|
|
1642
1642
|
|
|
1643
1643
|
// src/update.ts
|
|
@@ -5375,6 +5375,27 @@ function verdict(lines) {
|
|
|
5375
5375
|
return { bad, text: bad ? `${bad} thing${bad === 1 ? "" : "s"} to fix.` : "Nothing to fix." };
|
|
5376
5376
|
}
|
|
5377
5377
|
|
|
5378
|
+
// src/style.ts
|
|
5379
|
+
import util from "node:util";
|
|
5380
|
+
function colourOn(stream = process.stdout, env = process.env) {
|
|
5381
|
+
if (env.FORCE_COLOR !== void 0) return env.FORCE_COLOR !== "0" && env.FORCE_COLOR !== "";
|
|
5382
|
+
if (env.NO_COLOR !== void 0 && env.NO_COLOR !== "") return false;
|
|
5383
|
+
if (env.TERM === "dumb") return false;
|
|
5384
|
+
return stream.isTTY === true;
|
|
5385
|
+
}
|
|
5386
|
+
var paint = (format, s) => util.styleText(format, s, { validateStream: false });
|
|
5387
|
+
function styles(on2 = colourOn()) {
|
|
5388
|
+
const id2 = (s) => s;
|
|
5389
|
+
if (!on2) return { ok: id2, bad: id2, warn: id2, bold: id2, dim: id2, on: false };
|
|
5390
|
+
return { ok: (s) => paint("green", s), bad: (s) => paint("red", s), warn: (s) => paint("yellow", s), bold: (s) => paint("bold", s), dim: (s) => paint("dim", s), on: true };
|
|
5391
|
+
}
|
|
5392
|
+
var style = styles();
|
|
5393
|
+
function checkLine(l, st2 = style) {
|
|
5394
|
+
const mark2 = l.ok ? st2.ok("\u2713") : l.info ? st2.dim("\u2022") : st2.bad("\u2717");
|
|
5395
|
+
return `${mark2} ${l.what}${l.fix ? `
|
|
5396
|
+
${st2.warn(`\u2192 ${l.fix}`)}` : ""}`;
|
|
5397
|
+
}
|
|
5398
|
+
|
|
5378
5399
|
// src/client.ts
|
|
5379
5400
|
import fs23 from "node:fs";
|
|
5380
5401
|
import os7 from "node:os";
|
|
@@ -7370,16 +7391,16 @@ async function buildStatus(deps) {
|
|
|
7370
7391
|
if (!attachments.length) notes.push("Not enrolled. Copy the command from Add a machine in the app.");
|
|
7371
7392
|
return { version: APP_VERSION, installedWith: deps.installedWith, computerId, running, serviceInstalled, updateWaiting: attachments.some((a) => a.holding), claude, models, attachments, unitsLeft, problems, notes };
|
|
7372
7393
|
}
|
|
7373
|
-
function renderStatus(r) {
|
|
7394
|
+
function renderStatus(r, st2 = styles(false)) {
|
|
7374
7395
|
const out = [];
|
|
7375
7396
|
const mb3 = (b) => `${Math.round(b / 1024 / 1024)} MB`;
|
|
7376
|
-
out.push(`monoclaw ${r.version} (${r.installedWith})${r.computerId ? `, computer ${r.computerId.slice(0, 12)}` : ""}`);
|
|
7397
|
+
out.push(st2.bold(`monoclaw ${r.version}`) + ` (${r.installedWith})${r.computerId ? `, computer ${r.computerId.slice(0, 12)}` : ""}`);
|
|
7377
7398
|
out.push(r.running ? `Running: pid ${r.running.pid}${r.running.version !== "unknown" ? `, version ${r.running.version}` : ""}${r.running.startedAt ? `, since ${r.running.startedAt}` : ""}${r.updateWaiting ? "; an update is waiting for agents to finish" : ""}` : `Not running${r.serviceInstalled ? " (the background service is installed)" : ""}`);
|
|
7378
7399
|
out.push(`Claude: ${r.claude.detail}`);
|
|
7379
7400
|
out.push(`Models: ${r.models.bytes ? `${mb3(r.models.bytes)} in ${r.models.dir}` : "none downloaded"}`);
|
|
7380
7401
|
for (const a of r.attachments) {
|
|
7381
7402
|
out.push("");
|
|
7382
|
-
out.push(
|
|
7403
|
+
out.push(st2.bold(label(a)) + (a.organisation.kind === "personal" ? " \xB7 your own account" : ""));
|
|
7383
7404
|
out.push(` Machine: "${a.machine.name}"${a.machine.id ? ` (${a.machine.id.slice(0, 12)})` : ""} \xB7 ${a.state}${a.lastError ? ` \xB7 ${a.lastError}` : ""}`);
|
|
7384
7405
|
out.push(` Folders: ${a.folders.join(", ") || "(none)"}`);
|
|
7385
7406
|
if (a.sessions) out.push(` Agents: ${a.sessions.busy} working, ${a.sessions.open} session${a.sessions.open === 1 ? "" : "s"} open${a.sessions.background ? `, ${a.sessions.background} in the background` : ""}${a.holding ? " \xB7 new turns held for an update" : ""}`);
|
|
@@ -7393,11 +7414,10 @@ function renderStatus(r) {
|
|
|
7393
7414
|
}
|
|
7394
7415
|
for (const n of r.notes) out.push("", n);
|
|
7395
7416
|
out.push("");
|
|
7396
|
-
if (!r.problems.length) out.push("All good.");
|
|
7417
|
+
if (!r.problems.length) out.push(st2.ok("All good."));
|
|
7397
7418
|
else {
|
|
7398
|
-
out.push(`${r.problems.length} thing${r.problems.length === 1 ? "" : "s"} to fix:`);
|
|
7399
|
-
for (const p of r.problems) out.push(
|
|
7400
|
-
\u2192 ${p.fix}` : ""}`);
|
|
7419
|
+
out.push(st2.bad(`${r.problems.length} thing${r.problems.length === 1 ? "" : "s"} to fix:`));
|
|
7420
|
+
for (const p of r.problems) out.push(checkLine({ ok: false, what: `${p.where}: ${p.what}`, fix: p.fix ?? void 0 }, st2));
|
|
7401
7421
|
}
|
|
7402
7422
|
return out;
|
|
7403
7423
|
}
|
|
@@ -7466,7 +7486,6 @@ function windowsPathNote(binDir) {
|
|
|
7466
7486
|
Settings \u2192 System \u2192 About \u2192 Advanced system settings \u2192 Environment Variables \u2192 Path (your user's), or in PowerShell:
|
|
7467
7487
|
[Environment]::SetEnvironmentVariable("Path", [Environment]::GetEnvironmentVariable("Path", "User") + ";${binDir}", "User")`;
|
|
7468
7488
|
}
|
|
7469
|
-
var exportForNow = (binDir) => `export PATH="${binDir}:$PATH"`;
|
|
7470
7489
|
function addProfileLine(t) {
|
|
7471
7490
|
const have = fs27.existsSync(t.file) ? fs27.readFileSync(t.file, "utf8") : null;
|
|
7472
7491
|
if (have !== null && have.split(/\r?\n/).some((l) => l.trim() === t.line)) return false;
|
|
@@ -7599,7 +7618,11 @@ async function planUninstall(deps) {
|
|
|
7599
7618
|
present: copies.length > 0 || deps.installedWithNpm || claudeCode2.length > 0
|
|
7600
7619
|
}
|
|
7601
7620
|
];
|
|
7621
|
+
const home = deps.home ?? os9.homedir();
|
|
7622
|
+
const tilde2 = (p) => p === home ? "~" : p.startsWith(home + path28.sep) ? `~${p.slice(home.length)}` : p;
|
|
7623
|
+
const roots2 = [...new Set(attachments.flatMap((a) => [...a.cfg.roots, ...a.cfg.providerAccounts.flatMap((c) => c.allowedFolders)]))].sort();
|
|
7602
7624
|
const untouched = [
|
|
7625
|
+
...roots2.map((r) => `${tilde2(r)} is left: it is yours.`),
|
|
7603
7626
|
"The folders agents work in and everything in them that the program did not write itself: never touched. A folder goes only if the program made it and it is empty after.",
|
|
7604
7627
|
"Files saved before 1.1.0 are not known and are left; so is every folder the program never opened a session in.",
|
|
7605
7628
|
`Claude's own login and session history (${path28.join(deps.home ?? os9.homedir(), ".claude")}): not ours to delete; \`claude auth logout\` signs out.`
|
|
@@ -7736,13 +7759,13 @@ async function runUninstall(plan, chosen, deps, say = () => {
|
|
|
7736
7759
|
});
|
|
7737
7760
|
return out;
|
|
7738
7761
|
}
|
|
7739
|
-
function describePlan(plan) {
|
|
7740
|
-
const out = ["What MonoClaw has on this computer:", ""];
|
|
7762
|
+
function describePlan(plan, st2 = styles(false)) {
|
|
7763
|
+
const out = [st2.bold("What MonoClaw has on this computer:"), ""];
|
|
7741
7764
|
for (const item of plan.items) {
|
|
7742
|
-
out.push(`${item.present ? "\u2022" : "\xB7"} ${item.title}${item.bytes ? ` \xB7 ${mb(item.bytes)}` : ""}${item.present ? "" : " (nothing here)"}`);
|
|
7765
|
+
out.push(`${item.present ? "\u2022" : st2.dim("\xB7")} ${item.present ? st2.bold(item.title) : st2.dim(item.title)}${item.bytes ? ` \xB7 ${mb(item.bytes)}` : ""}${item.present ? "" : st2.dim(" (nothing here)")}`);
|
|
7743
7766
|
for (const l of item.lines) out.push(` ${l}`);
|
|
7744
7767
|
}
|
|
7745
|
-
out.push("", "Never touched:");
|
|
7768
|
+
out.push("", st2.bold("Never touched:"));
|
|
7746
7769
|
for (const u4 of plan.untouched) out.push(` ${u4}`);
|
|
7747
7770
|
return out;
|
|
7748
7771
|
}
|
|
@@ -7863,13 +7886,15 @@ var profileArgs = (profile) => profile ? ["--profile", profile] : [];
|
|
|
7863
7886
|
function enrolOutcome(file = connectResultPath()) {
|
|
7864
7887
|
try {
|
|
7865
7888
|
const r = JSON.parse(fs29.readFileSync(file, "utf8"));
|
|
7866
|
-
return { profile: typeof r.profile === "string" && r.profile ? r.profile : null, attached: r.attached === true };
|
|
7889
|
+
return { profile: typeof r.profile === "string" && r.profile ? r.profile : null, attached: r.attached === true, name: typeof r.name === "string" ? r.name : null, space: r.space && typeof r.space === "object" ? { handle: r.space.handle ?? null, name: r.space.name ?? null } : null, roots: Array.isArray(r.roots) ? r.roots.filter((x10) => typeof x10 === "string") : [], modules: typeof r.modules === "number" ? r.modules : 0 };
|
|
7867
7890
|
} catch {
|
|
7868
|
-
return { profile: null, attached: false };
|
|
7891
|
+
return { profile: null, attached: false, name: null, space: null, roots: [], modules: 0 };
|
|
7869
7892
|
} finally {
|
|
7870
7893
|
fs29.rmSync(file, { force: true });
|
|
7871
7894
|
}
|
|
7872
7895
|
}
|
|
7896
|
+
var tilde = (p, home = os10.homedir()) => p === home ? "~" : p.startsWith(home + path29.sep) ? `~${p.slice(home.length)}` : p;
|
|
7897
|
+
var withHome = (p, home = os10.homedir()) => p.startsWith(home + path29.sep) ? `$HOME${p.slice(home.length)}` : p;
|
|
7873
7898
|
function installFailure(message, where = "") {
|
|
7874
7899
|
const tail = message.trim().split("\n").slice(-3).join(" ").slice(0, 300);
|
|
7875
7900
|
if (/EACCES|permission denied/i.test(message)) return `npm isn't allowed to write to ${where || "that folder"} (permission denied). Don't use sudo. ${tail}`;
|
|
@@ -7878,16 +7903,22 @@ function installFailure(message, where = "") {
|
|
|
7878
7903
|
var isPermissionDenied = (message) => /EACCES|EPERM|permission denied/i.test(message);
|
|
7879
7904
|
function run2(node, script, args2) {
|
|
7880
7905
|
return new Promise((resolve2) => {
|
|
7881
|
-
const child = spawn4(node, [script, ...args2], { stdio: "
|
|
7882
|
-
|
|
7883
|
-
child.on("
|
|
7906
|
+
const child = spawn4(node, [script, ...args2], { stdio: ["ignore", "pipe", "pipe"], env: { ...process.env, MONOCLAW_CONNECT: "1" } });
|
|
7907
|
+
let out = "";
|
|
7908
|
+
child.stdout.on("data", (d) => out += d);
|
|
7909
|
+
child.stderr.on("data", (d) => out += d);
|
|
7910
|
+
child.on("error", (e12) => resolve2({ code: 1, out: `${out}
|
|
7911
|
+
${e12.message}` }));
|
|
7912
|
+
child.on("exit", (code) => resolve2({ code: code ?? 1, out }));
|
|
7884
7913
|
});
|
|
7885
7914
|
}
|
|
7886
7915
|
async function connect(o, out = { say: (s) => console.log(s), fail: (s) => console.error(s) }, deps = {}) {
|
|
7887
|
-
|
|
7916
|
+
const st2 = deps.styles ?? style;
|
|
7917
|
+
out.say(st2.bold("MonoClaw: connecting this computer"));
|
|
7888
7918
|
const node = process.execPath;
|
|
7889
7919
|
let script = process.argv[1] ?? "";
|
|
7890
|
-
|
|
7920
|
+
const facts = { version: APP_VERSION, prefix: null, own: false, wasThere: false, binToAdd: null, newTerminalsHaveIt: false };
|
|
7921
|
+
const home = deps.home ?? os10.homedir();
|
|
7891
7922
|
const runStep = deps.run ?? run2;
|
|
7892
7923
|
const platform = deps.platform ?? process.platform;
|
|
7893
7924
|
const lasting = detectInstallMode() === "npm-global" && !ranFromNpx();
|
|
@@ -7901,19 +7932,20 @@ async function connect(o, out = { say: (s) => console.log(s), fail: (s) => conso
|
|
|
7901
7932
|
const copies = installedCopies(npmPrefix, own, platform);
|
|
7902
7933
|
const newest = copies[0] ?? null;
|
|
7903
7934
|
const decision = shouldInstall(newest?.version ?? null, APP_VERSION, o.from);
|
|
7904
|
-
if (decision.
|
|
7905
|
-
|
|
7906
|
-
|
|
7935
|
+
if (!decision.install && newest) {
|
|
7936
|
+
facts.version = newest.version;
|
|
7937
|
+
facts.wasThere = true;
|
|
7938
|
+
}
|
|
7907
7939
|
const spec = o.from ?? `${PACKAGE}@${APP_VERSION}`;
|
|
7908
7940
|
let target = newest?.prefix ?? null;
|
|
7909
7941
|
if (decision.install) {
|
|
7910
7942
|
const writable = npmPrefix ? (deps.writable ?? ((p) => prefixWritable(p, platform)))(npmPrefix) : false;
|
|
7911
7943
|
target = newest?.prefix ?? (writable && npmPrefix ? npmPrefix : own);
|
|
7912
|
-
if (target === own && !newest) out.say(`npm's folder (${npmPrefix ?? "unknown"}) is not writable by you, so MonoClaw goes into its own folder, ${own}. No sudo is needed, and npm's own settings are not changed.`);
|
|
7944
|
+
if (target === own && !newest) out.say(`npm's folder (${npmPrefix ?? "unknown"}) is not writable by you, so MonoClaw goes into its own folder, ${tilde(own, home)}. No sudo is needed, and npm's own settings are not changed.`);
|
|
7913
7945
|
const installInto = async (prefix) => {
|
|
7914
7946
|
out.say(`Installing ${spec} into ${prefix} (about a minute; npm says nothing while it works)\u2026`);
|
|
7915
7947
|
const began = Date.now();
|
|
7916
|
-
const ticker = setInterval(() => out.say(` still installing (${Math.round((Date.now() - began) / 1e3)} s)\u2026`), deps.tickMs ?? 15e3);
|
|
7948
|
+
const ticker = setInterval(() => out.say(st2.dim(` still installing (${Math.round((Date.now() - began) / 1e3)} s)\u2026`)), deps.tickMs ?? 15e3);
|
|
7917
7949
|
try {
|
|
7918
7950
|
await (deps.install ?? npmInstallGlobal)(spec, prefix);
|
|
7919
7951
|
} finally {
|
|
@@ -7925,7 +7957,7 @@ async function connect(o, out = { say: (s) => console.log(s), fail: (s) => conso
|
|
|
7925
7957
|
} catch (e12) {
|
|
7926
7958
|
const msg = e12.message;
|
|
7927
7959
|
if (target !== own && isPermissionDenied(msg)) {
|
|
7928
|
-
out.say(`npm was not allowed to write to ${target} after all; installing into ${own} instead.`);
|
|
7960
|
+
out.say(`npm was not allowed to write to ${target} after all; installing into ${tilde(own, home)} instead.`);
|
|
7929
7961
|
target = own;
|
|
7930
7962
|
try {
|
|
7931
7963
|
await installInto(own);
|
|
@@ -7947,14 +7979,12 @@ async function connect(o, out = { say: (s) => console.log(s), fail: (s) => conso
|
|
|
7947
7979
|
try {
|
|
7948
7980
|
addProfileLine(t);
|
|
7949
7981
|
profileLine = { file: t.file, line: t.line };
|
|
7950
|
-
|
|
7982
|
+
facts.newTerminalsHaveIt = true;
|
|
7983
|
+
if (t.shell === "unknown") out.say(`Your shell is not one MonoClaw knows, so the line for the monoclaw command went to ~/.profile; move it if your shell reads another file.`);
|
|
7951
7984
|
} catch (e12) {
|
|
7952
7985
|
out.say(`Could not write ${t.file} (${e12.message}); add this line to your shell's profile yourself:
|
|
7953
7986
|
${t.line}`);
|
|
7954
7987
|
}
|
|
7955
|
-
out.say(`Open a new terminal to use the monoclaw command, or for this one run:
|
|
7956
|
-
${exportForNow(binDir)}`);
|
|
7957
|
-
ownBin = binDir;
|
|
7958
7988
|
}
|
|
7959
7989
|
(deps.record ?? recordProgram)({ dir: own, createdAt: (deps.now ?? (() => /* @__PURE__ */ new Date()))().toISOString(), profileLine });
|
|
7960
7990
|
}
|
|
@@ -7963,7 +7993,10 @@ async function connect(o, out = { say: (s) => console.log(s), fail: (s) => conso
|
|
|
7963
7993
|
const g = layout(target ?? npmPrefix ?? own, platform);
|
|
7964
7994
|
if (!fs29.existsSync(g.script)) throw new Error(`${g.script} is missing`);
|
|
7965
7995
|
script = g.script;
|
|
7966
|
-
|
|
7996
|
+
facts.prefix = target ?? npmPrefix ?? own;
|
|
7997
|
+
facts.own = facts.prefix === own;
|
|
7998
|
+
const onPath2 = (process.env.PATH ?? "").split(path29.delimiter).some((d) => path29.resolve(d) === path29.resolve(g.binDir));
|
|
7999
|
+
if (!onPath2 && platform !== "win32") facts.binToAdd = g.binDir;
|
|
7967
8000
|
} catch (e12) {
|
|
7968
8001
|
out.fail(`Installed, but the program could not be found afterwards (${e12.message}). Run: npm install -g ${PACKAGE}`);
|
|
7969
8002
|
return 1;
|
|
@@ -7971,24 +8004,58 @@ async function connect(o, out = { say: (s) => console.log(s), fail: (s) => conso
|
|
|
7971
8004
|
}
|
|
7972
8005
|
const hasEnrolment = listProfiles().some((p) => p.config);
|
|
7973
8006
|
fs29.rmSync(connectResultPath(), { force: true });
|
|
7974
|
-
|
|
8007
|
+
const enrolled = await runStep(node, script, enrolArgs(o, hasEnrolment));
|
|
8008
|
+
if (enrolled.code !== 0) {
|
|
8009
|
+
if (enrolled.out.trim()) out.fail(enrolled.out.trim());
|
|
7975
8010
|
out.fail("This computer was not connected. If the token has run out, copy a new command from Add a machine.");
|
|
7976
8011
|
return 1;
|
|
7977
8012
|
}
|
|
7978
8013
|
const outcome = enrolOutcome();
|
|
7979
8014
|
const profile = profileArgs(o.profile ?? outcome.profile);
|
|
7980
|
-
|
|
7981
|
-
|
|
7982
|
-
|
|
7983
|
-
|
|
8015
|
+
let service2 = "not started";
|
|
8016
|
+
if (outcome.attached) service2 = "running";
|
|
8017
|
+
else if (o.service) {
|
|
8018
|
+
const r = await runStep(node, script, ["service", "install"]);
|
|
8019
|
+
service2 = r.code === 0 ? "installed" : "failed";
|
|
8020
|
+
if (r.code !== 0 && r.out.trim()) out.fail(r.out.trim());
|
|
8021
|
+
}
|
|
8022
|
+
let faults = [];
|
|
8023
|
+
const checked = await runStep(node, script, [...profile, "doctor", "--json"]);
|
|
8024
|
+
try {
|
|
8025
|
+
const d = JSON.parse(checked.out.trim().split("\n").find((l) => l.startsWith("{")) ?? "");
|
|
8026
|
+
faults = d.lines.filter((l) => !l.ok && !l.info).map((l) => ({ what: l.what, fix: l.fix }));
|
|
8027
|
+
} catch {
|
|
8028
|
+
faults = [{ what: "This machine could not be checked", fix: "monoclaw doctor shows what is wrong" }];
|
|
7984
8029
|
}
|
|
7985
8030
|
out.say("");
|
|
7986
|
-
|
|
8031
|
+
const tick = st2.ok("\u2713");
|
|
8032
|
+
const cross = st2.bad("\u2717");
|
|
8033
|
+
const note = st2.dim("\u2022");
|
|
8034
|
+
const where = facts.prefix ? tilde(facts.prefix, home) : "npm's folder";
|
|
8035
|
+
out.say(facts.wasThere ? `${tick} MonoClaw ${facts.version} is already installed in ${where}` : `${tick} Installed MonoClaw ${facts.version} in ${where}`);
|
|
8036
|
+
if (facts.own) out.say(st2.dim(" (npm's own folder needs a password, so MonoClaw uses its own. No sudo.)"));
|
|
8037
|
+
out.say(`${tick} Connected as ${st2.bold(`"${outcome.name ?? o.name ?? os10.hostname()}"`)} to ${st2.bold(outcome.space?.handle ?? outcome.space?.name ?? "your account")}`);
|
|
8038
|
+
if (service2 === "installed") out.say(`${tick} Running in the background; it starts again when you log in`);
|
|
8039
|
+
else if (service2 === "running") out.say(`${tick} The MonoClaw program already running on this computer serves it from now`);
|
|
8040
|
+
else if (service2 === "failed") out.say(`${cross} The background service could not be installed here
|
|
8041
|
+
${st2.warn("\u2192 To run it in this terminal instead: monoclaw start --foreground (it stops when the terminal closes)")}`);
|
|
8042
|
+
else out.say(`${note} Not started (--no-service). To run it in this terminal: monoclaw start --foreground (it stops when the terminal closes)`);
|
|
8043
|
+
if (outcome.roots.length) out.say(`${tick} Agents on this computer work in ${outcome.roots.map((r) => tilde(r, home)).join(", ")}`);
|
|
8044
|
+
else out.say(`${note} No folder for agents yet: monoclaw roots add ~/command`);
|
|
8045
|
+
for (const f of faults) out.say(`${cross} ${f.what}${f.fix ? `
|
|
8046
|
+
${st2.warn(`\u2192 ${f.fix}`)}` : ""}`);
|
|
7987
8047
|
out.say("");
|
|
7988
|
-
out.say(
|
|
7989
|
-
if (
|
|
7990
|
-
|
|
7991
|
-
|
|
8048
|
+
if (faults.length || service2 === "failed") out.say(st2.bold("Fix the above first, then go back to MonoClaw in your browser."));
|
|
8049
|
+
else if (outcome.modules === 0) out.say(`This computer does nothing yet.
|
|
8050
|
+
${st2.bold("Go back to MonoClaw in your browser to choose what it does.")}`);
|
|
8051
|
+
else out.say(st2.bold("Go back to MonoClaw in your browser."));
|
|
8052
|
+
if (facts.binToAdd) {
|
|
8053
|
+
out.say("");
|
|
8054
|
+
out.say(`To use the monoclaw command in this terminal, run:
|
|
8055
|
+
${st2.bold(`export PATH="${withHome(facts.binToAdd, home)}:$PATH"`)}`);
|
|
8056
|
+
out.say(st2.dim(facts.newTerminalsHaveIt ? "(New terminals have it already.)" : "(Add that folder to your PATH to keep it.)"));
|
|
8057
|
+
}
|
|
8058
|
+
return faults.length || service2 === "failed" ? 1 : 0;
|
|
7992
8059
|
}
|
|
7993
8060
|
|
|
7994
8061
|
// src/cli-since.ts
|
|
@@ -39348,18 +39415,18 @@ function describeTool(name, input, cwd) {
|
|
|
39348
39415
|
}
|
|
39349
39416
|
}
|
|
39350
39417
|
}
|
|
39351
|
-
function buildSummaryPrompt(
|
|
39418
|
+
function buildSummaryPrompt(style2, mode = "final", hasPrevious = false) {
|
|
39352
39419
|
const parts = [];
|
|
39353
|
-
if (
|
|
39420
|
+
if (style2.prompt?.trim()) parts.push(style2.prompt.trim().slice(0, 8e3));
|
|
39354
39421
|
else {
|
|
39355
|
-
const instructions =
|
|
39356
|
-
if (
|
|
39422
|
+
const instructions = style2.instructions.trim().slice(0, 4e3);
|
|
39423
|
+
if (style2.promptMode === "replace" && instructions) parts.push(instructions);
|
|
39357
39424
|
else {
|
|
39358
|
-
parts.push((
|
|
39359
|
-
if (
|
|
39360
|
-
if (
|
|
39361
|
-
if (
|
|
39362
|
-
${
|
|
39425
|
+
parts.push((style2.basePrompt?.trim() || DEFAULT_SUMMARY_PROMPT).slice(0, 8e3));
|
|
39426
|
+
if (style2.adminName) parts.push(`The user's name is ${style2.adminName}.`);
|
|
39427
|
+
if (style2.groupTitle) parts.push(`The chat is called "${style2.groupTitle}".`);
|
|
39428
|
+
if (style2.persona?.trim()) parts.push(`For your name and manner only, this is the agent's persona:
|
|
39429
|
+
${style2.persona.trim().slice(0, 2e3)}`);
|
|
39363
39430
|
if (instructions) parts.push(`The user's own instructions for these summaries follow. Where they conflict with anything above, the user's instructions win; the word limit and "write for the ear" still apply.
|
|
39364
39431
|
|
|
39365
39432
|
${instructions}`);
|
|
@@ -39368,7 +39435,7 @@ ${instructions}`);
|
|
|
39368
39435
|
parts.push(
|
|
39369
39436
|
mode === "progress" ? `This is a progress update on work still in progress: say what has happened since the last update, what is being done now, and what is left. Mention a failure only if it matters.${hasPrevious ? " An earlier update is given; do not repeat what it already said." : ""} Do not invent progress that the activity does not show.` : `This is the wrap-up of a finished reply${hasPrevious ? "; earlier updates were already spoken, so wrap up overall rather than repeating them step by step" : ""}.`
|
|
39370
39437
|
);
|
|
39371
|
-
const limit =
|
|
39438
|
+
const limit = style2.prompt?.trim() ? "" : `At most ${style2.maxWords ?? 120} words; shorter is better when there is little to say. `;
|
|
39372
39439
|
parts.push(`${limit}Your words will be spoken aloud by a speech synthesiser: plain sentences, no lists, no markdown, no headings, no code, no ids, paths or URLs.`);
|
|
39373
39440
|
return parts.join("\n\n");
|
|
39374
39441
|
}
|
|
@@ -39555,8 +39622,8 @@ program.command("enrol [token]").description("Connect this machine to your MonoC
|
|
|
39555
39622
|
const profiles = listProfiles();
|
|
39556
39623
|
const preview = await previewToken(opts.router, token, profiles.map((p) => p.config?.hostId ?? "").filter(Boolean), opts.insecure);
|
|
39557
39624
|
const plan = planEnrol(preview, profiles, opts.router, { requestedProfile: att.profile, defaultName: os13.hostname() });
|
|
39558
|
-
const report = (profile, attached2 = false) => {
|
|
39559
|
-
if (process.env.MONOCLAW_CONNECT) fs32.writeFileSync(connectResultPath(), JSON.stringify({ profile, attached: attached2, at: (/* @__PURE__ */ new Date()).toISOString() }), { mode: 384 });
|
|
39625
|
+
const report = (profile, attached2 = false, c = loadConfig(attachmentFor(profile).dir)) => {
|
|
39626
|
+
if (process.env.MONOCLAW_CONNECT) fs32.writeFileSync(connectResultPath(), JSON.stringify({ profile, attached: attached2, at: (/* @__PURE__ */ new Date()).toISOString(), name: c?.name ?? null, space: c ? { handle: c.spaceHandle ?? null, name: c.spaceName ?? null } : null, roots: c?.roots ?? [], modules: c?.modules.length ?? 0 }), { mode: 384 });
|
|
39560
39627
|
};
|
|
39561
39628
|
if (plan.action === "already") {
|
|
39562
39629
|
console.log(plan.message);
|
|
@@ -39594,7 +39661,7 @@ program.command("enrol [token]").description("Connect this machine to your MonoC
|
|
|
39594
39661
|
if (plan.reason === "second-space") console.log(`This computer is now a machine in ${listProfiles().filter((p) => p.config).length} organisations, served by one program with its models and Claude login shared; each keeps its own modules and keys. The first enrolment is untouched${attached ? ", and the running program serves the new one from now" : ""}.`);
|
|
39595
39662
|
else if (attached) console.log("The program running on this computer serves it from now.");
|
|
39596
39663
|
if (!cfg.roots.length) console.log(`No folders exposed yet. Add one with: ${cmd("roots add ~/command")}`);
|
|
39597
|
-
report(att.profile, attached);
|
|
39664
|
+
report(att.profile, attached, cfg);
|
|
39598
39665
|
if (process.env.MONOCLAW_CONNECT) return;
|
|
39599
39666
|
if (!attached) console.log(`
|
|
39600
39667
|
Next, run it:
|
|
@@ -39765,7 +39832,7 @@ program.command("status").description("Everything this computer does for MonoCla
|
|
|
39765
39832
|
}
|
|
39766
39833
|
});
|
|
39767
39834
|
if (o.json) console.log(JSON.stringify(report, null, 2));
|
|
39768
|
-
else for (const line of renderStatus(report)) console.log(line);
|
|
39835
|
+
else for (const line of renderStatus(report, style)) console.log(line);
|
|
39769
39836
|
if (report.problems.length) process.exit(1);
|
|
39770
39837
|
});
|
|
39771
39838
|
program.command("logs [organisation]").description("The program's log, all of it or one organisation's lines ('default' for the first enrolment); -f follows it").option("-f, --follow", "Keep printing new lines").option("--since <when>", "Only lines from then: a time (2026-11-28T10:00:00Z) or how long ago (30m, 2h, 1d)").action(async (organisation, o) => {
|
|
@@ -39947,7 +40014,7 @@ async function runClaude(rest) {
|
|
|
39947
40014
|
process.exit(code);
|
|
39948
40015
|
}
|
|
39949
40016
|
program.command("claude").description("Run the Claude Code this machine uses, with whatever follows: `monoclaw claude auth login` signs it in, `monoclaw claude auth status` shows who is signed in").allowUnknownOption(true).allowExcessArguments(true).helpOption(false).action(() => runClaude(process.argv.slice(process.argv.indexOf("claude", 2) + 1)));
|
|
39950
|
-
program.command("doctor").description("Check and repair what a working machine needs: Node, the program, folders, the service, its modules; with a Claude module, MonoClaw's copy of Claude Code and your Claude login").option("--no-repair", "Only report; do not install anything").action(async (opts) => {
|
|
40017
|
+
program.command("doctor").description("Check and repair what a working machine needs: Node, the program, folders, the service, its modules; with a Claude module, MonoClaw's copy of Claude Code and your Claude login").option("--no-repair", "Only report; do not install anything").option("--json", "The lines as JSON (what connect reads)").action(async (opts) => {
|
|
39951
40018
|
const lines = [];
|
|
39952
40019
|
const major = Number(process.versions.node.split(".")[0]);
|
|
39953
40020
|
lines.push({ ok: major >= 22, what: `Node ${process.versions.node}`, fix: major >= 22 ? void 0 : nodeInstallHint(process.platform) });
|
|
@@ -40000,11 +40067,13 @@ program.command("doctor").description("Check and repair what a working machine n
|
|
|
40000
40067
|
lines.push({ ok: !!ffmpeg, what: ffmpeg ? `ffmpeg: ${ffmpeg}` : "ffmpeg is missing (Kokoro and Parakeet need it)", fix: ffmpeg ? void 0 : ffmpegHint() });
|
|
40001
40068
|
}
|
|
40002
40069
|
}
|
|
40003
|
-
for (const l of lines) console.log(`${l.ok ? "\u2713" : l.info ? "\u2022" : "\u2717"} ${l.what}${l.fix ? `
|
|
40004
|
-
\u2192 ${l.fix}` : ""}`);
|
|
40005
40070
|
const v = verdict(lines);
|
|
40006
|
-
console.log(
|
|
40007
|
-
|
|
40071
|
+
if (opts.json) console.log(JSON.stringify({ lines, bad: v.bad, text: v.text }));
|
|
40072
|
+
else {
|
|
40073
|
+
for (const l of lines) console.log(checkLine(l));
|
|
40074
|
+
console.log(`
|
|
40075
|
+
${v.bad ? style.bad(v.text) : style.ok(v.text)}`);
|
|
40076
|
+
}
|
|
40008
40077
|
if (v.bad) process.exit(1);
|
|
40009
40078
|
});
|
|
40010
40079
|
program.command("update").description("Update the program now (to the service's latest, or --to <version>)").option("--to <version>", "Exact version to install").action(async (opts) => {
|
|
@@ -40113,7 +40182,7 @@ program.command("uninstall").description("Remove MonoClaw from this computer, by
|
|
|
40113
40182
|
program: loadComputer()?.program ?? null
|
|
40114
40183
|
};
|
|
40115
40184
|
const plan = await planUninstall(deps);
|
|
40116
|
-
for (const line of describePlan(plan)) console.log(line);
|
|
40185
|
+
for (const line of describePlan(plan, style)) console.log(line);
|
|
40117
40186
|
console.log("");
|
|
40118
40187
|
const offered = plan.items.filter((i) => i.present);
|
|
40119
40188
|
if (!offered.length) return console.log("Nothing of MonoClaw's to remove here.");
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@monoclaw/machine",
|
|
3
|
-
"version": "1.1.0-rc.
|
|
3
|
+
"version": "1.1.0-rc.5",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@monoclaw/machine",
|
|
9
|
-
"version": "1.1.0-rc.
|
|
9
|
+
"version": "1.1.0-rc.5",
|
|
10
10
|
"license": "UNLICENSED",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@anthropic-ai/sdk": "0.93.0",
|
package/package.json
CHANGED