@monoclaw/machine 1.0.16 → 1.0.18

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
@@ -734,7 +734,7 @@ var Accounts = class {
734
734
 
735
735
  // src/client.ts
736
736
  import fs16 from "node:fs";
737
- import os4 from "node:os";
737
+ import os5 from "node:os";
738
738
  import path16 from "node:path";
739
739
  import WebSocket from "ws";
740
740
 
@@ -956,6 +956,12 @@ var SessionSettings = z3.object({
956
956
  canMessage: z3.boolean().optional(),
957
957
  /** Allow Claude Code's own cross-session messaging (ListAgents/SendMessage). Off unless the owner allows it. */
958
958
  peerMessaging: z3.boolean().optional(),
959
+ /**
960
+ * Give the session the claude.ai connectors of the login it runs on (Gmail, Drive, Docs…; plan
961
+ * draft-2026-11-26-connectors-off-by-default). Off unless the owner turns it on: a machine program from 1.0.18 opens
962
+ * the session with Claude Code's `disableClaudeAiConnectors` unless this is true.
963
+ */
964
+ connectors: z3.boolean().optional(),
959
965
  /** The organisation's tools this agent was given (plan draft-2026-11-06-modules), offered as `mcp__monoclaw-tools__<name>`. */
960
966
  tools: z3.array(SessionTool).default([]),
961
967
  /**
@@ -1203,7 +1209,14 @@ var RouterFrame = z4.discriminatedUnion("t", [
1203
1209
  id: z4.string(),
1204
1210
  text: z4.string().optional(),
1205
1211
  error: z4.string().optional(),
1206
- files: z4.array(z4.object({ url: z4.string(), name: z4.string(), mime: z4.string(), attachmentId: z4.string() })).default([]),
1212
+ files: z4.array(z4.object({
1213
+ url: z4.string(),
1214
+ name: z4.string(),
1215
+ mime: z4.string(),
1216
+ attachmentId: z4.string(),
1217
+ /** 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. */
1218
+ show: z4.boolean().optional()
1219
+ })).default([]),
1207
1220
  /**
1208
1221
  * For a `tool.use` only (docs/TOOLS.md): the call is valid but did not run yet. `ask`: a person must approve it
1209
1222
  * first (the host shows its approval card). `upload`: the input's field of that name is a file on the agent's
@@ -1349,6 +1362,16 @@ var AGENTS_PROPOSE_CHANGE = {
1349
1362
  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
1363
  };
1351
1364
 
1365
+ // ../../packages/protocol/src/image-view-tool.ts
1366
+ import { z as z8 } from "zod";
1367
+ var IMAGE_VIEW_MAX_BYTES = 5 * 1024 * 1024;
1368
+ var IMAGE_VIEW = {
1369
+ name: "image_view",
1370
+ 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.",
1371
+ schema: z8.object({ image: z8.string().min(1).max(80).describe("The picture to look at, as `attachment:<id>`") }),
1372
+ example: { image: "attachment:att_01HZY4K2M7Q8R9S0T1U2V3W4X5" }
1373
+ };
1374
+
1352
1375
  // src/modules/index.ts
1353
1376
  import path11 from "node:path";
1354
1377
 
@@ -2695,36 +2718,36 @@ var ENGINE_VERSION = "1.0.0";
2695
2718
  var MODEL_VERSION = "kokoro-v1.0+parakeet-tdt-0.6b-v2";
2696
2719
 
2697
2720
  // ../../packages/voice-recipe/src/recipe.ts
2698
- import { z as z8 } from "zod";
2721
+ import { z as z9 } from "zod";
2699
2722
  var RECIPE_VERSION = 1;
2700
2723
  var TONES = ["natural", "warm", "bright", "radio", "phone"];
2701
2724
  var REVERBS = ["off", "room", "hall"];
2702
2725
  var LEVEL_MODES = ["loudness", "peak"];
2703
2726
  var CONTENT_TYPES = { ogg: "audio/ogg", mp3: "audio/mpeg", wav: "audio/wav", m4a: "audio/mp4" };
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),
2727
+ var blendPartSchema = z9.object({ voice: z9.string().min(1).max(64), weight: z9.number().min(0).max(1) });
2728
+ var voiceRecipeSchema = z9.object({
2729
+ version: z9.literal(RECIPE_VERSION).default(RECIPE_VERSION),
2707
2730
  /** TTS model id the base voice belongs to. */
