@ai-matrx/desktop-protocol 0.17.1 → 0.17.2

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.17.2
4
+
5
+ Automatic changed-only republish (docs/metadata drift since the last tag — see
6
+ `git diff npm/desktop-protocol/v0.17.1..npm/desktop-protocol/v0.17.2 -- apps/shared/desktop-protocol`).
7
+ No source changes intended and no consumer action required.
8
+
3
9
  ## 0.17.1
4
10
 
5
11
  - buildToolStatus: a uuid in a test name (the agent a chat proof ran) is not part of the proof's
@@ -14,6 +20,11 @@ Consumer action: none.
14
20
  every `refreshMs` while the page is visible, never while hidden, and at once on return. Matrx 2's
15
21
  screens each carried their own `setInterval` loop (five shapes); this is the one. Guard:
16
22
  `src/react.test.tsx` ("refreshMs polls while visible …").
23
+ - **Errors keep their code across built entries.** `DesktopProtocolError.from(caught)` recognises an
24
+ error thrown by a sibling entry's copy of the class (each built entry carries its own), so a
25
+ real `NOT_FOUND` "No file at that path" no longer surfaces as a generic `INTERNAL`. The hooks use
26
+ it, and `useDesktopAction` treats `CANCELLED` (the person pressed Stop) as no error. Guard:
27
+ `src/react.test.tsx` ("an error from another copy …").
17
28
  - **`useDesktopAction({ onDone })`: a screen's writes.** One `busy` flag and one typed error for
18
29
  create/save/remove/open, with a refetch after each success. Replaces the per-screen
19
30
  `busy`/`error` `useState` pairs. Guard: `src/react.test.tsx` ("useDesktopAction tracks busy …").
@@ -295,3 +306,4 @@ Defects found in the draft and fixed here (not preserved):
295
306
 
296
307
  None — new package.
297
308
 
309
+
package/dist/client.cjs CHANGED
@@ -34,7 +34,7 @@ module.exports = __toCommonJS(client_exports);
34
34
  var import_realtime = require("@ai-matrx/realtime");
35
35
 
36
36
  // src/error.ts
37
- var DesktopProtocolError = class extends Error {
37
+ var DesktopProtocolError = class _DesktopProtocolError extends Error {
38
38
  code;
39
39
  retryable;
40
40
  data;
@@ -45,6 +45,23 @@ var DesktopProtocolError = class extends Error {
45
45
  this.retryable = options.retryable ?? false;
46
46
  this.data = options.data;
47
47
  }
48
+ /**
49
+ * Any thrown value as a DesktopProtocolError, keeping its code, message and data. Each built entry
50
+ * (`.`, `./client`, `./react`) carries its own copy of this class, so `instanceof` alone misses an
51
+ * error thrown by a sibling entry and reports a real NOT_FOUND as INTERNAL; this checks the shape.
52
+ */
53
+ static from(caught) {
54
+ if (caught instanceof _DesktopProtocolError) return caught;
55
+ const e = caught;
56
+ if (e && typeof e === "object" && e.name === "DesktopProtocolError" && typeof e.code === "string") {
57
+ return new _DesktopProtocolError(e.code, typeof e.message === "string" ? e.message : String(e.code), {
58
+ retryable: e.retryable === true,
59
+ ...e.data && typeof e.data === "object" ? { data: e.data } : {},
60
+ cause: caught
61
+ });
62
+ }
63
+ return new _DesktopProtocolError("INTERNAL", caught instanceof Error ? caught.message : String(caught), { cause: caught });
64
+ }
48
65
  /** The wire body (ProtocolErrorBody) — what a core or relay sends for this error. */
49
66
  toBody() {
50
67
  return this.data === void 0 ? { code: this.code, message: this.message, retryable: this.retryable } : { code: this.code, message: this.message, retryable: this.retryable, data: this.data };