@ai-matrx/desktop-protocol 0.4.0 → 0.6.0

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,35 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.6.0
4
+
5
+ - `RelayDeviceStatusEvent.since_ms` is `null` for a device that has never connected (protocol 1.1;
6
+ `NULL_SINCE`): a 1.0 reader is sent `0`, its old meaning (`statusForPeer`).
7
+ - A WebSocket client may announce its minor at connect by also offering
8
+ `versionSubprotocol(PROTOCOL_VERSION)` (e.g. `matrx.v1.1`) beside `SUBPROTOCOL`;
9
+ `announcedVersion(offered)` reads it (servers still answer `SUBPROTOCOL`).
10
+ - The versioning test also refuses a 1.0 field changing type, except a widening to null listed in
11
+ `NULL_SINCE`.
12
+
13
+ Consumer action: treat `since_ms: null` as "never connected"; offer the version subprotocol.
14
+
15
+ ## 0.5.0
16
+
17
+ Version skew is the normal state, so a minor protocol addition must never make an older peer
18
+ fail. Protocol 1.1 (`PROTOCOL_MINOR` 1) and a rule that keeps it that way (`src/versioning.ts`):
19
+
20
+ - Fields added after 1.0 are optional on read and listed in `FIELDS_SINCE` (exported, and in both
21
+ generated sides): `FsPatchResult.edits_applied/edits_failed`, `ProtocolErrorBody.data.edits_failed`,
22
+ `RelayCallResponse.protocol_version`.
23
+ - `forPeer(op, "result" | "error", value, version)` strips fields a peer's negotiated version does
24
+ not know; `negotiate`, `knows`, `compareVersions`.
25
+ - /call: the caller announces its version in `RELAY_CALL_VERSION_HEADER`; the relay then reports
26
+ the version the device negotiated (`protocol_version`).
27
+ - `src/versioning.test.ts` fails when any object that existed in 1.0 gains a required field, or a
28
+ new field is not in `FIELDS_SINCE` (baseline: `generated/baseline/desktop-protocol-1.0.schema.json`).
29
+
30
+ Consumer action: a writer applies `forPeer` before sending to a peer (the desktop core and relay
31
+ do); a reader that needs a 1.1 field handles its absence from a 1.0 peer explicitly.
32
+
3
33
  ## 0.4.0
4
34
 
5
35
  fs.patch reports every edit, as the cloud sandbox daemon does (recorded from a live sandbox:
package/dist/client.cjs CHANGED
@@ -124,7 +124,7 @@ var import_zod2 = require("zod");
124
124
  // src/schema/primitives.ts
125
125
  var import_zod = require("zod");
126
126
  var PROTOCOL_MAJOR = 1;
127
- var PROTOCOL_MINOR = 0;
127
+ var PROTOCOL_MINOR = 1;
128
128
  var PROTOCOL_VERSION = `${PROTOCOL_MAJOR}.${PROTOCOL_MINOR}`;
129
129
  var ProtocolVersion = import_zod.z.string().regex(/^[1-9][0-9]{0,2}\.[0-9]{1,3}$/);
130
130
  var RequestId = import_zod.z.string().min(1).max(64).regex(/^[A-Za-z0-9_-]+$/);
@@ -503,8 +503,10 @@ var FsPatchResult = import_zod6.z.strictObject({
503
503
  applied: nonNegInt,
504
504
  size: nonNegInt,
505
505
  mtime_ms: epochMs,
506
- edits_applied: import_zod6.z.array(FsPatchEditApplied).max(256),
507
- edits_failed: import_zod6.z.array(FsPatchEditFailure).max(256)
506
+ /** Since 1.1 (FIELDS_SINCE): a 1.0 app sends only `applied`. Always sent to a ≥1.1 peer. */
507
+ edits_applied: import_zod6.z.array(FsPatchEditApplied).max(256).optional(),
508
+ /** Since 1.1 (FIELDS_SINCE). */
509
+ edits_failed: import_zod6.z.array(FsPatchEditFailure).max(256).optional()
508
510
  });
509
511
  var FsSearchPathsParams = import_zod6.z.strictObject({
510
512
  pattern: import_zod6.z.string().min(1).max(512),
@@ -644,7 +646,11 @@ var SessionControlChangedEvent = import_zod8.z.strictObject({ controller_client_
644
646
  var import_zod9 = require("zod");
645
647
  var RelayDeviceStatusEvent = import_zod9.z.strictObject({
646
648
  online: import_zod9.z.boolean(),
647
- since_ms: epochMs,
649
+ /**
650
+ * When the device last went online/offline; null = it has never connected (since 1.1 —
651
+ * NULL_SINCE: a 1.0 reader is sent 0, its old meaning).
652
+ */
653
+ since_ms: epochMs.nullable(),
648
654
  app_version: import_zod9.z.string().max(32).nullable(),
649
655
  protocol_version: ProtocolVersion.nullable()
650
656
  });
@@ -656,8 +662,18 @@ var RelayCallRequest = import_zod9.z.strictObject({
656
662
  timeout_ms: import_zod9.z.int().min(100).max(37e5).default(7e4)
657
663
  });
658
664
  var RelayCallResponse = import_zod9.z.discriminatedUnion("ok", [
659
- import_zod9.z.strictObject({ ok: import_zod9.z.literal(true), result: import_zod9.z.unknown() }),
660
- import_zod9.z.strictObject({ ok: import_zod9.z.literal(false), error: ProtocolErrorBody })
665
+ import_zod9.z.strictObject({
666
+ ok: import_zod9.z.literal(true),
667
+ result: import_zod9.z.unknown(),
668
+ /** Since 1.1: the version the device negotiated for this call (its welcome). */
669
+ protocol_version: ProtocolVersion.optional()
670
+ }),
671
+ import_zod9.z.strictObject({
672
+ ok: import_zod9.z.literal(false),
673
+ error: ProtocolErrorBody,
674
+ /** Since 1.1, as above (absent when the device never answered hello). */
675
+ protocol_version: ProtocolVersion.optional()
676
+ })
661
677
  ]);
662
678
  var RELAY_CALL_HELLO_ID = "hello";
663
679
  var RELAY_CALL_REQUEST_ID = "call";