2708
- model: z8.string().min(1).max(64).default("kokoro-v1.0"),
2731
+ model: z9.string().min(1).max(64).default("kokoro-v1.0"),
2709
2732
  /** Base voice id, e.g. `bf_emma`. */
2710
- voice: z8.string().min(1).max(64),
2733
+ voice: z9.string().min(1).max(64),
2711
2734
  /**
2712
2735
  * Up to two voices with weights. Reserved for engines that can mix style vectors; engine 1.x renders the heaviest
2713
2736
  * voice (or `voice` when the list is empty) and reports `blend: false` in its capabilities.
2714
2737
  */
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"),
2738
+ blend: z9.array(blendPartSchema).max(2).default([]),
2739
+ speed: z9.number().min(0.5).max(2).default(1),
2740
+ pitchSemitones: z9.number().min(-12).max(12).default(0),
2741
+ tone: z9.enum(TONES).default("natural"),
2742
+ reverb: z9.enum(REVERBS).default("off"),
2743
+ normalize: z9.boolean().default(true),
2744
+ levelMode: z9.enum(LEVEL_MODES).default("loudness"),
2722
2745
  /** Mono speech target; −19 LUFS mono is the −16 LUFS stereo guidance. */
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),
2746
+ targetLufs: z9.number().min(-30).max(-10).default(-19),
2747
+ truePeakDb: z9.number().min(-6).max(0).default(-1),
2748
+ gainDb: z9.number().min(-20).max(20).default(0),
2726
2749
  /** Pause length between sentences, as the synthesiser's silence scale. */
2727
- silenceScale: z8.number().min(0).max(2).default(0.2)
2750
+ silenceScale: z9.number().min(0).max(2).default(0.2)
2728
2751
  });
2729
2752
  var round3 = (n) => Math.round(n * 1e3) / 1e3;
