@monoclaw/machine 1.0.5 → 1.0.6

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
@@ -4238,7 +4238,7 @@ function guessMime(name) {
4238
4238
  }
4239
4239
 
4240
4240
  // src/version.ts
4241
- var APP_VERSION = true ? "1.0.5" : fromPackage();
4241
+ var APP_VERSION = true ? "1.0.6" : fromPackage();
4242
4242
 
4243
4243
  // src/client.ts
4244
4244
  var HEARTBEAT_MS = 2e4;
@@ -5721,6 +5721,12 @@ ${s.agentBrief.trim().slice(0, 4e3)}` : "",
5721
5721
  parts.push(notes.join("\n"));
5722
5722
  return parts.join("\n\n");
5723
5723
  }
5724
+ function runEnding(subtype, errors, stopRequested) {
5725
+ const errs = errors.length ? errors.join("; ") : subtype;
5726
+ const said = /interrupt/i.test(`${subtype} ${errs}`);
5727
+ if (stopRequested || subtype === "error_during_execution" && /interrupt/i.test(errs)) return { error: null, interrupted: true };
5728
+ return { error: `Run ended: ${errs}`.slice(0, 500), interrupted: said };
5729
+ }
5724
5730
  var ClaudeSession = class {
5725
5731
  constructor(opts) {
5726
5732
  this.opts = opts;
@@ -5945,10 +5951,14 @@ var ClaudeSession = class {
5945
5951
  if (msg.subtype === "success") {
5946
5952
  this.q.push({ kind: "usage", inputTokens: msg.usage?.input_tokens, outputTokens: msg.usage?.output_tokens, costUsd: msg.total_cost_usd, durationMs: msg.duration_ms, turns: msg.num_turns });
5947
5953
  } else {
5948
- const errs = "errors" in msg && Array.isArray(msg.errors) ? msg.errors.join("; ") : msg.subtype;
5949
- if (msg.subtype !== "error_during_execution" || !/interrupt/i.test(errs)) this.q.push({ kind: "error", message: `Run ended: ${errs}`.slice(0, 500), fatal: false });
5954
+ const end = runEnding(msg.subtype, "errors" in msg && Array.isArray(msg.errors) ? msg.errors : [], this.stopJustRequested());
5955
+ if (end.error) this.q.push({ kind: "error", message: end.error, fatal: false });
5956
+ this.q.push({ kind: "done", interrupted: end.interrupted });
5957
+ this.stopRequestedAt = 0;
5958
+ return;
5950
5959
  }
5951
- this.q.push({ kind: "done", interrupted: msg.subtype !== "success" && /interrupt/i.test(JSON.stringify(msg)) });
5960
+ this.q.push({ kind: "done", interrupted: false });
5961
+ this.stopRequestedAt = 0;
5952
5962
  return;
5953
5963
  }
5954
5964
  default:
@@ -5998,7 +6008,16 @@ ${files.map((a) => `- ${a.localPath} (${a.mime}, ${a.size} bytes)${a.note ? `: $
5998
6008
  toolResult(id, result) {
5999
6009
  this.tools.result(id, result);
6000
6010
  }
6011
+ /**
6012
+ * When we last asked the run to stop. The result that follows within a minute is a stop, whatever it calls itself
6013
+ * (a stop asked for while nothing ran must not hide a later run's real error, hence the limit).
6014
+ */
6015
+ stopRequestedAt = 0;
6016
+ stopJustRequested() {
6017
+ return this.stopRequestedAt > 0 && Date.now() - this.stopRequestedAt < 6e4;
6018
+ }
6001
6019
  async interrupt() {
6020
+ this.stopRequestedAt = Date.now();
6002
6021
  await this.query?.interrupt().catch(() => {
6003
6022
  });
6004
6023
  }
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@monoclaw/machine",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@monoclaw/machine",
9
- "version": "1.0.5",
9
+ "version": "1.0.6",
10
10
  "license": "UNLICENSED",
11
11
  "dependencies": {
12
12
  "@anthropic-ai/claude-agent-sdk": "0.3.302",
@@ -614,9 +614,9 @@
614
614
  }
615
615
  },
616
616
  "node_modules/express-rate-limit": {
617
- "version": "8.7.4",
618
- "resolved": "https://registry.npmjs.org/express-rate-limit/-/express-rate-limit-8.7.4.tgz",
619
- "integrity": "sha512-LKBXzX700wz3zAGNNmVnjRI5mEbYkLv7UbMI4+9Xa+JPcg2UZh6AgY/2CZh9RrJjFM5ttC/N1lD+KzyFoZITCw==",
617
+ "version": "8.7.5",
618
+ "resolved": "https://registry.npmjs.org/express-rate-limit/-/express-rate-limit-8.7.5.tgz",
619
+ "integrity": "sha512-wi+v38cx2EqD0JnhE/e74o5tFqKWUOAPFJIgyEiqJ8v2MNpoOAA3kI2hXYOI+YM+HE5yqbdAlVxm2GqOIeYOgA==",
620
620
  "license": "MIT",
621
621
  "dependencies": {
622
622
  "debug": "^4.4.3",
@@ -870,9 +870,9 @@
870
870
  "license": "ISC"
871
871
  },
872
872
  "node_modules/jose": {
873
- "version": "6.2.17",
874
- "resolved": "https://registry.npmjs.org/jose/-/jose-6.2.17.tgz",
875
- "integrity": "sha512-wOuK9V1yujQFH5S0ZWmLcDZN7+IKh9bUCC2ZPCf2HDlol3WWHy+PPyNjEI75FXRLMp3vDKQcupP59xhVU95hcg==",
873
+ "version": "6.2.18",
874
+ "resolved": "https://registry.npmjs.org/jose/-/jose-6.2.18.tgz",
875
+ "integrity": "sha512-doV4thUwgkrycJH4yLeqwTGIIZphHl+pk7CPReuMIhYhncmgzdko85MaCG4YQFTxqMFr1/oEH32tZuKKovcDEg==",
876
876
  "license": "MIT",
877
877
  "funding": {
878
878
  "url": "https://github.com/sponsors/panva"
@@ -1007,9 +1007,9 @@
1007
1007
  }
1008
1008
  },
1009
1009
  "node_modules/object-inspect": {
1010
- "version": "1.13.4",
1011
- "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz",
1012
- "integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==",
1010
+ "version": "1.14.0",
1011
+ "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.14.0.tgz",
1012
+ "integrity": "sha512-IVgHNlp/jwQX271+Xzoq9LZNTWXxZK+cEOrGBOBxXNbn7fapnZ+Ts6TVMgNOuAezwG2wdtnMX97tTPK6VEnuOQ==",
1013
1013
  "license": "MIT",
1014
1014
  "engines": {
1015
1015
  "node": ">= 0.4"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@monoclaw/machine",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
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": {