@monoclaw/machine 1.0.16 → 1.0.17
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 +108 -52
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -734,7 +734,7 @@ var Accounts = class {
|
|
|
734
734
|
|
|
735
735
|
// src/client.ts
|
|
736
736
|
import fs16 from "node:fs";
|
|
737
|
-
import
|
|
737
|
+
import os5 from "node:os";
|
|
738
738
|
import path16 from "node:path";
|
|
739
739
|
import WebSocket from "ws";
|
|
740
740
|
|
|
@@ -1203,7 +1203,14 @@ var RouterFrame = z4.discriminatedUnion("t", [
|
|
|
1203
1203
|
id: z4.string(),
|
|
1204
1204
|
text: z4.string().optional(),
|
|
1205
1205
|
error: z4.string().optional(),
|
|
1206
|
-
files: z4.array(z4.object({
|
|
1206
|
+
files: z4.array(z4.object({
|
|
1207
|
+
url: z4.string(),
|
|
1208
|
+
name: z4.string(),
|
|
1209
|
+
mime: z4.string(),
|
|
1210
|
+
attachmentId: z4.string(),
|
|
1211
|
+
/** The host shows this image to the model (an image block beside the text) and saves nothing (`image_view`, plan draft-2026-11-26-an-agent-can-look-at-an-image). Absent: saved as before. */
|
|
1212
|
+
show: z4.boolean().optional()
|
|
1213
|
+
})).default([]),
|
|
1207
1214
|
/**
|
|
1208
1215
|
* For a `tool.use` only (docs/TOOLS.md): the call is valid but did not run yet. `ask`: a person must approve it
|
|
1209
1216
|
* first (the host shows its approval card). `upload`: the input's field of that name is a file on the agent's
|
|
@@ -1349,6 +1356,16 @@ var AGENTS_PROPOSE_CHANGE = {
|
|
|
1349
1356
|
example: { agent_name: "Mara", changes: { brief: "You test every change against the plan's verification section before it is called done. A flaky test is a bug: file it, never retry past it." } }
|
|
1350
1357
|
};
|
|
1351
1358
|
|
|
1359
|
+
// ../../packages/protocol/src/image-view-tool.ts
|
|
1360
|
+
import { z as z8 } from "zod";
|
|
1361
|
+
var IMAGE_VIEW_MAX_BYTES = 5 * 1024 * 1024;
|
|
1362
|
+
var IMAGE_VIEW = {
|
|
1363
|
+
name: "image_view",
|
|
1364
|
+
description: "Shows you a picture, so you can look at it and describe it. Use it when you have a picture only as an id, `attachment:<id>`: an agent's profile picture from agents_read_profile, an image a tool made, or an image a person sent in the conversation. The picture is given to you to look at; nothing is saved to your folder. Do not use it for an image file already in your folder: read that file as you read any file. It shows one picture per call; call it again for another. It refuses a picture that is not of this project or of your organisation's agents and people, a file that is not an image, and an image over 5 MB.",
|
|
1365
|
+
schema: z8.object({ image: z8.string().min(1).max(80).describe("The picture to look at, as `attachment:<id>`") }),
|
|
1366
|
+
example: { image: "attachment:att_01HZY4K2M7Q8R9S0T1U2V3W4X5" }
|
|
1367
|
+
};
|
|
1368
|
+
|
|
1352
1369
|
// src/modules/index.ts
|
|
1353
1370
|
import path11 from "node:path";
|
|
1354
1371
|
|
|
@@ -2695,36 +2712,36 @@ var ENGINE_VERSION = "1.0.0";
|
|
|
2695
2712
|
var MODEL_VERSION = "kokoro-v1.0+parakeet-tdt-0.6b-v2";
|
|
2696
2713
|
|
|
2697
2714
|
// ../../packages/voice-recipe/src/recipe.ts
|
|
2698
|
-
import { z as
|
|
2715
|
+
import { z as z9 } from "zod";
|
|
2699
2716
|
var RECIPE_VERSION = 1;
|
|
2700
2717
|
var TONES = ["natural", "warm", "bright", "radio", "phone"];
|
|
2701
2718
|
var REVERBS = ["off", "room", "hall"];
|
|
2702
2719
|
var LEVEL_MODES = ["loudness", "peak"];
|
|
2703
2720
|
var CONTENT_TYPES = { ogg: "audio/ogg", mp3: "audio/mpeg", wav: "audio/wav", m4a: "audio/mp4" };
|
|
2704
|
-
var blendPartSchema =
|
|
2705
|
-
var voiceRecipeSchema =
|
|
2706
|
-
version:
|
|
2721
|
+
var blendPartSchema = z9.object({ voice: z9.string().min(1).max(64), weight: z9.number().min(0).max(1) });
|
|
2722
|
+
var voiceRecipeSchema = z9.object({
|
|
2723
|
+
version: z9.literal(RECIPE_VERSION).default(RECIPE_VERSION),
|
|
2707
2724
|
/** TTS model id the base voice belongs to. */
|
|
2708
|
-
model:
|
|
2725
|
+
model: z9.string().min(1).max(64).default("kokoro-v1.0"),
|
|
2709
2726
|
/** Base voice id, e.g. `bf_emma`. */
|
|
2710
|
-
voice:
|
|
2727
|
+
voice: z9.string().min(1).max(64),
|
|
2711
2728
|
/**
|
|
2712
2729
|
* Up to two voices with weights. Reserved for engines that can mix style vectors; engine 1.x renders the heaviest
|
|
2713
2730
|
* voice (or `voice` when the list is empty) and reports `blend: false` in its capabilities.
|
|
2714
2731
|
*/
|
|
2715
|
-
blend:
|
|
2716
|
-
speed:
|
|
2717
|
-
pitchSemitones:
|
|
2718
|
-
tone:
|
|
2719
|
-
reverb:
|
|
2720
|
-
normalize:
|
|
2721
|
-
levelMode:
|
|
2732
|
+
blend: z9.array(blendPartSchema).max(2).default([]),
|
|
2733
|
+
speed: z9.number().min(0.5).max(2).default(1),
|
|
2734
|
+
pitchSemitones: z9.number().min(-12).max(12).default(0),
|
|
2735
|
+
tone: z9.enum(TONES).default("natural"),
|
|
2736
|
+
reverb: z9.enum(REVERBS).default("off"),
|
|
2737
|
+
normalize: z9.boolean().default(true),
|
|
2738
|
+
levelMode: z9.enum(LEVEL_MODES).default("loudness"),
|
|
2722
2739
|
/** Mono speech target; −19 LUFS mono is the −16 LUFS stereo guidance. */
|
|
2723
|
-
targetLufs:
|
|
2724
|
-
truePeakDb:
|
|
2725
|
-
gainDb:
|
|
2740
|
+
targetLufs: z9.number().min(-30).max(-10).default(-19),
|
|
2741
|
+
truePeakDb: z9.number().min(-6).max(0).default(-1),
|
|
2742
|
+
gainDb: z9.number().min(-20).max(20).default(0),
|
|
2726
2743
|
/** Pause length between sentences, as the synthesiser's silence scale. */
|
|
2727
|
-
silenceScale:
|
|
2744
|
+
silenceScale: z9.number().min(0).max(2).default(0.2)
|
|
2728
2745
|
});
|
|
2729
2746
|
var round3 = (n) => Math.round(n * 1e3) / 1e3;
|
|
2730
2747
|
function normaliseRecipe(input) {
|
|
@@ -3778,6 +3795,7 @@ var ModuleRegistry = class {
|
|
|
3778
3795
|
|
|
3779
3796
|
// src/sessions.ts
|
|
3780
3797
|
import fs13 from "node:fs";
|
|
3798
|
+
import os4 from "node:os";
|
|
3781
3799
|
import path13 from "node:path";
|
|
3782
3800
|
|
|
3783
3801
|
// src/tools.ts
|
|
@@ -3788,6 +3806,7 @@ var TOOL_TIMEOUT_MS = 3 * 6e4;
|
|
|
3788
3806
|
var STT_TOOL_TIMEOUT_MS = 11 * 6e4;
|
|
3789
3807
|
var TTS_TOOL_TIMEOUT_MS = 6 * 6e4;
|
|
3790
3808
|
var toolMcpName = (t) => `mcp__${TOOLS_SERVER}__${t.name}`;
|
|
3809
|
+
var SHOW_MAX_BYTES = 5 * 1024 * 1024;
|
|
3791
3810
|
var FIND_TOOLS = "find_tools";
|
|
3792
3811
|
var USE_TOOL = "use_tool";
|
|
3793
3812
|
var FIND_TOOLS_DESCRIPTION = "Lists the tools your organisation has given you, as they are right now: each with its name, a description of what it does and when to use it, its input schema and one example call. What you have can change while you work; a line with a message tells you when it does. Call this before using a tool you have not looked up in this conversation, when a person names a tool you do not know, or after use_tool answers with an error. With no query it returns every tool; with a query it returns the best matches.";
|
|
@@ -3803,12 +3822,19 @@ function toolCallArgs(tool2, args2) {
|
|
|
3803
3822
|
function formatToolResult(tool2, r, cwd) {
|
|
3804
3823
|
if (r.error) return { content: [{ type: "text", text: `${tool2.name} failed: ${r.error}` }], isError: true };
|
|
3805
3824
|
const lines = [r.text?.trim() || `${tool2.name} finished.`];
|
|
3825
|
+
const shown = [];
|
|
3826
|
+
const made = r.files.filter((f) => !f.show);
|
|
3806
3827
|
for (const f of r.files) {
|
|
3828
|
+
if (f.show) {
|
|
3829
|
+
if (f.bytes) shown.push({ type: "image", data: f.bytes.toString("base64"), mimeType: f.mime });
|
|
3830
|
+
else lines.push(`${f.name} (attachment:${f.attachmentId}) could not be fetched to show you.`);
|
|
3831
|
+
continue;
|
|
3832
|
+
}
|
|
3807
3833
|
const where = f.path ? cwd ? path12.relative(cwd, f.path) || f.path : f.path : "";
|
|
3808
3834
|
lines.push(where ? `Saved ${where} (attachment:${f.attachmentId})` : `Made ${f.name} (attachment:${f.attachmentId}; not saved to the folder in this scope)`);
|
|
3809
3835
|
}
|
|
3810
|
-
if (
|
|
3811
|
-
return { content: [{ type: "text", text: lines.join("\n") }] };
|
|
3836
|
+
if (made.length) lines.push(`The people in the project see ${made.every((f) => f.mime.startsWith("audio/")) ? "this audio" : "these images"} in your steps.`);
|
|
3837
|
+
return { content: [{ type: "text", text: lines.join("\n") }, ...shown] };
|
|
3812
3838
|
}
|
|
3813
3839
|
function formatUseResult(name, r, cwd) {
|
|
3814
3840
|
if (r.error) return { content: [{ type: "text", text: r.error }], isError: true };
|
|
@@ -3971,12 +3997,23 @@ var SessionManager = class {
|
|
|
3971
3997
|
const dest = uniqueFileName(dir, f.name);
|
|
3972
3998
|
fs13.renameSync(tmp, dest);
|
|
3973
3999
|
return dest;
|
|
4000
|
+
}, fetchFile = async (f, cap) => {
|
|
4001
|
+
const dir = fs13.mkdtempSync(path13.join(os4.tmpdir(), "mc-show-"));
|
|
4002
|
+
try {
|
|
4003
|
+
const tmp = await download({ id: f.attachmentId, name: f.name, mime: f.mime, size: 0, url: f.url, kind: "image" }, dir);
|
|
4004
|
+
const bytes = fs13.readFileSync(tmp);
|
|
4005
|
+
if (bytes.length > cap) throw new Error(`${f.name} is larger than ${Math.round(cap / (1024 * 1024))} MB`);
|
|
4006
|
+
return bytes;
|
|
4007
|
+
} finally {
|
|
4008
|
+
fs13.rmSync(dir, { recursive: true, force: true });
|
|
4009
|
+
}
|
|
3974
4010
|
}) {
|
|
3975
4011
|
this.emit = emit;
|
|
3976
4012
|
this.download = download;
|
|
3977
4013
|
this.policy = policy;
|
|
3978
4014
|
this.accounts = accounts;
|
|
3979
4015
|
this.saveFile = saveFile;
|
|
4016
|
+
this.fetchFile = fetchFile;
|
|
3980
4017
|
this.providerMap = typeof providers2 === "function" ? providers2 : () => providers2;
|
|
3981
4018
|
}
|
|
3982
4019
|
emit;
|
|
@@ -3984,6 +4021,7 @@ var SessionManager = class {
|
|
|
3984
4021
|
policy;
|
|
3985
4022
|
accounts;
|
|
3986
4023
|
saveFile;
|
|
4024
|
+
fetchFile;
|
|
3987
4025
|
live = /* @__PURE__ */ new Map();
|
|
3988
4026
|
/** Opens in progress. The router sends `session.open` and the first `inbound` back to back; frames are handled
|
|
3989
4027
|
* concurrently, so anything that needs the session waits for the open to finish instead of finding nothing. */
|
|
@@ -4221,6 +4259,15 @@ var SessionManager = class {
|
|
|
4221
4259
|
const save = (live.settings.scope ?? "full") === "full";
|
|
4222
4260
|
for (const f of r.files) {
|
|
4223
4261
|
const base = { name: f.name, mime: f.mime, attachmentId: f.attachmentId };
|
|
4262
|
+
if (f.show) {
|
|
4263
|
+
try {
|
|
4264
|
+
files.push({ ...base, show: true, bytes: await this.fetchFile(f, SHOW_MAX_BYTES) });
|
|
4265
|
+
} catch (e) {
|
|
4266
|
+
log("warn", `[${groupId.slice(0, 8)}] could not fetch ${f.name} to show: ${e.message}`);
|
|
4267
|
+
files.push({ ...base, show: true });
|
|
4268
|
+
}
|
|
4269
|
+
continue;
|
|
4270
|
+
}
|
|
4224
4271
|
if (!save) {
|
|
4225
4272
|
files.push(base);
|
|
4226
4273
|
continue;
|
|
@@ -4470,6 +4517,12 @@ async function downloadAttachment(att, dir, credential, routerOrigin2) {
|
|
|
4470
4517
|
fs15.writeFileSync(full, buf);
|
|
4471
4518
|
return full;
|
|
4472
4519
|
}
|
|
4520
|
+
async function fetchAttachmentBytes(url, credential, routerOrigin2, cap) {
|
|
4521
|
+
assertRouterTarget(url, routerOrigin2, "attachment");
|
|
4522
|
+
const res = await fetch(url, { headers: { Authorization: `Bearer ${credential}` }, signal: AbortSignal.timeout(6e4), redirect: "manual" });
|
|
4523
|
+
if (!res.ok) throw new Error(`download failed: ${res.status}`);
|
|
4524
|
+
return readCapped2(res, cap);
|
|
4525
|
+
}
|
|
4473
4526
|
async function uploadFile(uploadUrl, credential, routerOrigin2, input) {
|
|
4474
4527
|
assertRouterTarget(uploadUrl, routerOrigin2, "upload");
|
|
4475
4528
|
const stat = fs15.statSync(input.filePath);
|
|
@@ -4531,7 +4584,7 @@ function guessMime(name) {
|
|
|
4531
4584
|
}
|
|
4532
4585
|
|
|
4533
4586
|
// src/version.ts
|
|
4534
|
-
var APP_VERSION = true ? "1.0.
|
|
4587
|
+
var APP_VERSION = true ? "1.0.17" : fromPackage();
|
|
4535
4588
|
|
|
4536
4589
|
// src/diag.ts
|
|
4537
4590
|
var MAX_HELD = 200;
|
|
@@ -4620,7 +4673,10 @@ var HostClient = class {
|
|
|
4620
4673
|
const c = id ? registry.connection(id) : null;
|
|
4621
4674
|
if (c?.module === "claude-api") registry.ledger.addSessionCost(c.id, sessionId, total);
|
|
4622
4675
|
}
|
|
4623
|
-
}
|
|
4676
|
+
},
|
|
4677
|
+
void 0,
|
|
4678
|
+
// A file to show to the model (image_view): its bytes, with this machine's credential, saved nowhere.
|
|
4679
|
+
(f, cap) => fetchAttachmentBytes(f.url, cfg.credential ?? "", routerOrigin(cfg.routerUrl), cap)
|
|
4624
4680
|
);
|
|
4625
4681
|
}
|
|
4626
4682
|
cfg;
|
|
@@ -5110,7 +5166,7 @@ var HostClient = class {
|
|
|
5110
5166
|
}
|
|
5111
5167
|
};
|
|
5112
5168
|
function describeMachine() {
|
|
5113
|
-
return { name:
|
|
5169
|
+
return { name: os5.hostname(), platform: process.platform, arch: process.arch, appVersion: APP_VERSION, nodeVersion: process.version };
|
|
5114
5170
|
}
|
|
5115
5171
|
|
|
5116
5172
|
// src/modules/commands.ts
|
|
@@ -5233,14 +5289,14 @@ function fail(message) {
|
|
|
5233
5289
|
}
|
|
5234
5290
|
|
|
5235
5291
|
// src/enrol.ts
|
|
5236
|
-
import { z as
|
|
5237
|
-
var EnrolResponse =
|
|
5238
|
-
var EnrolPreview =
|
|
5239
|
-
space:
|
|
5292
|
+
import { z as z10 } from "zod";
|
|
5293
|
+
var EnrolResponse = z10.object({ hostId: z10.string(), credential: z10.string(), hostName: z10.string(), routerUrl: z10.string().optional(), spaceId: z10.string().optional(), spaceHandle: z10.string().optional(), spaceName: z10.string().optional() });
|
|
5294
|
+
var EnrolPreview = z10.object({
|
|
5295
|
+
space: z10.object({ id: z10.string(), handle: z10.string(), name: z10.string() }),
|
|
5240
5296
|
/** The token re-enrols an existing machine (after a reset) rather than making a new one. */
|
|
5241
|
-
reenrol:
|
|
5297
|
+
reenrol: z10.boolean(),
|
|
5242
5298
|
/** Of the host ids we sent, the ones already enrolled in the token's space. */
|
|
5243
|
-
sameSpaceHostIds:
|
|
5299
|
+
sameSpaceHostIds: z10.array(z10.string())
|
|
5244
5300
|
});
|
|
5245
5301
|
async function previewToken(routerUrl, token, hostIds, insecure) {
|
|
5246
5302
|
const base = routerUrl.replace(/\/+$/, "");
|
|
@@ -5320,7 +5376,7 @@ async function enrol(token, routerUrl, opts) {
|
|
|
5320
5376
|
// src/connect.ts
|
|
5321
5377
|
import { execFile as execFile5, spawn as spawn4 } from "node:child_process";
|
|
5322
5378
|
import fs18 from "node:fs";
|
|
5323
|
-
import
|
|
5379
|
+
import os6 from "node:os";
|
|
5324
5380
|
import path18 from "node:path";
|
|
5325
5381
|
import { promisify as promisify5 } from "node:util";
|
|
5326
5382
|
|
|
@@ -5328,7 +5384,7 @@ import { promisify as promisify5 } from "node:util";
|
|
|
5328
5384
|
import { spawn as spawn3 } from "node:child_process";
|
|
5329
5385
|
import fs17 from "node:fs";
|
|
5330
5386
|
import path17 from "node:path";
|
|
5331
|
-
import { z as
|
|
5387
|
+
import { z as z11 } from "zod";
|
|
5332
5388
|
var PACKAGE = "@monoclaw/machine";
|
|
5333
5389
|
function nodeInstallHint(platform) {
|
|
5334
5390
|
if (platform === "darwin") return "Install Node 22 or newer: `brew install node`, or the LTS installer from https://nodejs.org";
|
|
@@ -5345,7 +5401,7 @@ function updateWait(busy2, background, since, now) {
|
|
|
5345
5401
|
return now - from < BACKGROUND_WAIT_MS ? { wait: true, why: "background", since: from } : { wait: false, why: null, since: null };
|
|
5346
5402
|
}
|
|
5347
5403
|
var INSTALL_TIMEOUT_MS = 5 * 6e4;
|
|
5348
|
-
var VersionPolicy =
|
|
5404
|
+
var VersionPolicy = z11.object({ package: z11.string(), latest: z11.string().nullable(), minimum: z11.string().nullable() });
|
|
5349
5405
|
function detectInstallMode(entry = process.argv[1] ?? "") {
|
|
5350
5406
|
let real = entry;
|
|
5351
5407
|
try {
|
|
@@ -5573,7 +5629,7 @@ function globalInstall(prefix, platform = process.platform) {
|
|
|
5573
5629
|
const modules2 = platform === "win32" ? p.join(prefix, "node_modules") : p.join(prefix, "lib", "node_modules");
|
|
5574
5630
|
return { script: p.join(modules2, "@monoclaw", "machine", "bin", "monoclaw.js"), binDir: platform === "win32" ? prefix : p.join(prefix, "bin") };
|
|
5575
5631
|
}
|
|
5576
|
-
function enrolArgs(o, hasEnrolment, home =
|
|
5632
|
+
function enrolArgs(o, hasEnrolment, home = os6.homedir()) {
|
|
5577
5633
|
const args2 = [...o.profile ? ["--profile", o.profile] : [], "enrol", o.token, "--router", o.router];
|
|
5578
5634
|
const roots2 = o.root?.length ? o.root : hasEnrolment ? [] : [path18.join(home, "command")];
|
|
5579
5635
|
if (roots2.length) args2.push("--root", ...roots2);
|
|
@@ -5785,7 +5841,7 @@ ${r.text}`, final: true });
|
|
|
5785
5841
|
const callId = `tu-${newId().slice(0, 8)}`;
|
|
5786
5842
|
this.q.push({ kind: "tool", id: callId, name: `mcp__monoclaw-tools__${name.trim()}`, summary: prompt, input: JSON.stringify({ prompt }) });
|
|
5787
5843
|
const r = await reply();
|
|
5788
|
-
const out = r.content.map((c) => c.text).join("\n");
|
|
5844
|
+
const out = r.content.map((c) => c.type === "text" ? c.text : `[image ${c.mimeType}, ${c.data.length} base64 characters]`).join("\n");
|
|
5789
5845
|
this.q.push({ kind: "tool_result", id: callId, name: `mcp__monoclaw-tools__${name.trim()}`, output: out, isError: !!r.isError });
|
|
5790
5846
|
this.q.push({ kind: "text", text: out, final: true });
|
|
5791
5847
|
this.q.push({ kind: "done", interrupted: false });
|
|
@@ -5794,7 +5850,7 @@ ${r.text}`, final: true });
|
|
|
5794
5850
|
if (text2.startsWith("find:") || text2.startsWith("use:")) {
|
|
5795
5851
|
const rest = text2.slice(text2.indexOf(":") + 1);
|
|
5796
5852
|
const r = text2.startsWith("find:") ? await this.tools.find({ query: rest.trim() || void 0 }) : await this.tools.use({ name: rest.split(":")[0], input: rest.split(":").slice(1).join(":") });
|
|
5797
|
-
this.q.push({ kind: "text", text: r.content.map((c) => c.text).join("\n"), final: true });
|
|
5853
|
+
this.q.push({ kind: "text", text: r.content.map((c) => c.type === "text" ? c.text : `[image ${c.mimeType}, ${c.data.length} base64 characters]`).join("\n"), final: true });
|
|
5798
5854
|
this.q.push({ kind: "done", interrupted: false });
|
|
5799
5855
|
return;
|
|
5800
5856
|
}
|
|
@@ -5913,10 +5969,10 @@ var echoProvider = {
|
|
|
5913
5969
|
// src/providers/claude/index.ts
|
|
5914
5970
|
import { execFile as execFile7 } from "node:child_process";
|
|
5915
5971
|
import fs20 from "node:fs";
|
|
5916
|
-
import
|
|
5972
|
+
import os7 from "node:os";
|
|
5917
5973
|
import path20 from "node:path";
|
|
5918
5974
|
import { promisify as promisify7 } from "node:util";
|
|
5919
|
-
import { z as
|
|
5975
|
+
import { z as z12 } from "zod";
|
|
5920
5976
|
import { createSdkMcpServer, listSessions, query, tool } from "@anthropic-ai/claude-agent-sdk";
|
|
5921
5977
|
|
|
5922
5978
|
// src/providers/claude/cli.ts
|
|
@@ -6256,7 +6312,7 @@ var ClaudeSession = class {
|
|
|
6256
6312
|
tool(
|
|
6257
6313
|
"send_file",
|
|
6258
6314
|
"Send a file from the working folder to the user in the chat. Use for screenshots, exports, documents, audio. Paths are relative to the working folder; files outside it, or inside dot-folders, cannot be sent.",
|
|
6259
|
-
{ path:
|
|
6315
|
+
{ path: z12.string().describe("Path of the file to send, inside the working folder"), caption: z12.string().optional().describe("Short caption shown with the file") },
|
|
6260
6316
|
async (args2) => {
|
|
6261
6317
|
const full = sendablePath(this.opts.cwd, args2.path);
|
|
6262
6318
|
if (!full) return { content: [{ type: "text", text: `Only files inside the working folder (${this.opts.cwd}), outside dot-folders, can be sent.` }], isError: true };
|
|
@@ -6292,7 +6348,7 @@ var ClaudeSession = class {
|
|
|
6292
6348
|
tool(
|
|
6293
6349
|
"send",
|
|
6294
6350
|
SEND_TOOL_DESCRIPTION,
|
|
6295
|
-
{ to:
|
|
6351
|
+
{ to: z12.string().min(1).describe("One agent's name from list_agents"), text: z12.string().describe("The message") },
|
|
6296
6352
|
async (args2) => {
|
|
6297
6353
|
const id = newId();
|
|
6298
6354
|
const result = new Promise((resolve) => {
|
|
@@ -6312,11 +6368,11 @@ var ClaudeSession = class {
|
|
|
6312
6368
|
}
|
|
6313
6369
|
if (s.toolDoors)
|
|
6314
6370
|
tools.push(
|
|
6315
|
-
tool(FIND_TOOLS, FIND_TOOLS_DESCRIPTION, { query:
|
|
6371
|
+
tool(FIND_TOOLS, FIND_TOOLS_DESCRIPTION, { query: z12.string().max(500).optional().describe("Keywords to search names and descriptions, or `select:name1,name2` for exact names. Leave out to list every tool."), limit: z12.number().int().min(1).max(50).optional().describe("The most matches to return for a keyword query (default 5).") }, async (args2) => this.tools.find(args2), { alwaysLoad: true }),
|
|
6316
6372
|
tool(
|
|
6317
6373
|
USE_TOOL,
|
|
6318
6374
|
USE_TOOL_DESCRIPTION,
|
|
6319
|
-
{ name:
|
|
6375
|
+
{ name: z12.string().min(1).max(64).describe("The tool's name, exactly as find_tools gave it"), input: z12.record(z12.string(), z12.unknown()).describe("The tool's input: an object matching the tool's input_schema from find_tools") },
|
|
6320
6376
|
async (args2) => this.tools.use(args2),
|
|
6321
6377
|
{ alwaysLoad: true }
|
|
6322
6378
|
)
|
|
@@ -6634,7 +6690,7 @@ function friendlyPath(p, cwd) {
|
|
|
6634
6690
|
if (file === base) return ".";
|
|
6635
6691
|
if (file.startsWith(`${base}/`)) return file.slice(base.length + 1);
|
|
6636
6692
|
}
|
|
6637
|
-
const home = norm(
|
|
6693
|
+
const home = norm(os7.homedir());
|
|
6638
6694
|
if (home && file.startsWith(`${home}/`)) return `~/${file.slice(home.length + 1)}`;
|
|
6639
6695
|
return file;
|
|
6640
6696
|
}
|
|
@@ -6855,7 +6911,7 @@ var providers = only.length ? Object.fromEntries(Object.entries(all).filter(([id
|
|
|
6855
6911
|
// src/service.ts
|
|
6856
6912
|
import { spawnSync } from "node:child_process";
|
|
6857
6913
|
import fs21 from "node:fs";
|
|
6858
|
-
import
|
|
6914
|
+
import os8 from "node:os";
|
|
6859
6915
|
import path21 from "node:path";
|
|
6860
6916
|
function serviceNames(profile = currentProfile()) {
|
|
6861
6917
|
return { unit: profile ? `monoclaw-${profile}` : "monoclaw", label: profile ? `ai.monoclaw.host.${profile}` : "ai.monoclaw.host", task: profile ? `MonoClaw host (${profile})` : "MonoClaw host" };
|
|
@@ -6878,7 +6934,7 @@ function servicePath(node) {
|
|
|
6878
6934
|
}
|
|
6879
6935
|
function serviceInstructions() {
|
|
6880
6936
|
const dir = configDir();
|
|
6881
|
-
const home =
|
|
6937
|
+
const home = os8.homedir();
|
|
6882
6938
|
const { node, script } = selfCommand();
|
|
6883
6939
|
const logs = path21.join(dir, "logs");
|
|
6884
6940
|
fs21.mkdirSync(logs, { recursive: true });
|
|
@@ -6953,7 +7009,7 @@ var runSync = (cmd2, args2) => {
|
|
|
6953
7009
|
};
|
|
6954
7010
|
function installService(run3 = runSync) {
|
|
6955
7011
|
const r = serviceInstructions();
|
|
6956
|
-
const home =
|
|
7012
|
+
const home = os8.homedir();
|
|
6957
7013
|
const must = (cmd2, args2) => {
|
|
6958
7014
|
const x = run3(cmd2, args2);
|
|
6959
7015
|
if (x.status !== 0) throw new Error(`${cmd2} ${args2.join(" ")} failed: ${x.stderr.trim() || `exit ${x.status}`}`);
|
|
@@ -6981,7 +7037,7 @@ function installService(run3 = runSync) {
|
|
|
6981
7037
|
return { file: r.file, target: `Task Scheduler: ${names.task}`, notes: [`Check: Get-ScheduledTask -TaskName "${names.task}"`] };
|
|
6982
7038
|
}
|
|
6983
7039
|
function uninstallService(run3 = runSync) {
|
|
6984
|
-
const home =
|
|
7040
|
+
const home = os8.homedir();
|
|
6985
7041
|
const names = serviceNames();
|
|
6986
7042
|
if (process.platform === "darwin") {
|
|
6987
7043
|
const target = path21.join(home, "Library", "LaunchAgents", `${names.label}.plist`);
|
|
@@ -7001,7 +7057,7 @@ function uninstallService(run3 = runSync) {
|
|
|
7001
7057
|
}
|
|
7002
7058
|
function lingerEnabled() {
|
|
7003
7059
|
if (process.platform !== "linux") return null;
|
|
7004
|
-
const r = spawnSync("loginctl", ["show-user",
|
|
7060
|
+
const r = spawnSync("loginctl", ["show-user", os8.userInfo().username, "--property=Linger", "--value"], { encoding: "utf8" });
|
|
7005
7061
|
if (r.status !== 0) return null;
|
|
7006
7062
|
const v = String(r.stdout ?? "").trim();
|
|
7007
7063
|
return v === "yes" ? true : v === "no" ? false : null;
|
|
@@ -7010,7 +7066,7 @@ var LINGER_FIX = "loginctl enable-linger $USER";
|
|
|
7010
7066
|
function lingerNote(run3) {
|
|
7011
7067
|
const on = lingerEnabled();
|
|
7012
7068
|
if (on !== false) return null;
|
|
7013
|
-
const r = run3("loginctl", ["enable-linger",
|
|
7069
|
+
const r = run3("loginctl", ["enable-linger", os8.userInfo().username]);
|
|
7014
7070
|
if (r.status === 0 && lingerEnabled() === true) return "Set to keep running when you log out (linger is on for your user).";
|
|
7015
7071
|
return `IMPORTANT: this machine will go offline when you log out of this computer. To keep it running, run: ${LINGER_FIX} (it may ask for your password, or need sudo)`;
|
|
7016
7072
|
}
|
|
@@ -7024,7 +7080,7 @@ function startedByHand(foreground, env, isTTY) {
|
|
|
7024
7080
|
|
|
7025
7081
|
// src/cli.ts
|
|
7026
7082
|
import { spawn as spawn5 } from "node:child_process";
|
|
7027
|
-
import
|
|
7083
|
+
import os9 from "node:os";
|
|
7028
7084
|
async function readTokenFromStdin() {
|
|
7029
7085
|
let data = "";
|
|
7030
7086
|
for await (const chunk of process.stdin) data += chunk;
|
|
@@ -7066,7 +7122,7 @@ program.command("enrol [token]").description("Connect this machine to your MonoC
|
|
|
7066
7122
|
}
|
|
7067
7123
|
const profiles = listProfiles();
|
|
7068
7124
|
const preview = await previewToken(opts.router, token, profiles.map((p) => p.config?.hostId ?? "").filter(Boolean), opts.insecure);
|
|
7069
|
-
const plan = planEnrol(preview, profiles, opts.router, { requestedProfile: currentProfile(), defaultName:
|
|
7125
|
+
const plan = planEnrol(preview, profiles, opts.router, { requestedProfile: currentProfile(), defaultName: os9.hostname() });
|
|
7070
7126
|
const report = (profile) => {
|
|
7071
7127
|
if (process.env.MONOCLAW_CONNECT) fs22.writeFileSync(connectResultPath(), JSON.stringify({ profile, at: (/* @__PURE__ */ new Date()).toISOString() }), { mode: 384 });
|
|
7072
7128
|
};
|
|
@@ -7383,7 +7439,7 @@ program.command("doctor").description("Check and repair what a working host need
|
|
|
7383
7439
|
if (exposing.length) lines.push({ ok: false, what: `${exposing.join(", ")} contains this host's config folder, so it is not offered to agents`, fix: `monoclaw roots remove ${exposing[0]}, then monoclaw roots add <a folder inside it>` });
|
|
7384
7440
|
lines.push({ ok: cfg.roots.length > 0 && !missing.length, what: cfg.roots.length ? `Exposed folders: ${cfg.roots.join(", ")}${missing.length ? ` (missing: ${missing.join(", ")})` : ""}` : "No folders exposed", fix: !cfg.roots.length ? "monoclaw roots add ~/command" : missing.length ? "Create them, or remove them with `monoclaw roots remove <path>`" : void 0 });
|
|
7385
7441
|
const names = serviceNames();
|
|
7386
|
-
const unit = process.platform === "darwin" ? path22.join(
|
|
7442
|
+
const unit = process.platform === "darwin" ? path22.join(os9.homedir(), "Library", "LaunchAgents", `${names.label}.plist`) : process.platform === "linux" ? path22.join(os9.homedir(), ".config", "systemd", "user", `${names.unit}.service`) : null;
|
|
7387
7443
|
if (unit) lines.push({ ok: fs22.existsSync(unit), info: true, what: fs22.existsSync(unit) ? `Background service installed (${unit})` : "Not running as a background service (fine for now)", fix: fs22.existsSync(unit) ? void 0 : `${cmd("service install")} to run at login` });
|
|
7388
7444
|
if (unit && fs22.existsSync(unit) && lingerEnabled() === false) lines.push({ ok: false, what: "This machine goes offline when you log out of this computer (linger is off for your user)", fix: LINGER_FIX });
|
|
7389
7445
|
const { registry } = await makeContext(cfg);
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@monoclaw/machine",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.17",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@monoclaw/machine",
|
|
9
|
-
"version": "1.0.
|
|
9
|
+
"version": "1.0.17",
|
|
10
10
|
"license": "UNLICENSED",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@anthropic-ai/claude-agent-sdk": "0.3.302",
|
package/package.json
CHANGED