2730
2753
  function normaliseRecipe(input) {
@@ -3778,6 +3801,7 @@ var ModuleRegistry = class {
3778
3801
 
3779
3802
  // src/sessions.ts
3780
3803
  import fs13 from "node:fs";
3804
+ import os4 from "node:os";
3781
3805
  import path13 from "node:path";
3782
3806
 
3783
3807
  // src/tools.ts
@@ -3788,6 +3812,7 @@ var TOOL_TIMEOUT_MS = 3 * 6e4;
3788
3812
  var STT_TOOL_TIMEOUT_MS = 11 * 6e4;
3789
3813
  var TTS_TOOL_TIMEOUT_MS = 6 * 6e4;
3790
3814
  var toolMcpName = (t) => `mcp__${TOOLS_SERVER}__${t.name}`;
3815
+ var SHOW_MAX_BYTES = 5 * 1024 * 1024;
3791
3816
  var FIND_TOOLS = "find_tools";
3792
3817
  var USE_TOOL = "use_tool";
3793
3818
  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 +3828,19 @@ function toolCallArgs(tool2, args2) {
3803
3828
  function formatToolResult(tool2, r, cwd) {
3804
3829
  if (r.error) return { content: [{ type: "text", text: `${tool2.name} failed: ${r.error}` }], isError: true };
3805
3830
  const lines = [r.text?.trim() || `${tool2.name} finished.`];
3831
+ const shown = [];
3832
+ const made = r.files.filter((f) => !f.show);
3806
3833
  for (const f of r.files) {
3834
+ if (f.show) {
3835
+ if (f.bytes) shown.push({ type: "image", data: f.bytes.toString("base64"), mimeType: f.mime });
3836
+ else lines.push(`${f.name} (attachment:${f.attachmentId}) could not be fetched to show you.`);
3837
+ continue;
3838
+ }
3807
3839
  const where = f.path ? cwd ? path12.relative(cwd, f.path) || f.path : f.path : "";
3808
3840
  lines.push(where ? `Saved ${where} (attachment:${f.attachmentId})` : `Made ${f.name} (attachment:${f.attachmentId}; not saved to the folder in this scope)`);
3809
3841
  }
3810
- if (r.files.length) lines.push(`The people in the project see ${r.files.every((f) => f.mime.startsWith("audio/")) ? "this audio" : "these images"} in your steps.`);
3811
- return { content: [{ type: "text", text: lines.join("\n") }] };
3842
+ 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.`);
3843
+ return { content: [{ type: "text", text: lines.join("\n") }, ...shown] };
3812
3844
  }
3813
3845
  function formatUseResult(name, r, cwd) {
3814
3846
  if (r.error) return { content: [{ type: "text", text: r.error }], isError: true };
@@ -3971,12 +4003,23 @@ var SessionManager = class {
3971
4003
  const dest = uniqueFileName(dir, f.name);
3972
4004
  fs13.renameSync(tmp, dest);
3973
4005
  return dest;
4006
+ }, fetchFile = async (f, cap) => {
4007
+ const dir = fs13.mkdtempSync(path13.join(os4.tmpdir(), "mc-show-"));
4008
+ try {
4009
+ const tmp = await download({ id: f.attachmentId, name: f.name, mime: f.mime, size: 0, url: f.url, kind: "image" }, dir);
4010
+ const bytes = fs13.readFileSync(tmp);
4011
+ if (bytes.length > cap) throw new Error(`${f.name} is larger than ${Math.round(cap / (1024 * 1024))} MB`);
4012
+ return bytes;
4013
+ } finally {
4014
+ fs13.rmSync(dir, { recursive: true, force: true });
4015
+ }
3974
4016
  }) {
3975
4017
  this.emit = emit;
3976
4018
  this.download = download;
3977
4019
  this.policy = policy;
3978
4020
  this.accounts = accounts;
3979
4021
  this.saveFile = saveFile;
4022
+ this.fetchFile = fetchFile;
3980
4023
  this.providerMap = typeof providers2 === "function" ? providers2 : () => providers2;
3981
4024
  }
3982
4025
  emit;
@@ -3984,6 +4027,7 @@ var SessionManager = class {
3984
4027
  policy;
3985
4028
  accounts;
3986
4029
  saveFile;
4030
+ fetchFile;
3987
4031
  live = /* @__PURE__ */ new Map();
3988
4032
  /** Opens in progress. The router sends `session.open` and the first `inbound` back to back; frames are handled
3989
4033
  * concurrently, so anything that needs the session waits for the open to finish instead of finding nothing. */
@@ -4221,6 +4265,15 @@ var SessionManager = class {
4221
4265
  const save = (live.settings.scope ?? "full") === "full";
4222
4266
  for (const f of r.files) {
4223
4267
  const base = { name: f.name, mime: f.mime, attachmentId: f.attachmentId };
4268
+ if (f.show) {
4269
+ try {
4270
+ files.push({ ...base, show: true, bytes: await this.fetchFile(f, SHOW_MAX_BYTES) });
4271
+ } catch (e) {
4272
+ log("warn", `[${groupId.slice(0, 8)}] could not fetch ${f.name} to show: ${e.message}`);
4273
+ files.push({ ...base, show: true });
4274
+ }
4275
+ continue;
4276
+ }
4224
4277
  if (!save) {
4225
4278
  files.push(base);
4226
4279
  continue;
@@ -4470,6 +4523,12 @@ async function downloadAttachment(att, dir, credential, routerOrigin2) {
4470
4523
  fs15.writeFileSync(full, buf);
4471
4524
  return full;
4472
4525
  }
4526
+ async function fetchAttachmentBytes(url, credential, routerOrigin2, cap) {
4527
+ assertRouterTarget(url, routerOrigin2, "attachment");
4528
+ const res = await fetch(url, { headers: { Authorization: `Bearer ${credential}` }, signal: AbortSignal.timeout(6e4), redirect: "manual" });
4529
+ if (!res.ok) throw new Error(`download failed: ${res.status}`);
4530
+ return readCapped2(res, cap);
4531
+ }
4473
4532
  async function uploadFile(uploadUrl, credential, routerOrigin2, input) {
4474
4533
  assertRouterTarget(uploadUrl, routerOrigin2, "upload");
4475
4534
  const stat = fs15.statSync(input.filePath);
@@ -4531,7 +4590,7 @@ function guessMime(name) {
4531
4590
  }
4532
4591
 
4533
4592
  // src/version.ts
4534
- var APP_VERSION = true ? "1.0.16" : fromPackage();
4593
+ var APP_VERSION = true ? "1.0.18" : fromPackage();
4535
4594
 
4536
4595
  // src/diag.ts
4537
4596
  var MAX_HELD = 200;
@@ -4620,7 +4679,10 @@ var HostClient = class {
4620
4679
  const c = id ? registry.connection(id) : null;
4621
4680
  if (c?.module === "claude-api") registry.ledger.addSessionCost(c.id, sessionId, total);
4622
4681
  }
4623
- }
4682
+ },
4683
+ void 0,
4684
+ // A file to show to the model (image_view): its bytes, with this machine's credential, saved nowhere.
4685
+ (f, cap) => fetchAttachmentBytes(f.url, cfg.credential ?? "", routerOrigin(cfg.routerUrl), cap)
4624
4686
  );
4625
4687
  }
4626
4688
  cfg;
@@ -5110,7 +5172,7 @@ var HostClient = class {
5110
5172
  }
5111
5173
  };
5112
5174
  function describeMachine() {
5113
- return { name: os4.hostname(), platform: process.platform, arch: process.arch, appVersion: APP_VERSION, nodeVersion: process.version };
5175
+ return { name: os5.hostname(), platform: process.platform, arch: process.arch, appVersion: APP_VERSION, nodeVersion: process.version };
5114
5176
  }
5115
5177
 
5116
5178
  // src/modules/commands.ts
@@ -5233,14 +5295,14 @@ function fail(message) {
5233
5295
  }
5234
5296
 
5235
5297
  // src/enrol.ts
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() }),
5298
+ import { z as z10 } from "zod";
5299
+ 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() });
5300
+ var EnrolPreview = z10.object({
5301
+ space: z10.object({ id: z10.string(), handle: z10.string(), name: z10.string() }),
5240
5302
  /** The token re-enrols an existing machine (after a reset) rather than making a new one. */
5241
- reenrol: z9.boolean(),
5303
+ reenrol: z10.boolean(),
5242
5304
  /** Of the host ids we sent, the ones already enrolled in the token's space. */
5243
- sameSpaceHostIds: z9.array(z9.string())
5305
+ sameSpaceHostIds: z10.array(z10.string())
5244
5306
  });
5245
5307
  async function previewToken(routerUrl, token, hostIds, insecure) {
5246
5308
  const base = routerUrl.replace(/\/+$/, "");
@@ -5320,7 +5382,7 @@ async function enrol(token, routerUrl, opts) {
5320
5382
  // src/connect.ts
5321
5383
  import { execFile as execFile5, spawn as spawn4 } from "node:child_process";
5322
5384
  import fs18 from "node:fs";
5323
- import os5 from "node:os";
5385
+ import os6 from "node:os";
5324
5386
  import path18 from "node:path";
5325
5387
  import { promisify as promisify5 } from "node:util";
5326
5388
 
@@ -5328,7 +5390,7 @@ import { promisify as promisify5 } from "node:util";
5328
5390
  import { spawn as spawn3 } from "node:child_process";
5329
5391
  import fs17 from "node:fs";
5330
5392
  import path17 from "node:path";
5331
- import { z as z10 } from "zod";
5393
+ import { z as z11 } from "zod";
5332
5394
  var PACKAGE = "@monoclaw/machine";
5333
5395
  function nodeInstallHint(platform) {
5334
5396
  if (platform === "darwin") return "Install Node 22 or newer: `brew install node`, or the LTS installer from https://nodejs.org";
@@ -5345,7 +5407,7 @@ function updateWait(busy2, background, since, now) {
5345
5407
  return now - from < BACKGROUND_WAIT_MS ? { wait: true, why: "background", since: from } : { wait: false, why: null, since: null };
5346
5408
  }
5347
5409
  var INSTALL_TIMEOUT_MS = 5 * 6e4;
5348
- var VersionPolicy = z10.object({ package: z10.string(), latest: z10.string().nullable(), minimum: z10.string().nullable() });
5410
+ var VersionPolicy = z11.object({ package: z11.string(), latest: z11.string().nullable(), minimum: z11.string().nullable() });
5349
5411
  function detectInstallMode(entry = process.argv[1] ?? "") {
5350
5412
  let real = entry;
5351
5413
  try {
@@ -5573,7 +5635,7 @@ function globalInstall(prefix, platform = process.platform) {
5573
5635
  const modules2 = platform === "win32" ? p.join(prefix, "node_modules") : p.join(prefix, "lib", "node_modules");
5574
5636
  return { script: p.join(modules2, "@monoclaw", "machine", "bin", "monoclaw.js"), binDir: platform === "win32" ? prefix : p.join(prefix, "bin") };
5575
5637
  }
5576
- function enrolArgs(o, hasEnrolment, home = os5.homedir()) {
5638
+ function enrolArgs(o, hasEnrolment, home = os6.homedir()) {
5577
5639
  const args2 = [...o.profile ? ["--profile", o.profile] : [], "enrol", o.token, "--router", o.router];
5578
5640
  const roots2 = o.root?.length ? o.root : hasEnrolment ? [] : [path18.join(home, "command")];
5579
5641
  if (roots2.length) args2.push("--root", ...roots2);
@@ -5785,7 +5847,7 @@ ${r.text}`, final: true });
5785
5847
  const callId = `tu-${newId().slice(0, 8)}`;
5786
5848
  this.q.push({ kind: "tool", id: callId, name: `mcp__monoclaw-tools__${name.trim()}`, summary: prompt, input: JSON.stringify({ prompt }) });
5787
5849
  const r = await reply();
5788
- const out = r.content.map((c) => c.text).join("\n");
5850
+ const out = r.content.map((c) => c.type === "text" ? c.text : `[image ${c.mimeType}, ${c.data.length} base64 characters]`).join("\n");
5789
5851
  this.q.push({ kind: "tool_result", id: callId, name: `mcp__monoclaw-tools__${name.trim()}`, output: out, isError: !!r.isError });
5790
5852
  this.q.push({ kind: "text", text: out, final: true });
5791
5853
  this.q.push({ kind: "done", interrupted: false });
@@ -5794,7 +5856,7 @@ ${r.text}`, final: true });
5794
5856
  if (text2.startsWith("find:") || text2.startsWith("use:")) {
5795
5857
  const rest = text2.slice(text2.indexOf(":") + 1);
5796
5858
  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 });
5859
+ 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
5860
  this.q.push({ kind: "done", interrupted: false });
5799
5861
  return;
5800
5862
  }
@@ -5913,10 +5975,10 @@ var echoProvider = {
5913
5975
  // src/providers/claude/index.ts
5914
5976
  import { execFile as execFile7 } from "node:child_process";
5915
5977
  import fs20 from "node:fs";
5916
- import os6 from "node:os";
5978
+ import os7 from "node:os";
5917
5979
  import path20 from "node:path";
5918
5980
  import { promisify as promisify7 } from "node:util";
5919
- import { z as z11 } from "zod";
5981
+ import { z as z12 } from "zod";
5920
5982
  import { createSdkMcpServer, listSessions, query, tool } from "@anthropic-ai/claude-agent-sdk";
5921
5983
 
5922
5984
  // src/providers/claude/cli.ts
@@ -6256,7 +6318,7 @@ var ClaudeSession = class {
6256
6318
  tool(
6257
6319
  "send_file",
6258
6320
  "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: z11.string().describe("Path of the file to send, inside the working folder"), caption: z11.string().optional().describe("Short caption shown with the file") },
6321
+ { 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
6322
  async (args2) => {
6261
6323
  const full = sendablePath(this.opts.cwd, args2.path);
6262
6324
  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 +6354,7 @@ var ClaudeSession = class {
6292
6354
  tool(
6293
6355
  "send",
6294
6356
  SEND_TOOL_DESCRIPTION,
6295
- { to: z11.string().min(1).describe("One agent's name from list_agents"), text: z11.string().describe("The message") },
6357
+ { to: z12.string().min(1).describe("One agent's name from list_agents"), text: z12.string().describe("The message") },
6296
6358
  async (args2) => {
6297
6359
  const id = newId();
6298
6360
  const result = new Promise((resolve) => {
@@ -6312,11 +6374,11 @@ var ClaudeSession = class {
6312
6374
  }
6313
6375
  if (s.toolDoors)
6314
6376
  tools.push(
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 }),
6377
+ 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
6378
  tool(
6317
6379
  USE_TOOL,
6318
6380
  USE_TOOL_DESCRIPTION,
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") },
6381
+ { 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
6382
  async (args2) => this.tools.use(args2),
6321
6383
  { alwaysLoad: true }
6322
6384
  )
@@ -6334,7 +6396,7 @@ var ClaudeSession = class {
6334
6396
  systemPrompt: { type: "preset", preset: "claude_code", append: buildAppend(s) },
6335
6397
  permissionMode: mode,
6336
6398
  allowDangerouslySkipPermissions: mode === "bypassPermissions" ? true : void 0,
6337
- ...scopeSettings(scope, !!s.peerMessaging),
6399
+ ...scopeSettings(scope, !!s.peerMessaging, !!s.connectors),
6338
6400
  model: s.model || void 0,
6339
6401
  resume: this.sessionId,
6340
6402
  forkSession: this.forkPending || void 0,
@@ -6594,10 +6656,12 @@ function scopeOptions(scope, peerMessaging = false) {
6594
6656
  if (scope === "chat") return { tools: [] };
6595
6657
  return peerMessaging ? {} : { disallowedTools: PEER_SESSION_TOOLS };
6596
6658
  }
6597
- function scopeSettings(scope, peerMessaging = false) {
6659
+ function scopeSettings(scope, peerMessaging = false, connectors = false) {
6660
+ const off = connectors ? {} : { disableClaudeAiConnectors: true };
6598
6661
  const peer = peerMessaging ? {} : { crossSessionInbound: "refuse" };
6599
- if (scope === "full") return { settingSources: SESSION_SETTING_SOURCES, ...peerMessaging ? {} : { settings: peer } };
6600
- return { settingSources: [], settings: { ...peer, disableAllHooks: true } };
6662
+ const settings = { ...off, ...peer };
6663
+ if (scope === "full") return { settingSources: SESSION_SETTING_SOURCES, ...Object.keys(settings).length ? { settings } : {} };
6664
+ return { settingSources: [], settings: { ...settings, disableAllHooks: true } };
6601
6665
  }
6602
6666
  function monoclawToolNames(s) {
6603
6667
  return [...(s.scope ?? "full") === "full" ? ["send_file"] : [], ...s.canMessage ? ["list_agents", "send"] : []];
@@ -6634,7 +6698,7 @@ function friendlyPath(p, cwd) {
6634
6698
  if (file === base) return ".";
6635
6699
  if (file.startsWith(`${base}/`)) return file.slice(base.length + 1);
6636
6700
  }
6637
- const home = norm(os6.homedir());
6701
+ const home = norm(os7.homedir());
6638
6702
  if (home && file.startsWith(`${home}/`)) return `~/${file.slice(home.length + 1)}`;
6639
6703
  return file;
6640
6704
  }
@@ -6855,7 +6919,7 @@ var providers = only.length ? Object.fromEntries(Object.entries(all).filter(([id
6855
6919
  // src/service.ts
6856
6920
  import { spawnSync } from "node:child_process";
6857
6921
  import fs21 from "node:fs";
6858
- import os7 from "node:os";
6922
+ import os8 from "node:os";
6859
6923
  import path21 from "node:path";
6860
6924
  function serviceNames(profile = currentProfile()) {
6861
6925
  return { unit: profile ? `monoclaw-${profile}` : "monoclaw", label: profile ? `ai.monoclaw.host.${profile}` : "ai.monoclaw.host", task: profile ? `MonoClaw host (${profile})` : "MonoClaw host" };
@@ -6878,7 +6942,7 @@ function servicePath(node) {
6878
6942
  }
6879
6943
  function serviceInstructions() {
6880
6944
  const dir = configDir();
6881
- const home = os7.homedir();
6945
+ const home = os8.homedir();
6882
6946
  const { node, script } = selfCommand();
6883
6947
  const logs = path21.join(dir, "logs");
6884
6948
  fs21.mkdirSync(logs, { recursive: true });
@@ -6953,7 +7017,7 @@ var runSync = (cmd2, args2) => {
6953
7017
  };
6954
7018
  function installService(run3 = runSync) {
6955
7019
  const r = serviceInstructions();
6956
- const home = os7.homedir();
7020
+ const home = os8.homedir();
6957
7021
  const must = (cmd2, args2) => {
6958
7022
  const x = run3(cmd2, args2);
6959
7023
  if (x.status !== 0) throw new Error(`${cmd2} ${args2.join(" ")} failed: ${x.stderr.trim() || `exit ${x.status}`}`);
@@ -6981,7 +7045,7 @@ function installService(run3 = runSync) {
6981
7045
  return { file: r.file, target: `Task Scheduler: ${names.task}`, notes: [`Check: Get-ScheduledTask -TaskName "${names.task}"`] };
6982
7046
  }
6983
7047
  function uninstallService(run3 = runSync) {
6984
- const home = os7.homedir();
7048
+ const home = os8.homedir();
6985
7049
  const names = serviceNames();
6986
7050
  if (process.platform === "darwin") {
6987
7051
  const target = path21.join(home, "Library", "LaunchAgents", `${names.label}.plist`);
@@ -7001,7 +7065,7 @@ function uninstallService(run3 = runSync) {
7001
7065
  }
7002
7066
  function lingerEnabled() {
7003
7067
  if (process.platform !== "linux") return null;
7004
- const r = spawnSync("loginctl", ["show-user", os7.userInfo().username, "--property=Linger", "--value"], { encoding: "utf8" });
7068
+ const r = spawnSync("loginctl", ["show-user", os8.userInfo().username, "--property=Linger", "--value"], { encoding: "utf8" });
7005
7069
  if (r.status !== 0) return null;
7006
7070
  const v = String(r.stdout ?? "").trim();
7007
7071
  return v === "yes" ? true : v === "no" ? false : null;
@@ -7010,7 +7074,7 @@ var LINGER_FIX = "loginctl enable-linger $USER";
7010
7074
  function lingerNote(run3) {
7011
7075
  const on = lingerEnabled();
7012
7076
  if (on !== false) return null;
7013
- const r = run3("loginctl", ["enable-linger", os7.userInfo().username]);
7077
+ const r = run3("loginctl", ["enable-linger", os8.userInfo().username]);
7014
7078
  if (r.status === 0 && lingerEnabled() === true) return "Set to keep running when you log out (linger is on for your user).";
7015
7079
  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
7080
  }
@@ -7024,7 +7088,7 @@ function startedByHand(foreground, env, isTTY) {
7024
7088
 
7025
7089
  // src/cli.ts
7026
7090
  import { spawn as spawn5 } from "node:child_process";
7027
- import os8 from "node:os";
7091
+ import os9 from "node:os";
7028
7092
  async function readTokenFromStdin() {
7029
7093
  let data = "";
7030
7094
  for await (const chunk of process.stdin) data += chunk;
@@ -7066,7 +7130,7 @@ program.command("enrol [token]").description("Connect this machine to your MonoC
7066
7130
  }
7067
7131
  const profiles = listProfiles();
7068
7132
  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: os8.hostname() });
7133
+ const plan = planEnrol(preview, profiles, opts.router, { requestedProfile: currentProfile(), defaultName: os9.hostname() });
7070
7134
  const report = (profile) => {
7071
7135
  if (process.env.MONOCLAW_CONNECT) fs22.writeFileSync(connectResultPath(), JSON.stringify({ profile, at: (/* @__PURE__ */ new Date()).toISOString() }), { mode: 384 });
7072
7136
  };
@@ -7383,7 +7447,7 @@ program.command("doctor").description("Check and repair what a working host need
7383
7447
  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
7448
  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
7449
  const names = serviceNames();
7386
- const unit = process.platform === "darwin" ? path22.join(os8.homedir(), "Library", "LaunchAgents", `${names.label}.plist`) : process.platform === "linux" ? path22.join(os8.homedir(), ".config", "systemd", "user", `${names.unit}.service`) : null;
7450
+ 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
7451
  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
7452
  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
7453
  const { registry } = await makeContext(cfg);
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@monoclaw/machine",
3
- "version": "1.0.16",
3
+ "version": "1.0.18",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@monoclaw/machine",
9
- "version": "1.0.16",
9
+ "version": "1.0.18",
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.16",
3
+ "version": "1.0.18",
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": {