@monoclaw/machine 1.0.22 → 1.0.23

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 CHANGED
@@ -1680,10 +1680,6 @@ function silentWav(durationMs, voice) {
1680
1680
  header.writeUInt32LE(samples, 40);
1681
1681
  return Buffer.concat([header, data]);
1682
1682
  }
1683
- var TTS_FIELDS = [
1684
- { key: "voice", label: "Voice", type: "select", choices: [{ value: "echo-a", label: "Echo A", group: "Test" }, { value: "echo-b", label: "Echo B", group: "Test" }], default: "echo-a", required: false },
1685
- { key: "speed", label: "Speed", type: "number", min: 0.5, max: 2, step: 0.05, default: 1, required: false }
1686
- ];
1687
1683
  var STT_FIELDS = [{ key: "language", label: "Language", type: "select", choices: [{ value: "auto", label: "Detect" }, { value: "en", label: "English" }], default: "auto", required: false }];
1688
1684
  var IMAGE_FIELDS = [
1689
1685
  { key: "image_size", label: "Size", type: "select", choices: [{ value: "square", label: "Square" }, { value: "landscape_16_9", label: "Landscape 16:9" }], default: "square", required: false, agentSettable: true },
@@ -1696,7 +1692,7 @@ var echoModule = {
1696
1692
  manifestVersion: 1,
1697
1693
  id: "echo",
1698
1694
  name: "Echo (test)",
1699
- summary: "Repeats what you say, and fakes voices, transcripts and images. For testing without a model.",
1695
+ summary: "Repeats what you say, and fakes transcripts and images. For testing without a model.",
1700
1696
  category: "other",
1701
1697
  publisher: { name: "MonoClaw", tier: "monoclaw" },
1702
1698
  runs: "local",
@@ -1704,7 +1700,7 @@ var echoModule = {
1704
1700
  cost: null,
1705
1701
  provides: {
1706
1702
  agent: { providerId: "echo" },
1707
- jobs: ["speech", "transcription"],
1703
+ jobs: ["transcription"],
1708
1704
  tools: [
1709
1705
  {
1710
1706
  name: "echo_image",
@@ -1719,7 +1715,6 @@ var echoModule = {
1719
1715
  result: { views: ["images", "text"] },
1720
1716
  timeoutMs: 3e4
1721
1717
  },
1722
- speakTool("echo_speak", "the echo module (silence of the right length)", false),
1723
1718
  transcribeTool("echo_transcribe", "the echo module (it reports the bytes it heard)", false),
1724
1719
  {
1725
1720
  name: "echo_lookup",
@@ -1737,20 +1732,15 @@ var echoModule = {
1737
1732
  ]
1738
1733
  }
1739
1734
  },
1740
- legacyCapabilities: ["agent", "tts", "stt", "image"],
1735
+ legacyCapabilities: ["agent", "stt", "image"],
1741
1736
  providerId: "echo",
1742
1737
  defaultConnection: { id: "echo", name: "Echo (test)" },
1743
1738
  status: () => ({ state: "ready", progress: null, summary: "Ready" }),
1744
1739
  readiness: async () => ({ ready: true, summary: "Ready", details: {} }),
1745
1740
  async options(use) {
1746
- return use === "speech" || use === "tool:echo_speak" ? TTS_FIELDS : use === "transcription" || use === "tool:echo_transcribe" ? STT_FIELDS : use === "tool:echo_image" ? IMAGE_FIELDS : [];
1741
+ return use === "transcription" || use === "tool:echo_transcribe" ? STT_FIELDS : use === "tool:echo_image" ? IMAGE_FIELDS : [];
1747
1742
  },
1748
- estimate: (job) => job.capability === "tts" ? { characters: job.text.length } : {},
1749
1743
  async runTool(name, input, files, options, conn, secret) {
1750
- if (name === "echo_speak") {
1751
- const out = await this.run({ capability: "tts", text: String(input.text ?? ""), options: resolveOptions(TTS_FIELDS, options, settableArgs(TTS_FIELDS, input)) }, conn, secret);
1752
- return { ...out, text: audioWords(out) };
1753
- }
1754
1744
  if (name === "echo_transcribe") {
1755
1745
  const file = files.find((f) => f.field === "file");
1756
1746
  if (!file) throw new Error("echo_transcribe needs the file to transcribe.");
@@ -1773,12 +1763,7 @@ ${JSON.stringify(q)},${JSON.stringify(`echo found ${q} again`)}
1773
1763
  throw unknownTool("Echo (test)", name, this.manifest.provides.tools);
1774
1764
  },
1775
1765
  async run(job) {
1776
- if (job.capability === "tts") {
1777
- const o2 = resolveOptions(TTS_FIELDS, job.options);
1778
- if (/echo-fail/.test(job.text)) throw new Error("echo cannot say that");
1779
- const durationMs = Math.round(job.text.length * 60 / num(o2.speed, 1));
1780
- return { files: [{ bytes: silentWav(durationMs, str(o2.voice, "echo-a")), mime: "audio/wav", name: "speech.wav", durationMs }], usage: { amount: job.text.length, unit: "characters" } };
1781
- }
1766
+ if (job.capability === "tts") throw new Error("echo does not speak: the fake voice is the echo-voice module.");
1782
1767
  if (job.capability === "stt") return { files: [], text: `echo heard ${job.audio.length} bytes of ${job.mime}`, language: "en", usage: { amount: 1, unit: "seconds" } };
1783
1768
  if (job.capability === "tool") throw new Error("echo runs its tools through runTool.");
1784
1769
  const o = resolveOptions(IMAGE_FIELDS, job.options, job.args);
@@ -1787,6 +1772,53 @@ ${JSON.stringify(q)},${JSON.stringify(`echo found ${q} again`)}
1787
1772
  }
1788
1773
  };
1789
1774
 
1775
+ // src/modules/echo-voice.ts
1776
+ var ECHO_VOICE_FIELDS = [
1777
+ { key: "voice", label: "Voice", type: "select", choices: [{ value: "echo-a", label: "Echo A", group: "Test" }, { value: "echo-b", label: "Echo B", group: "Test" }], default: "echo-a", required: false },
1778
+ { key: "speed", label: "Speed", type: "number", min: 0.5, max: 2, step: 0.05, default: 1, required: false }
1779
+ ];
1780
+ var echoVoiceModule = {
1781
+ id: "echo-voice",
1782
+ version: "1.0.0",
1783
+ manifest: {
1784
+ manifestVersion: 1,
1785
+ id: "echo-voice",
1786
+ name: "Echo voice (test)",
1787
+ summary: "A fake voice for your agents: silence of the right length, playable. For testing without a model.",
1788
+ category: "voice",
1789
+ publisher: { name: "MonoClaw", tier: "monoclaw" },
1790
+ runs: "local",
1791
+ key: null,
1792
+ cost: null,
1793
+ provides: {
1794
+ jobs: ["speech"],
1795
+ tools: [speakTool("echo_voice_speak", "the echo voice module (silence of the right length)", false)]
1796
+ }
1797
+ },
1798
+ legacyCapabilities: ["tts"],
1799
+ defaultConnection: { id: "echo-voice", name: "Echo voice (test)" },
1800
+ status: () => ({ state: "ready", progress: null, summary: "Ready" }),
1801
+ readiness: async () => ({ ready: true, summary: "Ready", details: {} }),
1802
+ async options(use) {
1803
+ return use === "speech" || use === "tool:echo_voice_speak" ? ECHO_VOICE_FIELDS : [];
1804
+ },
1805
+ estimate: (job) => job.capability === "tts" ? { characters: job.text.length } : {},
1806
+ async runTool(name, input, _files, options, conn, secret) {
1807
+ if (name === "echo_voice_speak") {
1808
+ const out = await this.run({ capability: "tts", text: String(input.text ?? ""), options: resolveOptions(ECHO_VOICE_FIELDS, options, settableArgs(ECHO_VOICE_FIELDS, input)) }, conn, secret);
1809
+ return { ...out, text: audioWords(out) };
1810
+ }
1811
+ throw unknownTool("Echo voice (test)", name, this.manifest.provides.tools);
1812
+ },
1813
+ async run(job) {
1814
+ if (job.capability !== "tts") throw new Error("Echo voice (test) only speaks.");
1815
+ const o = resolveOptions(ECHO_VOICE_FIELDS, job.options);
1816
+ if (/echo-fail/.test(job.text)) throw new Error("echo cannot say that");
1817
+ const durationMs = Math.round(job.text.length * 60 / num(o.speed, 1));
1818
+ return { files: [{ bytes: silentWav(durationMs, str(o.voice, "echo-a")), mime: "audio/wav", name: "speech.wav", durationMs }], usage: { amount: job.text.length, unit: "characters" } };
1819
+ }
1820
+ };
1821
+
1790
1822
  // src/modules/http.ts
1791
1823
  var sleep = (ms) => new Promise((r) => setTimeout(r, ms));
1792
1824
  async function readCapped(res, cap, what = "file") {
@@ -3933,6 +3965,7 @@ var UsageLedger = class {
3933
3965
 
3934
3966
  // src/modules/index.ts
3935
3967
  var echoFromEnv = () => (process.env.MONOCLAW_PROVIDERS ?? "").split(",").map((s) => s.trim()).includes("echo");
3968
+ var TEST_MODULES = /* @__PURE__ */ new Set(["echo", "echo-voice"]);
3936
3969
  function defaultModules(deps) {
3937
3970
  const claude = deps.providers.claude;
3938
3971
  const probe = async (env) => claude ? claude.probe(env) : { ready: false, summary: "Claude Code is switched off on this host (MONOCLAW_PROVIDERS)", details: {} };
@@ -3943,7 +3976,8 @@ function defaultModules(deps) {
3943
3976
  kokoro: kokoroModule(deps.voice),
3944
3977
  elevenlabs: elevenlabsModule({ fetch: deps.fetch }),
3945
3978
  fal: falModule({ fetch: deps.fetch }),
3946
- echo: echoModule
3979
+ echo: echoModule,
3980
+ "echo-voice": echoVoiceModule
3947
3981
  };
3948
3982
  }
3949
3983
  var CHECKING = { ready: false, summary: "Checking\u2026", details: {} };
@@ -3980,7 +4014,7 @@ var ModuleRegistry = class {
3980
4014
  }
3981
4015
  /** What this machine can install, each with its version and its setup steps for this platform. */
3982
4016
  catalogue() {
3983
- return Object.keys(this.all).filter((id) => id !== "echo" || this.echoAllowed()).map((id) => {
4017
+ return Object.keys(this.all).filter((id) => !TEST_MODULES.has(id) || this.echoAllowed()).map((id) => {
3984
4018
  const m = this.all[id];
3985
4019
  return { ...legacyCatalogueOf(m), version: m.version, setup: moduleSetup(m), manifest: this.manifestOf(m) };
3986
4020
  });
@@ -4041,7 +4075,7 @@ var ModuleRegistry = class {
4041
4075
  add(id) {
4042
4076
  const m = this.module(id);
4043
4077
  if (!m) throw new Error(`There is no module "${id}". See \`monoclaw modules list --all\`.`);
4044
- if (id === "echo" && !this.echoAllowed()) throw new Error("echo is a test module: start the host with MONOCLAW_PROVIDERS=echo to use it.");
4078
+ if (TEST_MODULES.has(id) && !this.echoAllowed()) throw new Error(`${id} is a test module: start the host with MONOCLAW_PROVIDERS=echo to use it.`);
4045
4079
  if (!this.deps.config.get().modules.some((x) => x.id === id)) this.deps.config.update((c) => ({ ...c, modules: [...c.modules, { id, addedAt: (/* @__PURE__ */ new Date()).toISOString(), settings: {} }] }));
4046
4080
  if (m.defaultConnection && !this.deps.accounts.get(m.defaultConnection.id)) this.deps.accounts.upsert({ id: m.defaultConnection.id, name: m.defaultConnection.name, type: connectionTypeOf(m), module: m.id, provider: m.providerId ?? m.id });
4047
4081
  log("info", `module ${id} added`);
@@ -4213,7 +4247,7 @@ function formatToolResult(tool2, r, cwd) {
4213
4247
  const where = f.path ? cwd ? path12.relative(cwd, f.path) || f.path : f.path : "";
4214
4248
  lines.push(where ? `Saved ${where} (attachment:${f.attachmentId})` : `Made ${f.name} (attachment:${f.attachmentId}; not saved to the folder in this scope)`);
4215
4249
  }
4216
- 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.`);
4250
+ if (made.length) lines.push(`The people in the project see ${made.every((f) => f.mime.startsWith("audio/")) ? "this audio" : made.every((f) => f.mime.startsWith("image/")) ? made.length === 1 ? "this image" : "these images" : made.length === 1 ? "this file" : "these files"} in your steps.`);
4217
4251
  return { content: [{ type: "text", text: lines.join("\n") }, ...shown] };
4218
4252
  }
4219
4253
  function formatUseResult(name, r, cwd) {
@@ -4736,7 +4770,7 @@ var SessionManager = class {
4736
4770
  }
4737
4771
  /**
4738
4772
  * The server's answer to a `tool.call`. A Full agent's files are saved under `<cwd>/images/` (audio under
4739
- * `<cwd>/audio/`) first; read-only and
4773
+ * `<cwd>/audio/`, any other kind under `<cwd>/files/`) first; read-only and
4740
4774
  * chat-only sessions don't write to the folder, so they get only the attachment ids.
4741
4775
  */
4742
4776
  async toolResult(groupId, id, r) {
@@ -4760,7 +4794,7 @@ var SessionManager = class {
4760
4794
  continue;
4761
4795
  }
4762
4796
  try {
4763
- files.push({ ...base, path: await this.saveFile(f, filesDirIn(live.cwd, f.mime.startsWith("audio/") ? "audio" : "images")) });
4797
+ files.push({ ...base, path: await this.saveFile(f, filesDirIn(live.cwd, f.mime.startsWith("audio/") ? "audio" : f.mime.startsWith("image/") ? "images" : "files")) });
4764
4798
  } catch (e) {
4765
4799
  log("warn", `[${groupId.slice(0, 8)}] could not save ${f.name}: ${e.message}`);
4766
4800
  files.push(base);
@@ -5075,7 +5109,7 @@ function guessMime(name) {
5075
5109
  }
5076
5110
 
5077
5111
  // src/version.ts
5078
- var APP_VERSION = true ? "1.0.22" : fromPackage();
5112
+ var APP_VERSION = true ? "1.0.23" : fromPackage();
5079
5113
 
5080
5114
  // src/diag.ts
5081
5115
  var MAX_HELD = 200;
@@ -6454,8 +6488,14 @@ ${r.text}`, final: true });
6454
6488
  }
6455
6489
  if (text2.startsWith("find:") || text2.startsWith("use:")) {
6456
6490
  const rest = text2.slice(text2.indexOf(":") + 1);
6457
- 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(":") });
6458
- 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 });
6491
+ const name = rest.split(":")[0]?.trim() ?? "";
6492
+ const input = rest.split(":").slice(1).join(":");
6493
+ const callId = text2.startsWith("use:") ? `tu-${newId().slice(0, 8)}` : null;
6494
+ if (callId) this.q.push({ kind: "tool", id: callId, name: `mcp__monoclaw-tools__${name}`, summary: `Use ${name}`, input });
6495
+ const r = text2.startsWith("find:") ? await this.tools.find({ query: rest.trim() || void 0 }) : await this.tools.use({ name, input });
6496
+ const out = r.content.map((c) => c.type === "text" ? c.text : `[image ${c.mimeType}, ${c.data.length} base64 characters]`).join("\n");
6497
+ if (callId) this.q.push({ kind: "tool_result", id: callId, name: `mcp__monoclaw-tools__${name}`, output: out, isError: !!r.isError });
6498
+ this.q.push({ kind: "text", text: out, final: true });
6459
6499
  this.q.push({ kind: "done", interrupted: false });
6460
6500
  return;
6461
6501
  }
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@monoclaw/machine",
3
- "version": "1.0.22",
3
+ "version": "1.0.23",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@monoclaw/machine",
9
- "version": "1.0.22",
9
+ "version": "1.0.23",
10
10
  "license": "UNLICENSED",
11
11
  "dependencies": {
12
12
  "@anthropic-ai/claude-agent-sdk": "0.3.302",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@monoclaw/machine",
3
- "version": "1.0.22",
3
+ "version": "1.0.23",
4
4
  "description": "Monoclaw host app: runs agents on your machine and connects them to your Monoclaw account (command.monoclaw.ai).",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {