@ai-matrx/desktop-protocol 0.17.1 → 0.17.3

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,22 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.17.3
4
+ ### (protocol 1.7)
5
+
6
+ - **A window names the application that owns it.** `WindowInfo` gains `app` (the owning
7
+ application's display name, absent when the OS does not say) and `pid` (absent when unknown), on
8
+ `window.list`, `window.focus` and `window.move`. Both are optional on read (an older app omits
9
+ them) and `forPeer` strips them for a peer that negotiated below 1.7. Guard:
10
+ `src/versioning.test.ts` ("a window names its app from 1.7 …").
11
+
12
+ Consumer action: none (new optional fields; Matrx 2 core and its Windows screen read them).
13
+
14
+ ## 0.17.2
15
+
16
+ Automatic changed-only republish (docs/metadata drift since the last tag — see
17
+ `git diff npm/desktop-protocol/v0.17.1..npm/desktop-protocol/v0.17.2 -- apps/shared/desktop-protocol`).
18
+ No source changes intended and no consumer action required.
19
+
3
20
  ## 0.17.1
4
21
 
5
22
  - buildToolStatus: a uuid in a test name (the agent a chat proof ran) is not part of the proof's
@@ -14,6 +31,11 @@ Consumer action: none.
14
31
  every `refreshMs` while the page is visible, never while hidden, and at once on return. Matrx 2's
15
32
  screens each carried their own `setInterval` loop (five shapes); this is the one. Guard:
16
33
  `src/react.test.tsx` ("refreshMs polls while visible …").
34
+ - **Errors keep their code across built entries.** `DesktopProtocolError.from(caught)` recognises an
35
+ error thrown by a sibling entry's copy of the class (each built entry carries its own), so a
36
+ real `NOT_FOUND` "No file at that path" no longer surfaces as a generic `INTERNAL`. The hooks use
37
+ it, and `useDesktopAction` treats `CANCELLED` (the person pressed Stop) as no error. Guard:
38
+ `src/react.test.tsx` ("an error from another copy …").
17
39
  - **`useDesktopAction({ onDone })`: a screen's writes.** One `busy` flag and one typed error for
18
40
  create/save/remove/open, with a refetch after each success. Replaces the per-screen
19
41
  `busy`/`error` `useState` pairs. Guard: `src/react.test.tsx` ("useDesktopAction tracks busy …").
@@ -295,3 +317,4 @@ Defects found in the draft and fixed here (not preserved):
295
317
 
296
318
  None — new package.
297
319
 
320
+
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 };
@@ -126,7 +143,7 @@ var import_zod2 = require("zod");
126
143
  // src/schema/primitives.ts
127
144
  var import_zod = require("zod");
128
145
  var PROTOCOL_MAJOR = 1;
129
- var PROTOCOL_MINOR = 6;
146
+ var PROTOCOL_MINOR = 7;
130
147
  var PROTOCOL_VERSION = `${PROTOCOL_MAJOR}.${PROTOCOL_MINOR}`;
131
148
  var ProtocolVersion = import_zod.z.string().regex(/^[1-9][0-9]{0,2}\.[0-9]{1,3}$/);
132
149
  var RequestId = import_zod.z.string().min(1).max(64).regex(/^[A-Za-z0-9_-]+$/);
@@ -944,7 +961,15 @@ var WindowInfo = import_zod15.z.strictObject({
944
961
  x: import_zod15.z.int(),
945
962
  y: import_zod15.z.int(),
946
963
  width: import_zod15.z.int().min(0),
947
- height: import_zod15.z.int().min(0)
964
+ height: import_zod15.z.int().min(0),
965
+ /**
966
+ * The application that owns the window, by the name the OS shows people; absent when the OS does
967
+ * not say. Optional (never null, the schema rule) because it was added in protocol 1.7: an older
968
+ * app's answer has no such field (FIELDS_SINCE).
969
+ */
970
+ app: import_zod15.z.string().max(256).optional(),
971
+ /** The owning process id; absent when the OS does not say. Added in protocol 1.7. */
972
+ pid: import_zod15.z.int().min(0).optional()
948
973
  });
949
974
  var WindowListParams = import_zod15.z.strictObject({
950
975
  /** Case-insensitive substring of the window title. */