@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/dist/client.d.cts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { BackoffOptions } from '@ai-matrx/realtime';
2
2
  export { RECONNECT_ALARM_ATTEMPTS } from '@ai-matrx/realtime';
3
3
  import { z } from 'zod';
4
- import { W as Welcome, D as DesktopProtocolError, O as OpName, a as OpParams, b as OpResult, c as OPS, S as StreamMeta, E as EndReason, d as EVENTS, C as ClientType } from './registry-DQ5_mP_5.cjs';
5
- export { i as isDesktopProtocolError } from './registry-DQ5_mP_5.cjs';
4
+ import { W as Welcome, D as DesktopProtocolError, O as OpName, a as OpParams, b as OpResult, c as OPS, S as StreamMeta, E as EndReason, d as EVENTS, C as ClientType } from './registry-BeY9D7h0.cjs';
5
+ export { i as isDesktopProtocolError } from './registry-BeY9D7h0.cjs';
6
6
  import { FrameHeader } from './frame.cjs';
7
7
 
8
8
  /** The subset of the WHATWG WebSocket the client uses — browser, React Native, `ws` and Workers all fit. */
package/dist/client.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { BackoffOptions } from '@ai-matrx/realtime';
2
2
  export { RECONNECT_ALARM_ATTEMPTS } from '@ai-matrx/realtime';
3
3
  import { z } from 'zod';
4
- import { W as Welcome, D as DesktopProtocolError, O as OpName, a as OpParams, b as OpResult, c as OPS, S as StreamMeta, E as EndReason, d as EVENTS, C as ClientType } from './registry-DQ5_mP_5.js';
5
- export { i as isDesktopProtocolError } from './registry-DQ5_mP_5.js';
4
+ import { W as Welcome, D as DesktopProtocolError, O as OpName, a as OpParams, b as OpResult, c as OPS, S as StreamMeta, E as EndReason, d as EVENTS, C as ClientType } from './registry-BeY9D7h0.js';
5
+ export { i as isDesktopProtocolError } from './registry-BeY9D7h0.js';
6
6
  import { FrameHeader } from './frame.js';
7
7
 
8
8
  /** The subset of the WHATWG WebSocket the client uses — browser, React Native, `ws` and Workers all fit. */
package/dist/client.js CHANGED
@@ -94,7 +94,7 @@ import { z as z2 } from "zod";
94
94
  // src/schema/primitives.ts
95
95
  import { z } from "zod";
96
96
  var PROTOCOL_MAJOR = 1;
97
- var PROTOCOL_MINOR = 0;
97
+ var PROTOCOL_MINOR = 1;
98
98
  var PROTOCOL_VERSION = `${PROTOCOL_MAJOR}.${PROTOCOL_MINOR}`;
99
99
  var ProtocolVersion = z.string().regex(/^[1-9][0-9]{0,2}\.[0-9]{1,3}$/);
100
100
  var RequestId = z.string().min(1).max(64).regex(/^[A-Za-z0-9_-]+$/);
@@ -154,6 +154,7 @@ var ErrorReason = z2.enum([
154
154
  // another client of the same user took control
155
155
  "window_exhausted"
156
156
  ]);
157
+ var FsPatchEditFailure = z2.strictObject({ edit_index: nonNegInt, reason: z2.string().max(300) });
157
158
  var ProtocolErrorBody = z2.strictObject({
158
159
  code: ErrorCode,
159
160
  message: z2.string().max(300),
@@ -168,6 +169,8 @@ var ProtocolErrorBody = z2.strictObject({
168
169
  // PERMISSION_DENIED_OS deep link
169
170
  retry_after_ms: nonNegInt.optional(),
170
171
  limit_bytes: nonNegInt.optional(),
172
+ /** fs.patch when every edit failed (CONFLICT, patch_no_match / patch_ambiguous): the daemon's 422 `failures`. */
173
+ edits_failed: z2.array(FsPatchEditFailure).max(256).optional(),
171
174
  upgrade: z2.strictObject({
172
175
  min_version: ProtocolVersion,
173
176
  max_version: ProtocolVersion,
@@ -459,7 +462,22 @@ var FsPatchParams = z6.strictObject({
459
462
  ).min(1).max(256),
460
463
  create_if_missing: z6.boolean().default(false)
461
464
  });
462
- var FsPatchResult = z6.strictObject({ path: AbsPath, applied: nonNegInt, size: nonNegInt, mtime_ms: epochMs });
465
+ var FsPatchEditApplied = z6.strictObject({
466
+ edit_index: nonNegInt,
467
+ mode: z6.enum(["create", "replace", "replace_all"]),
468
+ /** Present for replace_all only, as the daemon sends it. */
469
+ matches_replaced: nonNegInt.optional()
470
+ });
471
+ var FsPatchResult = z6.strictObject({
472
+ path: AbsPath,
473
+ applied: nonNegInt,
474
+ size: nonNegInt,
475
+ mtime_ms: epochMs,
476
+ /** Since 1.1 (FIELDS_SINCE): a 1.0 app sends only `applied`. Always sent to a ≥1.1 peer. */
477
+ edits_applied: z6.array(FsPatchEditApplied).max(256).optional(),
478
+ /** Since 1.1 (FIELDS_SINCE). */
479
+ edits_failed: z6.array(FsPatchEditFailure).max(256).optional()
480
+ });
463
481
  var FsSearchPathsParams = z6.strictObject({
464
482
  pattern: z6.string().min(1).max(512),
465
483
  cwd: AbsPath,
@@ -610,8 +628,18 @@ var RelayCallRequest = z9.strictObject({
610
628
  timeout_ms: z9.int().min(100).max(37e5).default(7e4)
611
629
  });
612
630
  var RelayCallResponse = z9.discriminatedUnion("ok", [
613
- z9.strictObject({ ok: z9.literal(true), result: z9.unknown() }),
614
- z9.strictObject({ ok: z9.literal(false), error: ProtocolErrorBody })
631
+ z9.strictObject({
632
+ ok: z9.literal(true),
633
+ result: z9.unknown(),
634
+ /** Since 1.1: the version the device negotiated for this call (its welcome). */
635
+ protocol_version: ProtocolVersion.optional()
636
+ }),
637
+ z9.strictObject({
638
+ ok: z9.literal(false),
639
+ error: ProtocolErrorBody,
640
+ /** Since 1.1, as above (absent when the device never answered hello). */
641
+ protocol_version: ProtocolVersion.optional()
642
+ })
615
643
  ]);
616
644
  var RELAY_CALL_HELLO_ID = "hello";
617
645
  var RELAY_CALL_REQUEST_ID = "call";