@ai-matrx/desktop-protocol 0.3.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 +32 -0
- package/dist/client.cjs +32 -4
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.cts +2 -2
- package/dist/client.d.ts +2 -2
- package/dist/client.js +32 -4
- package/dist/client.js.map +1 -1
- package/dist/index.cjs +89 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +100 -4
- package/dist/index.d.ts +100 -4
- package/dist/index.js +89 -4
- package/dist/index.js.map +1 -1
- package/dist/react.d.cts +13 -0
- package/dist/react.d.ts +13 -0
- package/dist/{registry-DQ5_mP_5.d.cts → registry-BeY9D7h0.d.cts} +80 -1
- package/dist/{registry-DQ5_mP_5.d.ts → registry-BeY9D7h0.d.ts} +80 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,37 @@
|
|
|
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
|
+
|
|
21
|
+
## 0.4.0
|
|
22
|
+
|
|
23
|
+
fs.patch reports every edit, as the cloud sandbox daemon does (recorded from a live sandbox:
|
|
24
|
+
matrx-desktop `test/fixtures/sandbox-daemon/observed.json`, `patch_cases`).
|
|
25
|
+
|
|
26
|
+
- `FsPatchResult` gains `edits_applied` (`{ edit_index, mode: "create" | "replace" |
|
|
27
|
+
"replace_all", matches_replaced? }`, `matches_replaced` only for replace_all) and `edits_failed`
|
|
28
|
+
(`{ edit_index, reason }`, the daemon's reason text verbatim). `applied` stays (= the count).
|
|
29
|
+
- When every edit fails (CONFLICT, reason `patch_no_match` / `patch_ambiguous`), the error's
|
|
30
|
+
`data.edits_failed` lists them — the daemon's 422 `failures`.
|
|
31
|
+
|
|
32
|
+
Consumer action: none required (additive). Read `edits_failed` instead of reconstructing it from
|
|
33
|
+
`applied`.
|
|
34
|
+
|
|
3
35
|
## 0.3.0
|
|
4
36
|
|
|
5
37
|
SPEC 6.1 sandbox parity: every search and list op now answers exactly what the cloud 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 =
|
|
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_-]+$/);
|
|
@@ -184,6 +184,7 @@ var ErrorReason = import_zod2.z.enum([
|
|
|
184
184
|
// another client of the same user took control
|
|
185
185
|
"window_exhausted"
|
|
186
186
|
]);
|
|
187
|
+
var FsPatchEditFailure = import_zod2.z.strictObject({ edit_index: nonNegInt, reason: import_zod2.z.string().max(300) });
|
|
187
188
|
var ProtocolErrorBody = import_zod2.z.strictObject({
|
|
188
189
|
code: ErrorCode,
|
|
189
190
|
message: import_zod2.z.string().max(300),
|
|
@@ -198,6 +199,8 @@ var ProtocolErrorBody = import_zod2.z.strictObject({
|
|
|
198
199
|
// PERMISSION_DENIED_OS deep link
|
|
199
200
|
retry_after_ms: nonNegInt.optional(),
|
|
200
201
|
limit_bytes: nonNegInt.optional(),
|
|
202
|
+
/** fs.patch when every edit failed (CONFLICT, patch_no_match / patch_ambiguous): the daemon's 422 `failures`. */
|
|
203
|
+
edits_failed: import_zod2.z.array(FsPatchEditFailure).max(256).optional(),
|
|
201
204
|
upgrade: import_zod2.z.strictObject({
|
|
202
205
|
min_version: ProtocolVersion,
|
|
203
206
|
max_version: ProtocolVersion,
|
|
@@ -489,7 +492,22 @@ var FsPatchParams = import_zod6.z.strictObject({
|
|
|
489
492
|
).min(1).max(256),
|
|
490
493
|
create_if_missing: import_zod6.z.boolean().default(false)
|
|
491
494
|
});
|
|
492
|
-
var
|
|
495
|
+
var FsPatchEditApplied = import_zod6.z.strictObject({
|
|
496
|
+
edit_index: nonNegInt,
|
|
497
|
+
mode: import_zod6.z.enum(["create", "replace", "replace_all"]),
|
|
498
|
+
/** Present for replace_all only, as the daemon sends it. */
|
|
499
|
+
matches_replaced: nonNegInt.optional()
|
|
500
|
+
});
|
|
501
|
+
var FsPatchResult = import_zod6.z.strictObject({
|
|
502
|
+
path: AbsPath,
|
|
503
|
+
applied: nonNegInt,
|
|
504
|
+
size: nonNegInt,
|
|
505
|
+
mtime_ms: epochMs,
|
|
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()
|
|
510
|
+
});
|
|
493
511
|
var FsSearchPathsParams = import_zod6.z.strictObject({
|
|
494
512
|
pattern: import_zod6.z.string().min(1).max(512),
|
|
495
513
|
cwd: AbsPath,
|
|
@@ -640,8 +658,18 @@ var RelayCallRequest = import_zod9.z.strictObject({
|
|
|
640
658
|
timeout_ms: import_zod9.z.int().min(100).max(37e5).default(7e4)
|
|
641
659
|
});
|
|
642
660
|
var RelayCallResponse = import_zod9.z.discriminatedUnion("ok", [
|
|
643
|
-
import_zod9.z.strictObject({
|
|
644
|
-
|
|
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
|
+
})
|
|
645
673
|
]);
|
|
646
674
|
var RELAY_CALL_HELLO_ID = "hello";
|
|
647
675
|
var RELAY_CALL_REQUEST_ID = "call";
|