@ai-matrx/desktop-protocol 0.4.0 → 0.5.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,23 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.5.0
4
+
5
+ Version skew is the normal state, so a minor protocol addition must never make an older peer
6
+ fail. Protocol 1.1 (`PROTOCOL_MINOR` 1) and a rule that keeps it that way (`src/versioning.ts`):
7
+
8
+ - Fields added after 1.0 are optional on read and listed in `FIELDS_SINCE` (exported, and in both
9
+ generated sides): `FsPatchResult.edits_applied/edits_failed`, `ProtocolErrorBody.data.edits_failed`,
10
+ `RelayCallResponse.protocol_version`.
11
+ - `forPeer(op, "result" | "error", value, version)` strips fields a peer's negotiated version does
12
+ not know; `negotiate`, `knows`, `compareVersions`.
13
+ - /call: the caller announces its version in `RELAY_CALL_VERSION_HEADER`; the relay then reports
14
+ the version the device negotiated (`protocol_version`).
15
+ - `src/versioning.test.ts` fails when any object that existed in 1.0 gains a required field, or a
16
+ new field is not in `FIELDS_SINCE` (baseline: `generated/baseline/desktop-protocol-1.0.schema.json`).
17
+
18
+ Consumer action: a writer applies `forPeer` before sending to a peer (the desktop core and relay
19
+ do); a reader that needs a 1.1 field handles its absence from a 1.0 peer explicitly.
20
+
3
21
  ## 0.4.0
4
22
 
5
23
  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),
@@ -656,8 +658,18 @@ var RelayCallRequest = import_zod9.z.strictObject({
656
658
  timeout_ms: import_zod9.z.int().min(100).max(37e5).default(7e4)
657
659
  });
658
660
  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 })
661
+ import_zod9.z.strictObject({
662
+ ok: import_zod9.z.literal(true),
663
+ result: import_zod9.z.unknown(),
664
+ /** Since 1.1: the version the device negotiated for this call (its welcome). */
665
+ protocol_version: ProtocolVersion.optional()
666
+ }),
667
+ import_zod9.z.strictObject({
668
+ ok: import_zod9.z.literal(false),
669
+ error: ProtocolErrorBody,
670
+ /** Since 1.1, as above (absent when the device never answered hello). */
671
+ protocol_version: ProtocolVersion.optional()
672
+ })
661
673
  ]);
662
674
  var RELAY_CALL_HELLO_ID = "hello";
663
675
  var RELAY_CALL_REQUEST_ID = "call";