@ai-matrx/desktop-protocol 0.17.2 → 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/dist/index.cjs CHANGED
@@ -332,7 +332,7 @@ module.exports = __toCommonJS(src_exports);
332
332
  // src/schema/primitives.ts
333
333
  var import_zod = require("zod");
334
334
  var PROTOCOL_MAJOR = 1;
335
- var PROTOCOL_MINOR = 6;
335
+ var PROTOCOL_MINOR = 7;
336
336
  var PROTOCOL_VERSION = `${PROTOCOL_MAJOR}.${PROTOCOL_MINOR}`;
337
337
  var ProtocolVersion = import_zod.z.string().regex(/^[1-9][0-9]{0,2}\.[0-9]{1,3}$/);
338
338
  var RequestId = import_zod.z.string().min(1).max(64).regex(/^[A-Za-z0-9_-]+$/);
@@ -1428,7 +1428,15 @@ var WindowInfo = import_zod18.z.strictObject({
1428
1428
  x: import_zod18.z.int(),
1429
1429
  y: import_zod18.z.int(),
1430
1430
  width: import_zod18.z.int().min(0),
1431
- height: import_zod18.z.int().min(0)
1431
+ height: import_zod18.z.int().min(0),
1432
+ /**
1433
+ * The application that owns the window, by the name the OS shows people; absent when the OS does
1434
+ * not say. Optional (never null, the schema rule) because it was added in protocol 1.7: an older
1435
+ * app's answer has no such field (FIELDS_SINCE).
1436
+ */
1437
+ app: import_zod18.z.string().max(256).optional(),
1438
+ /** The owning process id; absent when the OS does not say. Added in protocol 1.7. */
1439
+ pid: import_zod18.z.int().min(0).optional()
1432
1440
  });
1433
1441
  var WindowListParams = import_zod18.z.strictObject({
1434
1442
  /** Case-insensitive substring of the window title. */
@@ -2145,7 +2153,8 @@ var FIELDS_SINCE = {
2145
2153
  FsPatchResult: { edits_applied: "1.1", edits_failed: "1.1" },
2146
2154
  "ProtocolErrorBody.data": { edits_failed: "1.1" },
2147
2155
  "RelayCallResponse|0": { protocol_version: "1.1" },
2148
- "RelayCallResponse|1": { protocol_version: "1.1" }
2156
+ "RelayCallResponse|1": { protocol_version: "1.1" },
2157
+ WindowInfo: { app: "1.7", pid: "1.7" }
2149
2158
  };
2150
2159
  var NULL_SINCE = {
2151
2160
  "RelayDeviceStatusEvent.since_ms": { since: "1.1", olderPeersGet: 0 }
@@ -2199,8 +2208,28 @@ function strip(value, fields, version) {
2199
2208
  return out ?? value;
2200
2209
  }
2201
2210
  var RESULT_PATH = /* @__PURE__ */ new Map([["fs.patch", "FsPatchResult"]]);
2211
+ var WINDOW_RESULTS = /* @__PURE__ */ new Map([
2212
+ ["window.list", "windows"],
2213
+ ["window.focus", "window"],
2214
+ ["window.move", "window"]
2215
+ ]);
2216
+ function stripWindows(value, key, version) {
2217
+ if (value === null || typeof value !== "object") return value;
2218
+ const body = value;
2219
+ const inner = body[key];
2220
+ if (inner === void 0) return value;
2221
+ const fields = FIELDS_SINCE.WindowInfo;
2222
+ if (Array.isArray(inner)) {
2223
+ const next2 = inner.map((w) => strip(w, fields, version));
2224
+ return next2.some((w, i) => w !== inner[i]) ? { ...body, [key]: next2 } : value;
2225
+ }
2226
+ const next = strip(inner, fields, version);
2227
+ return next === inner ? value : { ...body, [key]: next };
2228
+ }
2202
2229
  function forPeer(op, part, value, version) {
2203
2230
  if (part === "result") {
2231
+ const windowKey = op ? WINDOW_RESULTS.get(op) : void 0;
2232
+ if (windowKey) return stripWindows(value, windowKey, version);
2204
2233
  const path = op ? RESULT_PATH.get(op) : void 0;
2205
2234
  return path ? strip(value, FIELDS_SINCE[path], version) : value;
2206
2235
  }
@@ -2216,10 +2245,10 @@ function forPeer(op, part, value, version) {
2216
2245
  }
2217
2246
  return data === body.data ? value : { ...body, data };
2218
2247
  }
2219
- var VERSIONED_RESULT_OPS = [...RESULT_PATH.keys()];
2248
+ var VERSIONED_RESULT_OPS = [...RESULT_PATH.keys(), ...WINDOW_RESULTS.keys()];
2220
2249
 
2221
2250
  // src/contract.ts
2222
- var CONTRACT_SHA256 = "2cbf3c7589a30141305f6f0f38c4d4a32bf9ef2a890f7572d9c7bd15c398d4b9";
2251
+ var CONTRACT_SHA256 = "5525674072a767340a8bd75a4e4b98c588577a866b4d381edeb377401729e14d";
2223
2252
 
2224
2253
  // src/close-policy.ts
2225
2254
  var CLOSE_RULES = {