@monoclaw/machine 1.0.14 → 1.0.16
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 +123 -48
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -808,7 +808,8 @@ var JobInput = z2.discriminatedUnion("capability", [
|
|
|
808
808
|
z2.object({ capability: z2.literal("tts"), text: z2.string().min(1).max(2e4) }),
|
|
809
809
|
/** The host downloads the audio from the signed URL. */
|
|
810
810
|
z2.object({ capability: z2.literal("stt"), url: z2.string(), mime: z2.string() }),
|
|
811
|
-
|
|
811
|
+
/** `reference` (hosts from 1.0.15): one image to make the new one from or in the style of; the host downloads it from the signed URL. */
|
|
812
|
+
z2.object({ capability: z2.literal("image"), prompt: z2.string().min(1).max(1e4), args: z2.record(z2.string(), z2.union([z2.string(), z2.number(), z2.boolean()])).default({}), reference: z2.object({ url: z2.string(), mime: z2.string() }).optional() })
|
|
812
813
|
]);
|
|
813
814
|
var JobOutput = z2.object({ uploadId: z2.string(), mime: z2.string(), name: z2.string().optional(), durationMs: z2.number().int().nonnegative().optional(), width: z2.number().int().positive().optional(), height: z2.number().int().positive().optional() });
|
|
814
815
|
var SessionTool = z2.object({
|
|
@@ -1271,9 +1272,12 @@ var isVersion = (v) => parseVersion(v) !== null;
|
|
|
1271
1272
|
import { z as z5 } from "zod";
|
|
1272
1273
|
var TTS_TOOL_MAX_CHARS = 9e3;
|
|
1273
1274
|
function toolShape(params, capability = "image") {
|
|
1274
|
-
const shape = capability === "stt" ? { file: z5.string().min(1).max(4096).describe("The audio or video file to transcribe: a path relative to your folder, or absolute, or `attachment:<id>` for a file of this conversation (one a tool made, or one a person sent). At most 20 MB.") } : capability === "tts" ? { text: z5.string().min(1).max(TTS_TOOL_MAX_CHARS).describe(`The text to speak, as it should be said (no Markdown). Up to ${TTS_TOOL_MAX_CHARS} characters, about ten minutes; send longer texts in parts.`) } : {
|
|
1275
|
+
const shape = capability === "stt" ? { file: z5.string().min(1).max(4096).describe("The audio or video file to transcribe: a path relative to your folder, or absolute, or `attachment:<id>` for a file of this conversation (one a tool made, or one a person sent). At most 20 MB.") } : capability === "tts" ? { text: z5.string().min(1).max(TTS_TOOL_MAX_CHARS).describe(`The text to speak, as it should be said (no Markdown). Up to ${TTS_TOOL_MAX_CHARS} characters, about ten minutes; send longer texts in parts.`) } : {
|
|
1276
|
+
prompt: z5.string().min(1).max(1e4).describe("What to make, described in detail"),
|
|
1277
|
+
reference_image: z5.string().min(1).max(4096).optional().describe("One image to work from: make the new image in its style, or of the same subject, as the prompt says. `attachment:<id>` (an image a tool made, one a person sent, or an agent's picture from agents_read_profile) or a path to an image file of yours. Say in the prompt how to use it (for example \"in the painting style of the reference image, a different person\"). Leave out to make an image from the prompt alone. Not every image tool's model can take one: the error says so.")
|
|
1278
|
+
};
|
|
1275
1279
|
for (const p of params) {
|
|
1276
|
-
if (p.key === "prompt" || p.key === "file" || p.key === "text") continue;
|
|
1280
|
+
if (p.key === "prompt" || p.key === "file" || p.key === "text" || p.key === "reference_image") continue;
|
|
1277
1281
|
let t;
|
|
1278
1282
|
if (p.type === "select" && p.choices?.length) t = z5.enum(p.choices.map((c) => c.value));
|
|
1279
1283
|
else if (p.type === "number") {
|
|
@@ -1283,7 +1287,7 @@ function toolShape(params, capability = "image") {
|
|
|
1283
1287
|
t = n;
|
|
1284
1288
|
} else if (p.type === "boolean") t = z5.boolean();
|
|
1285
1289
|
else t = z5.string().max(2e3);
|
|
1286
|
-
const choices = p.type === "select" && p.choices?.length ? `One of: ${p.choices.map((c) => `${c.value} (${c.label})`).join(", ")}` : "";
|
|
1290
|
+
const choices = p.type === "select" && p.choices?.length ? `One of: ${p.choices.map((c) => `${c.value} (${c.label}${c.description ? `: ${c.description}` : ""})`).join(", ")}` : "";
|
|
1287
1291
|
const range = p.type === "number" && (p.min !== void 0 || p.max !== void 0) ? `From ${p.min ?? "any"} to ${p.max ?? "any"}` : "";
|
|
1288
1292
|
const dflt = p.default !== void 0 ? `Default ${String(p.default)}` : "";
|
|
1289
1293
|
t = t.optional().describe([p.label, p.help, choices, range, dflt].filter(Boolean).join(". "));
|
|
@@ -1295,6 +1299,56 @@ function toolShape(params, capability = "image") {
|
|
|
1295
1299
|
// ../../packages/protocol/src/tool-registry.ts
|
|
1296
1300
|
import { z as z6 } from "zod";
|
|
1297
1301
|
|
|
1302
|
+
// ../../packages/protocol/src/recruiting-tools.ts
|
|
1303
|
+
import { z as z7 } from "zod";
|
|
1304
|
+
var PROFILE = {
|
|
1305
|
+
name: z7.string().min(1).max(40).describe("The agent's name, as people and other agents will call it. Unique in the project."),
|
|
1306
|
+
role: z7.string().max(80).describe("What it does, in a few words (its job title)."),
|
|
1307
|
+
pronouns: z7.string().max(40).describe("Its pronouns, such as she/her, he/him or they/them. Shown next to its name."),
|
|
1308
|
+
description: z7.string().max(500).describe("Its business card: when to ask it and what it is good at. People and other agents read this."),
|
|
1309
|
+
persona: z7.string().max(1500).describe("How it comes across: character, tone, manner of speaking. Everyone in the project can read it. It never changes what the agent does or may do."),
|
|
1310
|
+
brief: z7.string().max(4e3).describe("Its standing instructions, private to it: what to focus on, how to work, what to avoid. Write it as how this agent operates."),
|
|
1311
|
+
picture: z7.string().max(80).describe("Its picture: `attachment:<id>` of an image in this conversation (one an image tool made, or one a person sent).")
|
|
1312
|
+
};
|
|
1313
|
+
var AGENTS_OPTIONS = {
|
|
1314
|
+
name: "agents_options",
|
|
1315
|
+
description: "Shows what a new agent in this project can be placed on: the organisation's machines (each with whether it is online, the providers on it that can run an agent, the folders it allows and this project's usual folder there) and the project's agents (for `feeds_into`). Call it before agents_propose_new, and whenever a person asks where an agent could run. It changes nothing. Never guess a machine, a provider or a folder: use what this returns, or ask the person.",
|
|
1316
|
+
schema: z7.object({}),
|
|
1317
|
+
example: {}
|
|
1318
|
+
};
|
|
1319
|
+
var AGENTS_READ_PROFILE = {
|
|
1320
|
+
name: "agents_read_profile",
|
|
1321
|
+
description: "Reads the full profile of one agent of this project, yourself included: name, role, pronouns, description, persona, brief, its picture (as `attachment:<id>`, which an image tool takes as a reference image to make another in the same style), where it runs and what it feeds into. Use it before proposing a change to an agent, so you change what is there and keep the rest. The brief is private to that agent and its owners: use it for the work, and do not paste it into the chat unless an owner asks to see it.",
|
|
1322
|
+
schema: z7.object({ agent_name: z7.string().min(1).max(40).describe("The agent's name, as agents_options or list_agents gives it") }),
|
|
1323
|
+
example: { agent_name: "Remus" }
|
|
1324
|
+
};
|
|
1325
|
+
var AGENTS_PROPOSE_NEW = {
|
|
1326
|
+
name: "agents_propose_new",
|
|
1327
|
+
description: "Proposes a new agent for this project, once the person has said to go ahead. It does not create the agent: an owner sees a card with the candidate and where it will run, and approves or dismisses it; you are told which. If something needed is missing or wrong, the answer says exactly what, with what to choose from: ask the person, then call this again with everything. Proposing the same name again replaces your earlier proposal, so settle the details in conversation first and propose when asked. Until you are told it was approved, never say the agent exists.",
|
|
1328
|
+
schema: z7.object({
|
|
1329
|
+
name: PROFILE.name,
|
|
1330
|
+
role: PROFILE.role.optional(),
|
|
1331
|
+
pronouns: PROFILE.pronouns.optional(),
|
|
1332
|
+
description: PROFILE.description.optional(),
|
|
1333
|
+
persona: PROFILE.persona.optional(),
|
|
1334
|
+
brief: PROFILE.brief.optional(),
|
|
1335
|
+
picture: PROFILE.picture.optional(),
|
|
1336
|
+
machine: z7.string().max(80).optional().describe("The machine it runs on, by name, from agents_options. Leave out if the person has not chosen: the answer will list the choices."),
|
|
1337
|
+
provider: z7.string().max(80).optional().describe("The provider on that machine, by name, from agents_options. Not needed when the machine has only one."),
|
|
1338
|
+
folder: z7.string().max(1024).optional().describe("The folder it works in on that machine. Leave out to use the project's usual folder there."),
|
|
1339
|
+
model: z7.string().max(80).optional().describe("A model, only if the person asked for a particular one. Leave out for the provider's default."),
|
|
1340
|
+
feeds_into: z7.string().max(40).optional().describe("An agent of this project it hands its work to, by name. Leave out for nobody.")
|
|
1341
|
+
}),
|
|
1342
|
+
example: { name: "Mara", role: "QA lead", pronouns: "she/her", description: "Ask me to test a change before it ships, and to chase a flaky test.", persona: "Dry, exact, quietly relentless.", brief: "You test every change against the plan's verification section before it is called done. Report what failed with the output, never a summary.", machine: "gpc2", feeds_into: "Romulus" }
|
|
1343
|
+
};
|
|
1344
|
+
var CHANGES = z7.object({ name: PROFILE.name.optional(), role: PROFILE.role.optional(), pronouns: PROFILE.pronouns.optional(), description: PROFILE.description.optional(), persona: PROFILE.persona.optional(), brief: PROFILE.brief.optional(), picture: PROFILE.picture.optional() }).describe("Only the fields to change, each with its whole new value. Anything left out stays as it is.");
|
|
1345
|
+
var AGENTS_PROPOSE_CHANGE = {
|
|
1346
|
+
name: "agents_propose_change",
|
|
1347
|
+
description: "Proposes a change to the profile of an agent of this project (its name, role, pronouns, description, persona, brief or picture), when a person has asked for it. It does not change the agent: an owner sees a card with what would change, before and after, and approves or dismisses it; you are told which. Read the agent's profile first (agents_read_profile) and send each changed field whole. It cannot change where an agent runs, its model, its access or its tools: an owner does that on the agent's card.",
|
|
1348
|
+
schema: z7.object({ agent_name: z7.string().min(1).max(40).describe("The agent to change, by name"), changes: CHANGES }),
|
|
1349
|
+
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
|
+
};
|
|
1351
|
+
|
|
1298
1352
|
// src/modules/index.ts
|
|
1299
1353
|
import path11 from "node:path";
|
|
1300
1354
|
|
|
@@ -1441,7 +1495,7 @@ var echoModule = {
|
|
|
1441
1495
|
if (job.capability === "stt") return { files: [], text: `echo heard ${job.audio.length} bytes of ${job.mime}`, language: "en", usage: { amount: 1, unit: "seconds" } };
|
|
1442
1496
|
const o = resolveOptions(IMAGE_FIELDS, job.options, job.args);
|
|
1443
1497
|
const n = Math.max(1, Math.min(4, Math.round(num(o.num_images, 1))));
|
|
1444
|
-
return { files: Array.from({ length: n }, (_, i) => ({ bytes: PIXEL, mime: "image/png", name: `echo-${str(o.image_size, "square")}-${i + 1}.png`, width: 1, height: 1 })), usage: { amount: n, unit: "images", costUsd: 0 } };
|
|
1498
|
+
return { files: Array.from({ length: n }, (_, i) => ({ bytes: PIXEL, mime: "image/png", name: `echo-${str(o.image_size, "square")}${job.reference ? `-from-${job.reference.bytes.length}b` : ""}-${i + 1}.png`, width: 1, height: 1 })), usage: { amount: n, unit: "images", costUsd: 0 } };
|
|
1445
1499
|
}
|
|
1446
1500
|
};
|
|
1447
1501
|
|
|
@@ -1656,12 +1710,14 @@ function elevenlabsModule(deps = {}) {
|
|
|
1656
1710
|
var FAL_RUN = "https://fal.run";
|
|
1657
1711
|
var FAL_API = "https://api.fal.ai";
|
|
1658
1712
|
var MAX_IMAGE = 25 * 1024 * 1024;
|
|
1713
|
+
var MAX_REFERENCE = 8 * 1024 * 1024;
|
|
1714
|
+
var REFERENCE_NOTE = " Takes a reference image.";
|
|
1659
1715
|
var FAL_MODELS = [
|
|
1660
1716
|
{ id: "fal-ai/flux/schnell", label: "FLUX.1 [schnell]", description: "Fast and cheap (about $0.003 a megapixel).", size: "image_size", maxImages: 4, safety: "checker", pricePerMp: 3e-3, steps: 4 },
|
|
1661
1717
|
{ id: "fal-ai/flux/dev", label: "FLUX.1 [dev]", description: "Better detail (about $0.025 a megapixel).", size: "image_size", maxImages: 4, safety: "checker", pricePerMp: 0.025, steps: 28 },
|
|
1662
1718
|
{ id: "fal-ai/flux-pro/v1.1-ultra", label: "FLUX 1.1 [pro] Ultra", description: "Up to 4 MP, photographic (about $0.06 an image).", size: "aspect_ratio", maxImages: 4, safety: "checker", pricePerImage: 0.06 },
|
|
1663
|
-
{ id: "fal-ai/flux-2-pro", label: "FLUX.2 [pro]", description:
|
|
1664
|
-
{ id: "fal-ai/flux-2/flash", label: "FLUX.2 [flash]", description:
|
|
1719
|
+
{ id: "fal-ai/flux-2-pro", label: "FLUX.2 [pro]", description: `The newest FLUX, best quality (about $0.03 a megapixel).${REFERENCE_NOTE}`, size: "image_size", maxImages: 1, safety: "tolerance", pricePerMp: 0.03, edit: { id: "fal-ai/flux-2-pro/edit", many: false, perMp: 0.03 } },
|
|
1720
|
+
{ id: "fal-ai/flux-2/flash", label: "FLUX.2 [flash]", description: `The newest FLUX, fast (about $0.005 a megapixel).${REFERENCE_NOTE}`, size: "image_size", maxImages: 4, safety: "checker", pricePerMp: 5e-3, edit: { id: "fal-ai/flux-2/flash/edit", many: true, perMp: 5e-3 } }
|
|
1665
1721
|
];
|
|
1666
1722
|
var IMAGE_SIZES = {
|
|
1667
1723
|
square_hd: { label: "Square HD (1024\xD71024)", aspect: "1:1", mp: 1.05 },
|
|
@@ -1672,11 +1728,11 @@ var IMAGE_SIZES = {
|
|
|
1672
1728
|
landscape_16_9: { label: "Landscape 16:9", aspect: "16:9", mp: 0.59 }
|
|
1673
1729
|
};
|
|
1674
1730
|
var FAL_FIELDS = [
|
|
1675
|
-
{ key: "model", label: "Model", type: "select", choices: FAL_MODELS.map((m) => ({ value: m.id, label: m.label, description: m.description })), default: "fal-ai/flux/schnell", required: true },
|
|
1731
|
+
{ key: "model", label: "Model", type: "select", choices: FAL_MODELS.map((m) => ({ value: m.id, label: m.label, description: m.description })), default: "fal-ai/flux/schnell", required: true, agentSettable: true },
|
|
1676
1732
|
{ key: "image_size", label: "Size", type: "select", choices: Object.entries(IMAGE_SIZES).map(([value, s]) => ({ value, label: s.label })), default: "landscape_4_3", required: false, agentSettable: true },
|
|
1677
|
-
{ key: "num_images", label: "Images per call", type: "number", min: 1, max: 4, step: 1, default: 1, required: false },
|
|
1678
|
-
{ key: "output_format", label: "Format", type: "select", choices: [{ value: "jpeg", label: "JPEG" }, { value: "png", label: "PNG" }], default: "jpeg", required: false },
|
|
1679
|
-
{ key: "enable_safety_checker", label: "Safety checker", type: "boolean", default: true, required: false }
|
|
1733
|
+
{ key: "num_images", label: "Images per call", type: "number", min: 1, max: 4, step: 1, default: 1, required: false, agentSettable: true },
|
|
1734
|
+
{ key: "output_format", label: "Format", type: "select", choices: [{ value: "jpeg", label: "JPEG" }, { value: "png", label: "PNG" }], default: "jpeg", required: false, agentSettable: true },
|
|
1735
|
+
{ key: "enable_safety_checker", label: "Safety checker", type: "boolean", default: true, required: false, agentSettable: true }
|
|
1680
1736
|
];
|
|
1681
1737
|
function falInput(model, prompt, o) {
|
|
1682
1738
|
const size = str(o.image_size, "landscape_4_3");
|
|
@@ -1693,6 +1749,14 @@ function falInput(model, prompt, o) {
|
|
|
1693
1749
|
if (model.steps) body.num_inference_steps = model.steps;
|
|
1694
1750
|
return body;
|
|
1695
1751
|
}
|
|
1752
|
+
function falEditInput(model, prompt, o, reference) {
|
|
1753
|
+
const body = falInput(model, prompt, o);
|
|
1754
|
+
if (!model.edit.many) delete body.num_images;
|
|
1755
|
+
delete body.num_inference_steps;
|
|
1756
|
+
body.image_urls = [`data:${reference.mime};base64,${reference.bytes.toString("base64")}`];
|
|
1757
|
+
return body;
|
|
1758
|
+
}
|
|
1759
|
+
var referenceModels = () => FAL_MODELS.filter((m) => m.edit).map((m) => m.label);
|
|
1696
1760
|
function falEstimateUsd(model, o) {
|
|
1697
1761
|
const n = model.maxImages > 1 ? Math.max(1, Math.min(model.maxImages, Math.round(num(o.num_images, 1)))) : 1;
|
|
1698
1762
|
if (model.pricePerImage) return model.pricePerImage * n;
|
|
@@ -1759,12 +1823,17 @@ function falModule(deps = {}) {
|
|
|
1759
1823
|
if (!secret) throw new Error("This connection has no key yet. Enter it on the machine (`monoclaw modules key <id>`) or from the app.");
|
|
1760
1824
|
const o = resolved(job);
|
|
1761
1825
|
const model = modelOf(o);
|
|
1762
|
-
const
|
|
1826
|
+
const ref = job.reference;
|
|
1827
|
+
if (ref && !model.edit) throw new Error(`${model.label} cannot take a reference image. An owner can set this tool's model to ${referenceModels().join(" or ")} (Tools, Edit), or leave the reference out.`);
|
|
1828
|
+
if (ref && !/^image\/(png|jpeg|webp)$/.test(ref.mime)) throw new Error(`The reference image is ${ref.mime}; fal takes PNG, JPEG or WebP.`);
|
|
1829
|
+
if (ref && ref.bytes.length > MAX_REFERENCE) throw new Error(`The reference image is ${(ref.bytes.length / 1024 / 1024).toFixed(1)} MB; the most is ${MAX_REFERENCE / 1024 / 1024} MB.`);
|
|
1830
|
+
const body = ref ? falEditInput(model, job.prompt, o, ref) : falInput(model, job.prompt, o);
|
|
1831
|
+
const endpoint = ref ? model.edit.id : model.id;
|
|
1763
1832
|
const j = await withRetries(
|
|
1764
1833
|
async () => {
|
|
1765
1834
|
let res;
|
|
1766
1835
|
try {
|
|
1767
|
-
res = await f(`${FAL_RUN}/${
|
|
1836
|
+
res = await f(`${FAL_RUN}/${endpoint}`, { method: "POST", headers: { authorization: `Key ${secret}`, "content-type": "application/json" }, body: JSON.stringify(body), signal: AbortSignal.timeout(17e4), redirect: "error" });
|
|
1768
1837
|
} catch (e) {
|
|
1769
1838
|
throw new Error(`Could not reach fal: ${e.message}`);
|
|
1770
1839
|
}
|
|
@@ -1794,7 +1863,7 @@ function falModule(deps = {}) {
|
|
|
1794
1863
|
files.push({ bytes, mime, name: `image-${i + 1}.${mime === "image/png" ? "png" : mime === "image/webp" ? "webp" : "jpg"}`, ...img.width ? { width: img.width } : {}, ...img.height ? { height: img.height } : {} });
|
|
1795
1864
|
}
|
|
1796
1865
|
if (!files.length) throw new Error("fal's safety checker blocked every image for that prompt.");
|
|
1797
|
-
return { files, usage: { amount: files.length, unit: "images", costUsd: falEstimateUsd(model, o) } };
|
|
1866
|
+
return { files, usage: { amount: files.length, unit: "images", costUsd: Math.round((falEstimateUsd(model, o) + (ref ? model.edit.perMp : 0)) * 1e4) / 1e4 } };
|
|
1798
1867
|
}
|
|
1799
1868
|
};
|
|
1800
1869
|
}
|
|
@@ -2626,36 +2695,36 @@ var ENGINE_VERSION = "1.0.0";
|
|
|
2626
2695
|
var MODEL_VERSION = "kokoro-v1.0+parakeet-tdt-0.6b-v2";
|
|
2627
2696
|
|
|
2628
2697
|
// ../../packages/voice-recipe/src/recipe.ts
|
|
2629
|
-
import { z as
|
|
2698
|
+
import { z as z8 } from "zod";
|
|
2630
2699
|
var RECIPE_VERSION = 1;
|
|
2631
2700
|
var TONES = ["natural", "warm", "bright", "radio", "phone"];
|
|
2632
2701
|
var REVERBS = ["off", "room", "hall"];
|
|
2633
2702
|
var LEVEL_MODES = ["loudness", "peak"];
|
|
2634
2703
|
var CONTENT_TYPES = { ogg: "audio/ogg", mp3: "audio/mpeg", wav: "audio/wav", m4a: "audio/mp4" };
|
|
2635
|
-
var blendPartSchema =
|
|
2636
|
-
var voiceRecipeSchema =
|
|
2637
|
-
version:
|
|
2704
|
+
var blendPartSchema = z8.object({ voice: z8.string().min(1).max(64), weight: z8.number().min(0).max(1) });
|
|
2705
|
+
var voiceRecipeSchema = z8.object({
|
|
2706
|
+
version: z8.literal(RECIPE_VERSION).default(RECIPE_VERSION),
|
|
2638
2707
|
/** TTS model id the base voice belongs to. */
|
|
2639
|
-
model:
|
|
2708
|
+
model: z8.string().min(1).max(64).default("kokoro-v1.0"),
|
|
2640
2709
|
/** Base voice id, e.g. `bf_emma`. */
|
|
2641
|
-
voice:
|
|
2710
|
+
voice: z8.string().min(1).max(64),
|
|
2642
2711
|
/**
|
|
2643
2712
|
* Up to two voices with weights. Reserved for engines that can mix style vectors; engine 1.x renders the heaviest
|
|
2644
2713
|
* voice (or `voice` when the list is empty) and reports `blend: false` in its capabilities.
|
|
2645
2714
|
*/
|
|
2646
|
-
blend:
|
|
2647
|
-
speed:
|
|
2648
|
-
pitchSemitones:
|
|
2649
|
-
tone:
|
|
2650
|
-
reverb:
|
|
2651
|
-
normalize:
|
|
2652
|
-
levelMode:
|
|
2715
|
+
blend: z8.array(blendPartSchema).max(2).default([]),
|
|
2716
|
+
speed: z8.number().min(0.5).max(2).default(1),
|
|
2717
|
+
pitchSemitones: z8.number().min(-12).max(12).default(0),
|
|
2718
|
+
tone: z8.enum(TONES).default("natural"),
|
|
2719
|
+
reverb: z8.enum(REVERBS).default("off"),
|
|
2720
|
+
normalize: z8.boolean().default(true),
|
|
2721
|
+
levelMode: z8.enum(LEVEL_MODES).default("loudness"),
|
|
2653
2722
|
/** Mono speech target; −19 LUFS mono is the −16 LUFS stereo guidance. */
|
|
2654
|
-
targetLufs:
|
|
2655
|
-
truePeakDb:
|
|
2656
|
-
gainDb:
|
|
2723
|
+
targetLufs: z8.number().min(-30).max(-10).default(-19),
|
|
2724
|
+
truePeakDb: z8.number().min(-6).max(0).default(-1),
|
|
2725
|
+
gainDb: z8.number().min(-20).max(20).default(0),
|
|
2657
2726
|
/** Pause length between sentences, as the synthesiser's silence scale. */
|
|
2658
|
-
silenceScale:
|
|
2727
|
+
silenceScale: z8.number().min(0).max(2).default(0.2)
|
|
2659
2728
|
});
|
|
2660
2729
|
var round3 = (n) => Math.round(n * 1e3) / 1e3;
|
|
2661
2730
|
function normaliseRecipe(input) {
|
|
@@ -3868,7 +3937,7 @@ var SessionToolRunner = class {
|
|
|
3868
3937
|
}
|
|
3869
3938
|
};
|
|
3870
3939
|
function resolveToolFile(given, cwd, scope) {
|
|
3871
|
-
if (!given) return { error: "Name the file
|
|
3940
|
+
if (!given) return { error: "Name the file." };
|
|
3872
3941
|
const abs = path12.resolve(cwd, given.replace(/^~(?=$|\/)/, process.env.HOME ?? "~"));
|
|
3873
3942
|
let real;
|
|
3874
3943
|
try {
|
|
@@ -3878,7 +3947,7 @@ function resolveToolFile(given, cwd, scope) {
|
|
|
3878
3947
|
}
|
|
3879
3948
|
if (scope !== "full") {
|
|
3880
3949
|
const root = fs12.realpathSync(cwd);
|
|
3881
|
-
if (real !== root && !real.startsWith(root + path12.sep)) return { error: "Only files inside your folder can be
|
|
3950
|
+
if (real !== root && !real.startsWith(root + path12.sep)) return { error: "Only files inside your folder can be given to a tool." };
|
|
3882
3951
|
}
|
|
3883
3952
|
const stat = fs12.statSync(real);
|
|
3884
3953
|
if (!stat.isFile()) return { error: `${given} isn't a file.` };
|
|
@@ -4462,7 +4531,7 @@ function guessMime(name) {
|
|
|
4462
4531
|
}
|
|
4463
4532
|
|
|
4464
4533
|
// src/version.ts
|
|
4465
|
-
var APP_VERSION = true ? "1.0.
|
|
4534
|
+
var APP_VERSION = true ? "1.0.16" : fromPackage();
|
|
4466
4535
|
|
|
4467
4536
|
// src/diag.ts
|
|
4468
4537
|
var MAX_HELD = 200;
|
|
@@ -5011,7 +5080,13 @@ var HostClient = class {
|
|
|
5011
5080
|
audioFile = await downloadAttachment({ id: frame.jobId, name: `${frame.jobId}.audio`, mime: frame.input.mime, size: 0, url: frame.input.url, kind: "voice" }, path16.join(configDir(), "jobs"), credential, origin);
|
|
5012
5081
|
job = { capability: "stt", audio: fs16.readFileSync(audioFile), mime: frame.input.mime, options: frame.options };
|
|
5013
5082
|
} else if (frame.input.capability === "tts") job = { capability: "tts", text: frame.input.text, options: frame.options };
|
|
5014
|
-
else
|
|
5083
|
+
else {
|
|
5084
|
+
job = { capability: "image", prompt: frame.input.prompt, args: frame.input.args, options: frame.options };
|
|
5085
|
+
if (frame.input.reference) {
|
|
5086
|
+
audioFile = await downloadAttachment({ id: frame.jobId, name: `${frame.jobId}.image`, mime: frame.input.reference.mime, size: 0, url: frame.input.reference.url, kind: "image" }, path16.join(configDir(), "jobs"), credential, origin);
|
|
5087
|
+
job.reference = { bytes: fs16.readFileSync(audioFile), mime: frame.input.reference.mime };
|
|
5088
|
+
}
|
|
5089
|
+
}
|
|
5015
5090
|
const out = await this.registry.runJob(frame.module, frame.connectionId, job);
|
|
5016
5091
|
const made = Date.now();
|
|
5017
5092
|
const outputs = [];
|
|
@@ -5158,14 +5233,14 @@ function fail(message) {
|
|
|
5158
5233
|
}
|
|
5159
5234
|
|
|
5160
5235
|
// src/enrol.ts
|
|
5161
|
-
import { z as
|
|
5162
|
-
var EnrolResponse =
|
|
5163
|
-
var EnrolPreview =
|
|
5164
|
-
space:
|
|
5236
|
+
import { z as z9 } from "zod";
|
|
5237
|
+
var EnrolResponse = z9.object({ hostId: z9.string(), credential: z9.string(), hostName: z9.string(), routerUrl: z9.string().optional(), spaceId: z9.string().optional(), spaceHandle: z9.string().optional(), spaceName: z9.string().optional() });
|
|
5238
|
+
var EnrolPreview = z9.object({
|
|
5239
|
+
space: z9.object({ id: z9.string(), handle: z9.string(), name: z9.string() }),
|
|
5165
5240
|
/** The token re-enrols an existing machine (after a reset) rather than making a new one. */
|
|
5166
|
-
reenrol:
|
|
5241
|
+
reenrol: z9.boolean(),
|
|
5167
5242
|
/** Of the host ids we sent, the ones already enrolled in the token's space. */
|
|
5168
|
-
sameSpaceHostIds:
|
|
5243
|
+
sameSpaceHostIds: z9.array(z9.string())
|
|
5169
5244
|
});
|
|
5170
5245
|
async function previewToken(routerUrl, token, hostIds, insecure) {
|
|
5171
5246
|
const base = routerUrl.replace(/\/+$/, "");
|
|
@@ -5253,7 +5328,7 @@ import { promisify as promisify5 } from "node:util";
|
|
|
5253
5328
|
import { spawn as spawn3 } from "node:child_process";
|
|
5254
5329
|
import fs17 from "node:fs";
|
|
5255
5330
|
import path17 from "node:path";
|
|
5256
|
-
import { z as
|
|
5331
|
+
import { z as z10 } from "zod";
|
|
5257
5332
|
var PACKAGE = "@monoclaw/machine";
|
|
5258
5333
|
function nodeInstallHint(platform) {
|
|
5259
5334
|
if (platform === "darwin") return "Install Node 22 or newer: `brew install node`, or the LTS installer from https://nodejs.org";
|
|
@@ -5270,7 +5345,7 @@ function updateWait(busy2, background, since, now) {
|
|
|
5270
5345
|
return now - from < BACKGROUND_WAIT_MS ? { wait: true, why: "background", since: from } : { wait: false, why: null, since: null };
|
|
5271
5346
|
}
|
|
5272
5347
|
var INSTALL_TIMEOUT_MS = 5 * 6e4;
|
|
5273
|
-
var VersionPolicy =
|
|
5348
|
+
var VersionPolicy = z10.object({ package: z10.string(), latest: z10.string().nullable(), minimum: z10.string().nullable() });
|
|
5274
5349
|
function detectInstallMode(entry = process.argv[1] ?? "") {
|
|
5275
5350
|
let real = entry;
|
|
5276
5351
|
try {
|
|
@@ -5841,7 +5916,7 @@ import fs20 from "node:fs";
|
|
|
5841
5916
|
import os6 from "node:os";
|
|
5842
5917
|
import path20 from "node:path";
|
|
5843
5918
|
import { promisify as promisify7 } from "node:util";
|
|
5844
|
-
import { z as
|
|
5919
|
+
import { z as z11 } from "zod";
|
|
5845
5920
|
import { createSdkMcpServer, listSessions, query, tool } from "@anthropic-ai/claude-agent-sdk";
|
|
5846
5921
|
|
|
5847
5922
|
// src/providers/claude/cli.ts
|
|
@@ -6181,7 +6256,7 @@ var ClaudeSession = class {
|
|
|
6181
6256
|
tool(
|
|
6182
6257
|
"send_file",
|
|
6183
6258
|
"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.",
|
|
6184
|
-
{ path:
|
|
6259
|
+
{ path: z11.string().describe("Path of the file to send, inside the working folder"), caption: z11.string().optional().describe("Short caption shown with the file") },
|
|
6185
6260
|
async (args2) => {
|
|
6186
6261
|
const full = sendablePath(this.opts.cwd, args2.path);
|
|
6187
6262
|
if (!full) return { content: [{ type: "text", text: `Only files inside the working folder (${this.opts.cwd}), outside dot-folders, can be sent.` }], isError: true };
|
|
@@ -6217,7 +6292,7 @@ var ClaudeSession = class {
|
|
|
6217
6292
|
tool(
|
|
6218
6293
|
"send",
|
|
6219
6294
|
SEND_TOOL_DESCRIPTION,
|
|
6220
|
-
{ to:
|
|
6295
|
+
{ to: z11.string().min(1).describe("One agent's name from list_agents"), text: z11.string().describe("The message") },
|
|
6221
6296
|
async (args2) => {
|
|
6222
6297
|
const id = newId();
|
|
6223
6298
|
const result = new Promise((resolve) => {
|
|
@@ -6237,11 +6312,11 @@ var ClaudeSession = class {
|
|
|
6237
6312
|
}
|
|
6238
6313
|
if (s.toolDoors)
|
|
6239
6314
|
tools.push(
|
|
6240
|
-
tool(FIND_TOOLS, FIND_TOOLS_DESCRIPTION, { query:
|
|
6315
|
+
tool(FIND_TOOLS, FIND_TOOLS_DESCRIPTION, { query: z11.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: z11.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 }),
|
|
6241
6316
|
tool(
|
|
6242
6317
|
USE_TOOL,
|
|
6243
6318
|
USE_TOOL_DESCRIPTION,
|
|
6244
|
-
{ name:
|
|
6319
|
+
{ name: z11.string().min(1).max(64).describe("The tool's name, exactly as find_tools gave it"), input: z11.record(z11.string(), z11.unknown()).describe("The tool's input: an object matching the tool's input_schema from find_tools") },
|
|
6245
6320
|
async (args2) => this.tools.use(args2),
|
|
6246
6321
|
{ alwaysLoad: true }
|
|
6247
6322
|
)
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@monoclaw/machine",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.16",
|
|
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.16",
|
|
10
10
|
"license": "UNLICENSED",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@anthropic-ai/claude-agent-sdk": "0.3.302",
|
package/package.json
CHANGED