@monoclaw/machine 1.0.18 → 1.0.20

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
@@ -40,8 +40,8 @@ function acquireRunLock(dir, me = process.pid, parent = process.ppid, alive = pr
40
40
  }
41
41
 
42
42
  // src/cli.ts
43
- import fs22 from "node:fs";
44
- import path22 from "node:path";
43
+ import fs23 from "node:fs";
44
+ import path23 from "node:path";
45
45
  import { Command } from "commander";
46
46
  import readline from "node:readline";
47
47
 
@@ -1633,11 +1633,11 @@ var busy = (e) => e.status === 429 && (e.code === "system_busy" || e.code === "t
1633
1633
  function elevenlabsModule(deps = {}) {
1634
1634
  const f = deps.fetch ?? ((...a) => fetch(...a));
1635
1635
  const queue = new PerKeyQueue();
1636
- const call = (key, path23, init = {}, timeoutMs = 12e4) => withRetries(
1636
+ const call = (key, path24, init = {}, timeoutMs = 12e4) => withRetries(
1637
1637
  async () => {
1638
1638
  let res;
1639
1639
  try {
1640
- res = await f(`${ELEVENLABS_BASE}${path23}`, { ...init, headers: { ...init.headers, "xi-api-key": key }, signal: AbortSignal.timeout(timeoutMs), redirect: "error" });
1640
+ res = await f(`${ELEVENLABS_BASE}${path24}`, { ...init, headers: { ...init.headers, "xi-api-key": key }, signal: AbortSignal.timeout(timeoutMs), redirect: "error" });
1641
1641
  } catch (e) {
1642
1642
  throw new Error(`Could not reach ElevenLabs: ${e.message}`);
1643
1643
  }
@@ -3846,9 +3846,22 @@ function formatUseResult(name, r, cwd) {
3846
3846
  if (r.error) return { content: [{ type: "text", text: r.error }], isError: true };
3847
3847
  return formatToolResult({ name }, r, cwd);
3848
3848
  }
3849
+ var READ_ONLY_TOOLS = /* @__PURE__ */ new Set(["find_tools", "list_agents", "image_view", "agents_options", "agents_read_profile"]);
3850
+ var RESTART_PLAIN = "The service restarted while this ran; call it again.";
3851
+ function restartMessage(call) {
3852
+ switch (call.kind) {
3853
+ case "find":
3854
+ case "list":
3855
+ return RESTART_PLAIN;
3856
+ case "use":
3857
+ return READ_ONLY_TOOLS.has(call.name) ? RESTART_PLAIN : `The service restarted while ${call.name} ran. It may have run anyway: anything it made would be in your steps for the people in the project, and it may have cost money. Ask the person before calling it again.`;
3858
+ case "send":
3859
+ return `The service restarted while this message was being sent to ${call.to}. It may have arrived. If it matters, ask ${call.to} whether it did before sending it again.`;
3860
+ }
3861
+ }
3849
3862
  var ToolWaits = class {
3850
3863
  waits = /* @__PURE__ */ new Map();
3851
- wait(id, timeoutMs = TOOL_TIMEOUT_MS) {
3864
+ wait(id, timeoutMs = TOOL_TIMEOUT_MS, lost = RESTART_PLAIN) {
3852
3865
  return new Promise((resolve) => {
3853
3866
  const timer = setTimeout(() => finish({ error: `No result within ${Math.round(timeoutMs / 1e3)} seconds.`, files: [] }), timeoutMs);
3854
3867
  const finish = (r) => {
@@ -3856,14 +3869,18 @@ var ToolWaits = class {
3856
3869
  this.waits.delete(id);
3857
3870
  resolve(r);
3858
3871
  };
3859
- this.waits.set(id, finish);
3872
+ this.waits.set(id, { finish, lost });
3860
3873
  });
3861
3874
  }
3862
3875
  resolve(id, r) {
3863
- this.waits.get(id)?.(r);
3876
+ this.waits.get(id)?.finish(r);
3864
3877
  }
3865
3878
  closeAll(reason = "Session closed.") {
3866
- for (const f of [...this.waits.values()]) f({ error: reason, files: [] });
3879
+ for (const w of [...this.waits.values()]) w.finish({ error: reason, files: [] });
3880
+ }
3881
+ /** The connection to the service closed: every waiting call ends now with its own message. */
3882
+ failWaiting() {
3883
+ for (const w of [...this.waits.values()]) w.finish({ error: w.lost, files: [] });
3867
3884
  }
3868
3885
  };
3869
3886
  var SessionToolRunner = class {
@@ -3889,7 +3906,7 @@ var SessionToolRunner = class {
3889
3906
  if (!ok) return formatToolResult(t, { error: "The user declined this tool call.", files: [] });
3890
3907
  }
3891
3908
  const id = newId();
3892
- const wait = this.waits.wait(id, t.capability === "tts" && this.timeoutMs === TOOL_TIMEOUT_MS ? TTS_TOOL_TIMEOUT_MS : this.timeoutMs);
3909
+ const wait = this.waits.wait(id, t.capability === "tts" && this.timeoutMs === TOOL_TIMEOUT_MS ? TTS_TOOL_TIMEOUT_MS : this.timeoutMs, restartMessage({ kind: "use", name: t.name }));
3893
3910
  this.push({ kind: "tool.call", id, toolId: t.id, prompt, args: callArgs });
3894
3911
  return formatToolResult(t, await wait, this.cwd);
3895
3912
  }
@@ -3901,7 +3918,7 @@ var SessionToolRunner = class {
3901
3918
  const callArgs2 = toolCallArgs(t, args2);
3902
3919
  if (t.askBeforeUse && !await this.approve(toolMcpName(t), { file: given, ...callArgs2 }, `${t.name}: ${given}`)) return formatToolResult(t, { error: "The user declined this tool call.", files: [] });
3903
3920
  const id2 = newId();
3904
- const wait2 = this.waits.wait(id2, this.timeoutMs === TOOL_TIMEOUT_MS ? STT_TOOL_TIMEOUT_MS : this.timeoutMs);
3921
+ const wait2 = this.waits.wait(id2, this.timeoutMs === TOOL_TIMEOUT_MS ? STT_TOOL_TIMEOUT_MS : this.timeoutMs, restartMessage({ kind: "use", name: t.name }));
3905
3922
  this.push({ kind: "tool.call", id: id2, toolId: t.id, prompt: "", args: callArgs2, attachmentId: attachment });
3906
3923
  return formatToolResult(t, await wait2, this.cwd);
3907
3924
  }
@@ -3913,14 +3930,14 @@ var SessionToolRunner = class {
3913
3930
  if (!ok) return formatToolResult(t, { error: "The user declined this tool call.", files: [] });
3914
3931
  }
3915
3932
  const id = newId();
3916
- const wait = this.waits.wait(id, this.timeoutMs === TOOL_TIMEOUT_MS ? STT_TOOL_TIMEOUT_MS : this.timeoutMs);
3933
+ const wait = this.waits.wait(id, this.timeoutMs === TOOL_TIMEOUT_MS ? STT_TOOL_TIMEOUT_MS : this.timeoutMs, restartMessage({ kind: "use", name: t.name }));
3917
3934
  this.push({ kind: "tool.call", id, toolId: t.id, prompt: "", args: callArgs, file: file.path });
3918
3935
  return formatToolResult(t, await wait, this.cwd);
3919
3936
  }
3920
3937
  /** `find_tools`: the server's list, as the JSON text it sent. */
3921
3938
  async find(args2) {
3922
3939
  const id = newId();
3923
- const wait = this.waits.wait(id, this.timeoutMs === TOOL_TIMEOUT_MS ? FIND_TOOLS_TIMEOUT_MS : this.timeoutMs);
3940
+ const wait = this.waits.wait(id, this.timeoutMs === TOOL_TIMEOUT_MS ? FIND_TOOLS_TIMEOUT_MS : this.timeoutMs, restartMessage({ kind: "find" }));
3924
3941
  this.push({ kind: "tools.find", id, ...args2.query?.trim() ? { query: args2.query.trim() } : {}, ...typeof args2.limit === "number" ? { limit: args2.limit } : {} });
3925
3942
  const r = await wait;
3926
3943
  return r.error ? { content: [{ type: "text", text: r.error }], isError: true } : { content: [{ type: "text", text: r.text ?? "" }] };
@@ -3944,7 +3961,7 @@ var SessionToolRunner = class {
3944
3961
  let file;
3945
3962
  for (let round2 = 0; round2 < 3; round2++) {
3946
3963
  const id = newId();
3947
- const wait = this.waits.wait(id, this.timeoutMs === TOOL_TIMEOUT_MS ? USE_TOOL_TIMEOUT_MS : this.timeoutMs);
3964
+ const wait = this.waits.wait(id, this.timeoutMs === TOOL_TIMEOUT_MS ? USE_TOOL_TIMEOUT_MS : this.timeoutMs, restartMessage({ kind: "use", name }));
3948
3965
  this.push({ kind: "tool.use", id, name, input, ...approved ? { approved } : {}, ...file ? { file } : {} });
3949
3966
  const r = await wait;
3950
3967
  if (!r.next) return formatUseResult(name, r, this.cwd);
@@ -3964,6 +3981,10 @@ var SessionToolRunner = class {
3964
3981
  result(id, r) {
3965
3982
  this.waits.resolve(id, r);
3966
3983
  }
3984
+ /** The connection to the service closed: every waiting call ends now (bug: a tool call lost in a server restart). */
3985
+ failWaiting() {
3986
+ this.waits.failWaiting();
3987
+ }
3967
3988
  close() {
3968
3989
  this.waits.closeAll();
3969
3990
  }
@@ -4047,6 +4068,76 @@ var SessionManager = class {
4047
4068
  openGroupIds() {
4048
4069
  return [...this.live.keys()];
4049
4070
  }
4071
+ /**
4072
+ * An update is due (bug draft-2026-11-26-bug-a-machine-with-agents-always-working-never-updates): no new turn starts
4073
+ * until it has run, so the machine drains in at most one turn's length. A message to a session that is not mid-turn
4074
+ * is kept here, with its session as the service opened it; the service acknowledged it, so this machine owns its
4075
+ * delivery: when the hold is released (the update failed or was withdrawn) it is delivered here, and across the
4076
+ * restart it is written to a file the new program reads. A message to a running turn still joins it.
4077
+ */
4078
+ hold = null;
4079
+ held = [];
4080
+ /** Stopping (an update's restart, a shutdown): nothing new is taken; the client acknowledges nothing from then on. */
4081
+ stopping = false;
4082
+ holdNewTurns(reason) {
4083
+ if (this.hold) return;
4084
+ this.hold = reason;
4085
+ log("info", `holding new turns: ${reason}`);
4086
+ }
4087
+ releaseNewTurns() {
4088
+ if (!this.hold) return;
4089
+ log("info", `new turns go again (${this.held.length} message${this.held.length === 1 ? "" : "s"} waited)`);
4090
+ this.hold = null;
4091
+ const waiting = this.held.splice(0);
4092
+ for (const h of waiting) void this.inbound(h.groupId, h.message, h.opts);
4093
+ }
4094
+ get holding() {
4095
+ return this.hold !== null;
4096
+ }
4097
+ /** From here on no inbound is acknowledged or taken: the service keeps it and sends it again to the next program. */
4098
+ beginStop() {
4099
+ this.stopping = true;
4100
+ }
4101
+ get refusing() {
4102
+ return this.stopping;
4103
+ }
4104
+ /** Whether a message for this group would be kept rather than start a turn: the hold is on and the session is not mid-turn, or we are stopping. */
4105
+ wouldHold(groupId) {
4106
+ if (this.stopping) return true;
4107
+ const live = this.live.get(groupId);
4108
+ return this.hold !== null && !live?.busy;
4109
+ }
4110
+ heldCount() {
4111
+ return this.held.length;
4112
+ }
4113
+ /** The groups mid-turn right now. */
4114
+ busyGroupIds() {
4115
+ return [...this.live.values()].filter((l) => l.busy).map((l) => l.groupId);
4116
+ }
4117
+ /** The session of a group as the service opened it (provider, folder, settings, account, the provider session to resume), for a message carried across a restart. */
4118
+ openFrameOf(groupId) {
4119
+ const live = this.live.get(groupId);
4120
+ if (!live) return null;
4121
+ return { t: "session.open", groupId, provider: live.providerId, cwd: live.cwd, settings: live.settings, ...live.accountId ? { providerAccountId: live.accountId } : {}, ...live.providerSessionId ?? live.resumeId ? { resumeId: live.providerSessionId ?? live.resumeId } : {} };
4122
+ }
4123
+ /**
4124
+ * The held messages, each with its session, for the program that takes over after the restart. Taken, not copied:
4125
+ * nothing is delivered twice. Call it after `closeAll` (with `beginStop` before): nothing can be kept after that.
4126
+ */
4127
+ heldForRestart() {
4128
+ return this.held.splice(0).map((h) => ({ open: h.open, groupId: h.groupId, message: h.message, opts: h.opts }));
4129
+ }
4130
+ /** After a restart: open each held message's session as it was, then deliver the message (a repeat is ignored as always). */
4131
+ async deliverHeld(records) {
4132
+ for (const r of records) {
4133
+ try {
4134
+ if (r.open && !this.live.has(r.groupId)) await this.open(r.open);
4135
+ await this.inbound(r.groupId, r.message, r.opts);
4136
+ } catch (e) {
4137
+ log("warn", `[${r.groupId.slice(0, 8)}] could not deliver a message held through the restart: ${e.message}`);
4138
+ }
4139
+ }
4140
+ }
4050
4141
  /** Sessions currently mid-turn (a message sent, no `done` yet). */
4051
4142
  busyCount() {
4052
4143
  return [...this.live.values()].filter((l) => l.busy).length;
@@ -4199,6 +4290,11 @@ var SessionManager = class {
4199
4290
  return this.inLane(groupId, () => this.inboundNow(groupId, message, opts));
4200
4291
  }
4201
4292
  async inboundNow(groupId, message, opts = {}) {
4293
+ if (this.wouldHold(groupId)) {
4294
+ if (!this.held.some((h) => h.message.id === message.id)) this.held.push({ groupId, message, opts, open: this.openFrameOf(groupId) });
4295
+ log("info", `[${groupId.slice(0, 8)}] holding message ${message.id.slice(0, 8)} until the update has run`);
4296
+ return;
4297
+ }
4202
4298
  if (!this.firstDelivery(groupId, message.id)) {
4203
4299
  log("info", `ignored a repeat of message ${message.id.slice(0, 8)} for ${groupId.slice(0, 8)}`);
4204
4300
  return;
@@ -4249,6 +4345,10 @@ var SessionManager = class {
4249
4345
  this.emit(groupId, { kind: "error", message: e.message, fatal: false });
4250
4346
  }
4251
4347
  }
4348
+ /** The connection to the service closed: every session's waiting calls end now (bug: a tool call lost in a server restart). */
4349
+ connectionLost() {
4350
+ for (const l of this.live.values()) l.session.connectionLost?.();
4351
+ }
4252
4352
  /** The server's answer to an `agent.send` or `agents.list` event. */
4253
4353
  agentResult(groupId, id, result) {
4254
4354
  this.live.get(groupId)?.session.agentResult?.(id, result);
@@ -4590,7 +4690,7 @@ function guessMime(name) {
4590
4690
  }
4591
4691
 
4592
4692
  // src/version.ts
4593
- var APP_VERSION = true ? "1.0.18" : fromPackage();
4693
+ var APP_VERSION = true ? "1.0.20" : fromPackage();
4594
4694
 
4595
4695
  // src/diag.ts
4596
4696
  var MAX_HELD = 200;
@@ -4780,13 +4880,17 @@ var HostClient = class {
4780
4880
  this.watchConfig();
4781
4881
  void this.connect();
4782
4882
  }
4883
+ /** Inbound messages acknowledged and still being handed to their session: a stop waits for them, so none is lost. */
4884
+ inFlight = /* @__PURE__ */ new Set();
4783
4885
  async stop() {
4784
4886
  this.stopped = true;
4887
+ this.sessions.beginStop();
4785
4888
  if (this.heartbeat) clearInterval(this.heartbeat);
4786
4889
  if (this.modulesTimer) clearTimeout(this.modulesTimer);
4787
4890
  if (this.watching) fs16.unwatchFile(configPath());
4788
4891
  this.watching = false;
4789
4892
  this.clearTimers();
4893
+ await Promise.allSettled([...this.inFlight]);
4790
4894
  await this.sessions.closeAll();
4791
4895
  this.ws?.close(1e3, "shutdown");
4792
4896
  }
@@ -4860,6 +4964,7 @@ var HostClient = class {
4860
4964
  ws.on("close", (code, reason) => {
4861
4965
  if (this.ws !== ws) return;
4862
4966
  this.onState("offline");
4967
+ this.sessions.connectionLost();
4863
4968
  if (this.heartbeat) clearInterval(this.heartbeat);
4864
4969
  this.clearTimers();
4865
4970
  if (code === 4001) {
@@ -4971,10 +5076,18 @@ var HostClient = class {
4971
5076
  case "session.open":
4972
5077
  await this.sessions.open(frame);
4973
5078
  return;
4974
- case "inbound":
5079
+ case "inbound": {
5080
+ if (this.sessions.refusing) return;
4975
5081
  this.send({ t: "ack", id: frame.message.id });
4976
- await this.sessions.inbound(frame.groupId, frame.delivery ? { ...frame.message, delivery: frame.delivery } : frame.message, { cwd: frame.cwd, providerAccountId: frame.providerAccountId });
5082
+ const delivery = this.sessions.inbound(frame.groupId, frame.delivery ? { ...frame.message, delivery: frame.delivery } : frame.message, { cwd: frame.cwd, providerAccountId: frame.providerAccountId });
5083
+ this.inFlight.add(delivery);
5084
+ try {
5085
+ await delivery;
5086
+ } finally {
5087
+ this.inFlight.delete(delivery);
5088
+ }
4977
5089
  return;
5090
+ }
4978
5091
  case "approval.answer":
4979
5092
  this.sessions.answerApproval(frame.groupId, frame.id, frame.allow, frame.updatedInput);
4980
5093
  return;
@@ -5399,6 +5512,8 @@ function nodeInstallHint(platform) {
5399
5512
  }
5400
5513
  var CHECK_EVERY_MS = 6 * 60 * 6e4;
5401
5514
  var RETRY_WHEN_BUSY_MS = 10 * 6e4;
5515
+ var RETRY_WHEN_HOLDING_MS = 5e3;
5516
+ var HOLD_MAX_MS = 30 * 6e4;
5402
5517
  var BACKGROUND_WAIT_MS = 30 * 6e4;
5403
5518
  function updateWait(busy2, background, since, now) {
5404
5519
  if (busy2) return { wait: true, why: "turn", since };
@@ -5583,30 +5698,80 @@ async function ensureUpToDate(routerUrl, opts) {
5583
5698
  await reexec();
5584
5699
  return "ok";
5585
5700
  }
5586
- function startPeriodicChecks(routerUrl, hooks) {
5701
+ var POLICY_REFRESH_MS = 5 * 6e4;
5702
+ function startPeriodicChecks(routerUrl, hooks, deps = { fetchPolicy, ensureUpToDate }) {
5587
5703
  let timer = null;
5588
5704
  let backgroundSince = null;
5705
+ let holding = false;
5706
+ let holdingSince = null;
5707
+ let longRunning = null;
5708
+ let cached2 = null;
5709
+ const clock = deps.now ?? Date.now;
5589
5710
  const schedule = (ms) => {
5590
5711
  if (timer) clearTimeout(timer);
5591
5712
  timer = setTimeout(tick, ms);
5592
5713
  timer.unref();
5593
5714
  };
5715
+ const hold = (to, now) => {
5716
+ if (holding) return;
5717
+ holding = true;
5718
+ holdingSince = now;
5719
+ hooks.holdNewTurns?.(`update to ${to}`);
5720
+ };
5721
+ const release = () => {
5722
+ if (!holding) return;
5723
+ holding = false;
5724
+ holdingSince = null;
5725
+ hooks.releaseNewTurns?.();
5726
+ };
5727
+ const readPolicy = async (now) => {
5728
+ if (holding && cached2 && now - cached2.at < POLICY_REFRESH_MS) return cached2.policy;
5729
+ const fetched = await deps.fetchPolicy(routerUrl);
5730
+ if (fetched) {
5731
+ cached2 = { policy: fetched, at: now };
5732
+ return fetched;
5733
+ }
5734
+ if (holding && cached2) {
5735
+ log("warn", "could not read the update policy; keeping the update that is due");
5736
+ return cached2.policy;
5737
+ }
5738
+ return null;
5739
+ };
5594
5740
  const tick = async () => {
5595
5741
  try {
5596
- const policy = await fetchPolicy(routerUrl);
5597
- const d = policy ? decideUpdate(APP_VERSION, policy, detectInstallMode(), { disabled: updatesDisabled() }) : { action: "none" };
5742
+ const now = clock();
5743
+ const policy = await readPolicy(now);
5744
+ const d = policy ? decideUpdate(APP_VERSION, policy, (deps.installMode ?? detectInstallMode)(), { disabled: updatesDisabled() }) : { action: "none" };
5598
5745
  if (d.action === "update") {
5599
- const w = updateWait(hooks.isBusy(), hooks.hasBackground?.() ?? false, backgroundSince, Date.now());
5746
+ const w = updateWait(hooks.isBusy(), hooks.hasBackground?.() ?? false, backgroundSince, now);
5600
5747
  backgroundSince = w.since;
5601
5748
  if (w.wait) {
5602
- log("info", w.why === "background" ? `update to ${d.to} is waiting for an agent's background work (up to ${BACKGROUND_WAIT_MS / 6e4} minutes)` : `update to ${d.to} is waiting for the current turn to finish`);
5603
- return schedule(RETRY_WHEN_BUSY_MS);
5749
+ if (longRunning) {
5750
+ if ((hooks.busyGroups?.() ?? []).some((g) => longRunning.has(g))) return schedule(RETRY_WHEN_BUSY_MS);
5751
+ longRunning = null;
5752
+ }
5753
+ if (!holding) {
5754
+ hold(d.to, now);
5755
+ log("info", `update to ${d.to} is waiting for ${w.why === "background" ? "an agent's background work" : "the current turn"} to finish; no new turn starts until it has run`);
5756
+ } else if (holdingSince !== null && now - holdingSince >= HOLD_MAX_MS) {
5757
+ log("warn", `update to ${d.to}: new turns were held for ${Math.round(HOLD_MAX_MS / 6e4)} minutes; they go again, and the update waits for a quiet moment`);
5758
+ if (w.why === "turn") longRunning = new Set(hooks.busyGroups?.() ?? []);
5759
+ release();
5760
+ return schedule(RETRY_WHEN_BUSY_MS);
5761
+ }
5762
+ return schedule(RETRY_WHEN_HOLDING_MS);
5604
5763
  }
5605
- await ensureUpToDate(routerUrl, { reason: "periodic check", onBeforeRestart: hooks.onBeforeRestart, afterInstall: hooks.afterInstall });
5606
- return;
5764
+ hold(d.to, now);
5765
+ await deps.ensureUpToDate(routerUrl, { reason: "periodic check", onBeforeRestart: hooks.onBeforeRestart, afterInstall: hooks.afterInstall });
5766
+ release();
5767
+ longRunning = null;
5768
+ return schedule(CHECK_EVERY_MS);
5607
5769
  }
5770
+ release();
5771
+ longRunning = null;
5608
5772
  if (d.action === "block") hooks.onError(new Error(d.reason));
5609
5773
  } catch (e) {
5774
+ release();
5610
5775
  hooks.onError(e);
5611
5776
  }
5612
5777
  schedule(CHECK_EVERY_MS);
@@ -5803,7 +5968,7 @@ var EchoSession = class {
5803
5968
  const id = newId();
5804
5969
  const r = await new Promise((res) => {
5805
5970
  const t = setTimeout(() => res({ error: "no answer from the router" }), 5e3);
5806
- this.agentWaits.set(id, (x) => (clearTimeout(t), res(x)));
5971
+ this.agentWaits.set(id, { finish: (x) => (clearTimeout(t), res(x)), lost: restartMessage({ kind: "send", to: to.trim() }) });
5807
5972
  this.q.push({ kind: "agent.send", id, to: to.trim(), text: rest.join(":").trim() });
5808
5973
  });
5809
5974
  this.agentWaits.delete(id);
@@ -5815,7 +5980,7 @@ var EchoSession = class {
5815
5980
  const id = newId();
5816
5981
  const r = await new Promise((res) => {
5817
5982
  const t = setTimeout(() => res({ error: "no answer from the router" }), 5e3);
5818
- this.agentWaits.set(id, (x) => (clearTimeout(t), res(x)));
5983
+ this.agentWaits.set(id, { finish: (x) => (clearTimeout(t), res(x)), lost: restartMessage({ kind: "list" }) });
5819
5984
  this.q.push({ kind: "agents.list", id });
5820
5985
  });
5821
5986
  this.agentWaits.delete(id);
@@ -5915,11 +6080,15 @@ ${r.text}`, final: true });
5915
6080
  this.pending.delete(id);
5916
6081
  }
5917
6082
  agentResult(id, result) {
5918
- this.agentWaits.get(id)?.(result);
6083
+ this.agentWaits.get(id)?.finish(result);
5919
6084
  }
5920
6085
  toolResult(id, result) {
5921
6086
  this.tools.result(id, result);
5922
6087
  }
6088
+ connectionLost() {
6089
+ for (const w of [...this.agentWaits.values()]) w.finish({ error: w.lost });
6090
+ this.tools.failWaiting();
6091
+ }
5923
6092
  async interrupt() {
5924
6093
  this.abort?.abort();
5925
6094
  }
@@ -6270,6 +6439,7 @@ var ClaudeSession = class {
6270
6439
  /** tool_use id → tool name, so a result can be named. */
6271
6440
  toolNames = /* @__PURE__ */ new Map();
6272
6441
  /** `send` and `list_agents` calls waiting for the server's `agent.send.result`. */
6442
+ /** `send` and `list_agents` calls waiting for the service, each with what to say if the connection is lost meanwhile. */
6273
6443
  agentWaits = /* @__PURE__ */ new Map();
6274
6444
  /** The agent's tools: calls waiting for the server's `tool.result`. */
6275
6445
  tools;
@@ -6343,7 +6513,7 @@ var ClaudeSession = class {
6343
6513
  this.agentWaits.delete(id);
6344
6514
  resolve(r2);
6345
6515
  };
6346
- this.agentWaits.set(id, finish);
6516
+ this.agentWaits.set(id, { finish, lost: restartMessage({ kind: "list" }) });
6347
6517
  });
6348
6518
  this.q.push({ kind: "agents.list", id });
6349
6519
  const r = await result;
@@ -6364,7 +6534,7 @@ var ClaudeSession = class {
6364
6534
  this.agentWaits.delete(id);
6365
6535
  resolve(r);
6366
6536
  };
6367
- this.agentWaits.set(id, finish);
6537
+ this.agentWaits.set(id, { finish, lost: restartMessage({ kind: "send", to: args2.to }) });
6368
6538
  });
6369
6539
  this.q.push({ kind: "agent.send", id, to: args2.to, text: args2.text });
6370
6540
  return sendToolResult(args2, await result);
@@ -6582,11 +6752,16 @@ ${files.map((a) => `- ${a.localPath} (${a.mime}, ${a.size} bytes)${a.note ? `: $
6582
6752
  f(allow ? { behavior: "allow", updatedInput } : { behavior: "deny", message: "The user declined this action in the chat." });
6583
6753
  }
6584
6754
  agentResult(id, result) {
6585
- this.agentWaits.get(id)?.(result);
6755
+ this.agentWaits.get(id)?.finish(result);
6586
6756
  }
6587
6757
  toolResult(id, result) {
6588
6758
  this.tools.result(id, result);
6589
6759
  }
6760
+ /** The machine's connection to the service closed: what was waiting for it ends now, each call with its own words. */
6761
+ connectionLost() {
6762
+ for (const w of [...this.agentWaits.values()]) w.finish({ error: w.lost });
6763
+ this.tools.failWaiting();
6764
+ }
6590
6765
  /**
6591
6766
  * When we last asked the run to stop. The result that follows within a minute is a stop, whatever it calls itself
6592
6767
  * (a stop asked for while nothing ran must not hide a later run's real error, hence the limit).
@@ -6621,7 +6796,7 @@ ${files.map((a) => `- ${a.localPath} (${a.mime}, ${a.size} bytes)${a.note ? `: $
6621
6796
  this.closed = true;
6622
6797
  liveBackground.delete(this.opts.groupId);
6623
6798
  for (const f of this.pending.values()) f({ behavior: "deny", message: "Session closed." });
6624
- for (const f of this.agentWaits.values()) f({ error: "Session closed." });
6799
+ for (const w of this.agentWaits.values()) w.finish({ error: "Session closed." });
6625
6800
  this.tools.close();
6626
6801
  this.prompts.close();
6627
6802
  await this.query?.interrupt().catch(() => {
@@ -6705,23 +6880,23 @@ function friendlyPath(p, cwd) {
6705
6880
  var clip = (s, n) => s.length > n ? `${s.slice(0, n - 1)}\u2026` : s;
6706
6881
  function describeTool(name, input, cwd) {
6707
6882
  const s = (k) => typeof input[k] === "string" ? input[k] : void 0;
6708
- const path23 = (k) => friendlyPath(s(k), cwd);
6883
+ const path24 = (k) => friendlyPath(s(k), cwd);
6709
6884
  const firstString = () => Object.values(input).find((v) => typeof v === "string" && v.trim().length > 0);
6710
6885
  switch (name) {
6711
6886
  case "Bash":
6712
6887
  return clip(s("description") ?? s("command") ?? "run a command", 120);
6713
6888
  case "Read":
6714
- return `Read ${path23("file_path") || path23("path")}`.trim();
6889
+ return `Read ${path24("file_path") || path24("path")}`.trim();
6715
6890
  case "Edit":
6716
6891
  case "Write":
6717
6892
  case "MultiEdit":
6718
- return `${name} ${path23("file_path")}`.trim();
6893
+ return `${name} ${path24("file_path")}`.trim();
6719
6894
  case "NotebookEdit":
6720
- return `Edit notebook ${path23("notebook_path")}`.trim();
6895
+ return `Edit notebook ${path24("notebook_path")}`.trim();
6721
6896
  case "Grep":
6722
- return `Grep "${clip(s("pattern") ?? "", 60)}"${s("path") ? ` in ${path23("path")}` : ""}`;
6897
+ return `Grep "${clip(s("pattern") ?? "", 60)}"${s("path") ? ` in ${path24("path")}` : ""}`;
6723
6898
  case "Glob":
6724
- return `Find ${clip(s("pattern") ?? "", 60)}${s("path") ? ` in ${path23("path")}` : ""}`;
6899
+ return `Find ${clip(s("pattern") ?? "", 60)}${s("path") ? ` in ${path24("path")}` : ""}`;
6725
6900
  case "WebSearch":
6726
6901
  return `Search "${clip(s("query") ?? "", 80)}"`;
6727
6902
  case "WebFetch": {
@@ -7086,6 +7261,36 @@ function startedByHand(foreground, env, isTTY) {
7086
7261
  return true;
7087
7262
  }
7088
7263
 
7264
+ // src/held.ts
7265
+ import fs22 from "node:fs";
7266
+ import path22 from "node:path";
7267
+ var heldFile = (dir = configDir()) => path22.join(dir, "held-messages.json");
7268
+ function saveHeld(records, dir = configDir()) {
7269
+ if (!records.length) return;
7270
+ fs22.mkdirSync(dir, { recursive: true });
7271
+ const f = heldFile(dir);
7272
+ const tmp = `${f}.${process.pid}.part`;
7273
+ fs22.writeFileSync(tmp, JSON.stringify({ savedAt: (/* @__PURE__ */ new Date()).toISOString(), records }), { mode: 384 });
7274
+ fs22.chmodSync(tmp, 384);
7275
+ fs22.renameSync(tmp, f);
7276
+ log("info", `kept ${records.length} held message${records.length === 1 ? "" : "s"} for after the restart`);
7277
+ }
7278
+ function loadHeld(dir = configDir()) {
7279
+ const f = heldFile(dir);
7280
+ if (!fs22.existsSync(f)) return { records: [], problem: null };
7281
+ try {
7282
+ const parsed = JSON.parse(fs22.readFileSync(f, "utf8"));
7283
+ const records = Array.isArray(parsed.records) ? parsed.records : null;
7284
+ if (!records) return { records: [], problem: "the held-messages file had no list of messages" };
7285
+ const good = records.filter((r) => !!r && typeof r === "object" && typeof r.groupId === "string" && !!r.message && typeof r.message.id === "string");
7286
+ return { records: good, problem: good.length === records.length ? null : `${records.length - good.length} of ${records.length} held messages could not be read` };
7287
+ } catch (e) {
7288
+ return { records: [], problem: `the held-messages file could not be read: ${e.message}` };
7289
+ } finally {
7290
+ fs22.rmSync(f, { force: true });
7291
+ }
7292
+ }
7293
+
7089
7294
  // src/cli.ts
7090
7295
  import { spawn as spawn5 } from "node:child_process";
7091
7296
  import os9 from "node:os";
@@ -7132,7 +7337,7 @@ program.command("enrol [token]").description("Connect this machine to your MonoC
7132
7337
  const preview = await previewToken(opts.router, token, profiles.map((p) => p.config?.hostId ?? "").filter(Boolean), opts.insecure);
7133
7338
  const plan = planEnrol(preview, profiles, opts.router, { requestedProfile: currentProfile(), defaultName: os9.hostname() });
7134
7339
  const report = (profile) => {
7135
- if (process.env.MONOCLAW_CONNECT) fs22.writeFileSync(connectResultPath(), JSON.stringify({ profile, at: (/* @__PURE__ */ new Date()).toISOString() }), { mode: 384 });
7340
+ if (process.env.MONOCLAW_CONNECT) fs23.writeFileSync(connectResultPath(), JSON.stringify({ profile, at: (/* @__PURE__ */ new Date()).toISOString() }), { mode: 384 });
7136
7341
  };
7137
7342
  if (plan.action === "already") {
7138
7343
  console.log(plan.message);
@@ -7149,16 +7354,16 @@ program.command("enrol [token]").description("Connect this machine to your MonoC
7149
7354
  }
7150
7355
  if (plan.profile) process.env.MONOCLAW_PROFILE = assertProfileName(plan.profile);
7151
7356
  const existing = loadConfig();
7152
- const roots2 = opts.root?.map((r) => path22.resolve(r)) ?? existing?.roots ?? plan.copyRootsFrom ?? [];
7357
+ const roots2 = opts.root?.map((r) => path23.resolve(r)) ?? existing?.roots ?? plan.copyRootsFrom ?? [];
7153
7358
  const unsafe = roots2.filter((r) => rootExposesConfig(r, configDir()));
7154
7359
  if (unsafe.length) {
7155
7360
  console.error(`Not exposing ${unsafe.join(", ")}: it contains this host's config folder (${configDir()}), so agents could change the machine's MonoClaw settings or read its keys. Pass a folder inside it instead, such as --root ~/command.`);
7156
7361
  process.exit(2);
7157
7362
  }
7158
7363
  for (const r of opts.root ? roots2 : []) {
7159
- if (fs22.existsSync(r)) continue;
7364
+ if (fs23.existsSync(r)) continue;
7160
7365
  try {
7161
- fs22.mkdirSync(r, { recursive: true });
7366
+ fs23.mkdirSync(r, { recursive: true });
7162
7367
  console.log(`Created ${r} for your agents to work in.`);
7163
7368
  } catch (e) {
7164
7369
  console.error(`Could not create ${r}: ${e.message}. Create it yourself, or add another folder with: ${cmd("roots add <folder>")}`);
@@ -7167,7 +7372,7 @@ program.command("enrol [token]").description("Connect this machine to your MonoC
7167
7372
  const cfg = await enrol(token, opts.router, { name: opts.name ?? (plan.reason === "second-space" ? plan.nameHint ?? void 0 : void 0), roots: roots2, insecure: opts.insecure });
7168
7373
  console.log(`Enrolled as "${cfg.name}"${cfg.spaceName ? ` in ${cfg.spaceName} (@${cfg.spaceHandle})` : ""}${currentProfile() ? ` under the profile "${currentProfile()}"` : ""}. Config saved to ${configPath()}.`);
7169
7374
  if (plan.reason === "second-space") {
7170
- fs22.writeFileSync(pendingServicePath(), JSON.stringify({ profile: currentProfile(), at: (/* @__PURE__ */ new Date()).toISOString() }), { mode: 384 });
7375
+ fs23.writeFileSync(pendingServicePath(), JSON.stringify({ profile: currentProfile(), at: (/* @__PURE__ */ new Date()).toISOString() }), { mode: 384 });
7171
7376
  console.log(`This computer now runs one machine per space; its modules and Claude login are shared. The first enrolment is untouched.`);
7172
7377
  }
7173
7378
  if (!cfg.roots.length) console.log(`No folders exposed yet. Add one with: ${cmd("roots add ~/command")}`);
@@ -7253,7 +7458,7 @@ provider.command("add <name>").description("Add a Claude connection; an api_key
7253
7458
  const { registry, accounts } = await makeContext(requireConfig());
7254
7459
  const moduleId = opts.type === "api_key" ? "claude-api" : "claude-subscription";
7255
7460
  if (!registry.isInstalled(moduleId)) await registry.add(moduleId).install;
7256
- const folders = opts.folders?.map((f) => path22.resolve(f.replace(/^~(?=$|\/)/, process.env.HOME ?? "")));
7461
+ const folders = opts.folders?.map((f) => path23.resolve(f.replace(/^~(?=$|\/)/, process.env.HOME ?? "")));
7257
7462
  if (opts.type === "api_key") {
7258
7463
  const id = await connectModule(registry, accounts, moduleId, io, { name, id: opts.id });
7259
7464
  if (folders) accounts.upsert({ ...accounts.get(id), allowedFolders: folders });
@@ -7282,18 +7487,18 @@ var roots = program.command("roots").description("Folders this machine exposes t
7282
7487
  roots.command("list").action(() => {
7283
7488
  const cfg = requireConfig();
7284
7489
  if (!cfg.roots.length) console.log("(none) \u2014 add one with: monoclaw roots add <path>");
7285
- for (const r of cfg.roots) console.log(`${fs22.existsSync(r) ? "\u2713" : "\u2717 (missing)"} ${r}`);
7490
+ for (const r of cfg.roots) console.log(`${fs23.existsSync(r) ? "\u2713" : "\u2717 (missing)"} ${r}`);
7286
7491
  });
7287
7492
  roots.command("add <path...>").action((paths) => {
7288
7493
  const cfg = requireConfig();
7289
7494
  for (const p of paths) {
7290
- const full = path22.resolve(p.replace(/^~(?=$|\/)/, process.env.HOME ?? ""));
7291
- if (!fs22.existsSync(full) || !fs22.statSync(full).isDirectory()) {
7495
+ const full = path23.resolve(p.replace(/^~(?=$|\/)/, process.env.HOME ?? ""));
7496
+ if (!fs23.existsSync(full) || !fs23.statSync(full).isDirectory()) {
7292
7497
  console.error(`not a folder: ${full}`);
7293
7498
  continue;
7294
7499
  }
7295
7500
  if (rootExposesConfig(full, configDir())) {
7296
- console.error(`not adding ${full}: it contains this host's config folder (${configDir()}), so agents could change the machine's MonoClaw settings or read its keys. Add a folder inside it, such as ${path22.join(full, "command")}.`);
7501
+ console.error(`not adding ${full}: it contains this host's config folder (${configDir()}), so agents could change the machine's MonoClaw settings or read its keys. Add a folder inside it, such as ${path23.join(full, "command")}.`);
7297
7502
  process.exitCode = 1;
7298
7503
  continue;
7299
7504
  }
@@ -7306,7 +7511,7 @@ Restart the host for the change to reach the app.`);
7306
7511
  });
7307
7512
  roots.command("remove <path>").action((p) => {
7308
7513
  const cfg = requireConfig();
7309
- const full = path22.resolve(p);
7514
+ const full = path23.resolve(p);
7310
7515
  cfg.roots = cfg.roots.filter((r) => r !== full);
7311
7516
  saveConfig(cfg);
7312
7517
  console.log(`Exposed folders: ${cfg.roots.join(", ") || "(none)"}`);
@@ -7341,7 +7546,7 @@ program.command("start", { hidden: true }).description("Run the host in this ter
7341
7546
  process.exit(1);
7342
7547
  }
7343
7548
  process.on("exit", lock.release);
7344
- setLogDir(path22.join(configDir(), "logs"));
7549
+ setLogDir(path23.join(configDir(), "logs"));
7345
7550
  const unsafe = loaded.roots.filter((r) => rootExposesConfig(r, configDir()));
7346
7551
  for (const r of unsafe) log("error", `not exposing ${r}: it contains this host's config folder (${configDir()}). Expose a folder inside it instead (\`monoclaw roots remove ${r}\`, then \`monoclaw roots add <folder>\`).`);
7347
7552
  const cfg = unsafe.length ? { ...loaded, roots: loaded.roots.filter((r) => !unsafe.includes(r)) } : loaded;
@@ -7361,6 +7566,21 @@ program.command("start", { hidden: true }).description("Run the host in this ter
7361
7566
  };
7362
7567
  const quiesce = async () => {
7363
7568
  await client.stop();
7569
+ saveHeld(client.sessions.heldForRestart());
7570
+ };
7571
+ let heldDelivered = false;
7572
+ const previousState = client.onState;
7573
+ client.onState = (s) => {
7574
+ previousState(s);
7575
+ if (s === "online" && !heldDelivered) {
7576
+ heldDelivered = true;
7577
+ const held = loadHeld();
7578
+ if (held.problem) {
7579
+ log("error", `held messages lost: ${held.problem}`);
7580
+ client.diag.report({ kind: "machine.held_messages_lost", level: "error", message: held.problem, data: { delivered: held.records.length } });
7581
+ }
7582
+ if (held.records.length) void client.sessions.deliverHeld(held.records);
7583
+ }
7364
7584
  };
7365
7585
  client.onUpgradeRequired = () => {
7366
7586
  ensureUpToDate(cfg.routerUrl, { reason: "router requires it", onBeforeRestart: quiesce }).catch((e) => {
@@ -7368,7 +7588,7 @@ program.command("start", { hidden: true }).description("Run the host in this ter
7368
7588
  process.exit(3);
7369
7589
  });
7370
7590
  };
7371
- const checks = startPeriodicChecks(cfg.routerUrl, { isBusy: () => client.sessions.busyCount() > 0, hasBackground: () => client.sessions.backgroundCount() > 0, onBeforeRestart: quiesce, onError: (e) => log("warn", `update check: ${e.message}`), afterInstall: repairBundledCli });
7591
+ const checks = startPeriodicChecks(cfg.routerUrl, { isBusy: () => client.sessions.busyCount() > 0, hasBackground: () => client.sessions.backgroundCount() > 0, onBeforeRestart: quiesce, onError: (e) => log("warn", `update check: ${e.message}`), afterInstall: repairBundledCli, holdNewTurns: (why) => client.sessions.holdNewTurns(why), releaseNewTurns: () => client.sessions.releaseNewTurns(), busyGroups: () => client.sessions.busyGroupIds() });
7372
7592
  const stopChecks = checks.stop;
7373
7593
  client.onReconnected = () => checks.checkSoon();
7374
7594
  client.start();
@@ -7376,6 +7596,7 @@ program.command("start", { hidden: true }).description("Run the host in this ter
7376
7596
  log("info", "shutting down");
7377
7597
  stopChecks();
7378
7598
  await client.stop();
7599
+ saveHeld(client.sessions.heldForRestart());
7379
7600
  process.exit(0);
7380
7601
  };
7381
7602
  process.on("SIGINT", shutdown);
@@ -7387,6 +7608,10 @@ program.command("start", { hidden: true }).description("Run the host in this ter
7387
7608
  });
7388
7609
  process.on("uncaughtException", (e) => {
7389
7610
  log("error", `an error nobody caught; stopping: ${e.stack ?? e.message}`);
7611
+ try {
7612
+ saveHeld(client.sessions.heldForRestart());
7613
+ } catch {
7614
+ }
7390
7615
  client.diag.report({ kind: "machine.crash", level: "error", message: `${e.name}: ${e.message}`.slice(0, 300) });
7391
7616
  void client.diag.flush().finally(() => process.exit(1));
7392
7617
  setTimeout(() => process.exit(1), 5e3).unref();
@@ -7442,14 +7667,14 @@ program.command("doctor").description("Check and repair what a working host need
7442
7667
  else if (!cfg) lines.push({ ok: false, info: true, what: "Not enrolled yet", fix: "Copy the command from Add a machine in the app: npx -y @monoclaw/machine@latest connect <token>" });
7443
7668
  else {
7444
7669
  lines.push({ ok: true, what: `Enrolled as "${cfg.name}" with ${cfg.routerUrl}` });
7445
- const missing = cfg.roots.filter((r) => !fs22.existsSync(r));
7670
+ const missing = cfg.roots.filter((r) => !fs23.existsSync(r));
7446
7671
  const exposing = cfg.roots.filter((r) => rootExposesConfig(r, configDir()));
7447
7672
  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>` });
7448
7673
  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 });
7449
7674
  const names = serviceNames();
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;
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` });
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 });
7675
+ const unit = process.platform === "darwin" ? path23.join(os9.homedir(), "Library", "LaunchAgents", `${names.label}.plist`) : process.platform === "linux" ? path23.join(os9.homedir(), ".config", "systemd", "user", `${names.unit}.service`) : null;
7676
+ if (unit) lines.push({ ok: fs23.existsSync(unit), info: true, what: fs23.existsSync(unit) ? `Background service installed (${unit})` : "Not running as a background service (fine for now)", fix: fs23.existsSync(unit) ? void 0 : `${cmd("service install")} to run at login` });
7677
+ if (unit && fs23.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 });
7453
7678
  const { registry } = await makeContext(cfg);
7454
7679
  await registry.refreshReadiness();
7455
7680
  const reports = registry.reports();
@@ -7524,16 +7749,16 @@ config.command("set <key> <value>").description("Keys: allowedPermissionModes (c
7524
7749
  });
7525
7750
  var service = program.command("service").description("Run the host in the background at login");
7526
7751
  service.command("install").description("Install and start the background service (re-run to restart it on the current version)").option("--print", "only write the service file and print the commands, without running them").action((o) => {
7527
- if (!currentProfile() && fs22.existsSync(pendingServicePath())) {
7752
+ if (!currentProfile() && fs23.existsSync(pendingServicePath())) {
7528
7753
  try {
7529
- const pending = JSON.parse(fs22.readFileSync(pendingServicePath(), "utf8"));
7754
+ const pending = JSON.parse(fs23.readFileSync(pendingServicePath(), "utf8"));
7530
7755
  if (pending.profile && Date.now() - Date.parse(pending.at ?? "") < 60 * 6e4) {
7531
7756
  process.env.MONOCLAW_PROFILE = assertProfileName(pending.profile);
7532
7757
  console.log(`Installing the service for the profile "${pending.profile}" (the enrolment just made). The first enrolment's service is untouched.`);
7533
7758
  }
7534
7759
  } catch {
7535
7760
  }
7536
- fs22.rmSync(pendingServicePath(), { force: true });
7761
+ fs23.rmSync(pendingServicePath(), { force: true });
7537
7762
  }
7538
7763
  requireConfig();
7539
7764
  if (o.print) {
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@monoclaw/machine",
3
- "version": "1.0.18",
3
+ "version": "1.0.20",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@monoclaw/machine",
9
- "version": "1.0.18",
9
+ "version": "1.0.20",
10
10
  "license": "UNLICENSED",
11
11
  "dependencies": {
12
12
  "@anthropic-ai/claude-agent-sdk": "0.3.302",
@@ -789,9 +789,9 @@
789
789
  }
790
790
  },
791
791
  "node_modules/hono": {
792
- "version": "4.13.22",
793
- "resolved": "https://registry.npmjs.org/hono/-/hono-4.13.22.tgz",
794
- "integrity": "sha512-wncKd5/40Pj8grx0RZ2fgNIicFEmVFwIHT5UFLTnphR8I6AQWFf9c2JoM6ZJ9g8y4pMzg3sNlCVNe0m2Yclg0Q==",
792
+ "version": "4.13.23",
793
+ "resolved": "https://registry.npmjs.org/hono/-/hono-4.13.23.tgz",
794
+ "integrity": "sha512-OS90dj7dcsftEEWCOef8jRbnHE5lbrOq0hNRqjSyPsOnaGZvvfof1KS05hQNb4kUOCfDq1mG3PmHoX37DMnHQg==",
795
795
  "license": "MIT",
796
796
  "engines": {
797
797
  "node": ">=16.9.0"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@monoclaw/machine",
3
- "version": "1.0.18",
3
+ "version": "1.0.20",
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": {