@ai-matrx/desktop-protocol 0.2.0 → 0.4.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-DJbrsZ4u.cjs';
5
- export { i as isDesktopProtocolError } from './registry-DJbrsZ4u.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-CI-NpQ6L.cjs';
5
+ export { i as isDesktopProtocolError } from './registry-CI-NpQ6L.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-DJbrsZ4u.js';
5
- export { i as isDesktopProtocolError } from './registry-DJbrsZ4u.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-CI-NpQ6L.js';
5
+ export { i as isDesktopProtocolError } from './registry-CI-NpQ6L.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
@@ -95,6 +95,7 @@ import { z as z2 } from "zod";
95
95
  import { z } from "zod";
96
96
  var PROTOCOL_MAJOR = 1;
97
97
  var PROTOCOL_MINOR = 0;
98
+ var PROTOCOL_VERSION = `${PROTOCOL_MAJOR}.${PROTOCOL_MINOR}`;
98
99
  var ProtocolVersion = z.string().regex(/^[1-9][0-9]{0,2}\.[0-9]{1,3}$/);
99
100
  var RequestId = z.string().min(1).max(64).regex(/^[A-Za-z0-9_-]+$/);
100
101
  var ResourceId = z.string().regex(/^(pty|watch)_[A-Za-z0-9]{16,40}$/);
@@ -153,6 +154,7 @@ var ErrorReason = z2.enum([
153
154
  // another client of the same user took control
154
155
  "window_exhausted"
155
156
  ]);
157
+ var FsPatchEditFailure = z2.strictObject({ edit_index: nonNegInt, reason: z2.string().max(300) });
156
158
  var ProtocolErrorBody = z2.strictObject({
157
159
  code: ErrorCode,
158
160
  message: z2.string().max(300),
@@ -167,6 +169,8 @@ var ProtocolErrorBody = z2.strictObject({
167
169
  // PERMISSION_DENIED_OS deep link
168
170
  retry_after_ms: nonNegInt.optional(),
169
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(),
170
174
  upgrade: z2.strictObject({
171
175
  min_version: ProtocolVersion,
172
176
  max_version: ProtocolVersion,
@@ -366,12 +370,9 @@ var FsEntry = z6.strictObject({
366
370
  kind: FsKind,
367
371
  size: nonNegInt,
368
372
  mtime: z6.number().min(0),
369
- // seconds, float — daemon parity
370
- mtime_ms: epochMs,
373
+ // seconds, float
371
374
  mode: z6.int().min(0).max(4095),
372
- target: AbsPath.nullable(),
373
- // symlink target, never followed
374
- hidden: z6.boolean()
375
+ target: AbsPath.nullable()
375
376
  });
376
377
  var FsListParams = z6.strictObject({
377
378
  path: AbsPath,
@@ -379,10 +380,12 @@ var FsListParams = z6.strictObject({
379
380
  depth: z6.int().min(1).max(32).default(1),
380
381
  pattern: z6.string().max(256).optional(),
381
382
  // glob on name
382
- limit: z6.int().min(1).max(5e3).default(500),
383
+ limit: z6.int().min(1).max(5e3).default(1e3),
383
384
  page_token: z6.string().max(256).optional(),
384
- show_hidden: z6.boolean().default(false),
385
- sort: z6.enum(["name", "mtime", "size", "kind"]).default("kind")
385
+ // Desktop additions; their defaults ARE the daemon's behaviour: dotfiles listed, siblings in
386
+ // binary (byte) order of name, depth-first.
387
+ show_hidden: z6.boolean().default(true),
388
+ sort: z6.enum(["name", "mtime", "size", "kind"]).default("name")
386
389
  });
387
390
  var FsListResult = z6.strictObject({
388
391
  entries: z6.array(FsEntry),
@@ -459,14 +462,27 @@ 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
+ edits_applied: z6.array(FsPatchEditApplied).max(256),
477
+ edits_failed: z6.array(FsPatchEditFailure).max(256)
478
+ });
463
479
  var FsSearchPathsParams = z6.strictObject({
464
480
  pattern: z6.string().min(1).max(512),
465
481
  cwd: AbsPath,
466
482
  hidden: z6.boolean().default(false),
467
483
  max_results: z6.int().min(1).max(5e3).default(100)
468
484
  });
469
- var FsSearchPathsResult = z6.strictObject({ paths: z6.array(AbsPath), truncated: z6.boolean() });
485
+ var FsSearchPathsResult = z6.strictObject({ paths: z6.array(z6.string().min(3).max(4096).regex(/^\.\/[^\\\u0000]+$/)) });
470
486
  var FsSearchContentParams = z6.strictObject({
471
487
  query: z6.string().min(1).max(1024),
472
488
  cwd: AbsPath,
@@ -479,13 +495,14 @@ var FsSearchContentParams = z6.strictObject({
479
495
  var FsSearchContentResult = z6.strictObject({
480
496
  results: z6.array(
481
497
  z6.strictObject({
482
- path: AbsPath,
498
+ path: z6.string().min(1).max(4096).regex(/^[^/\\\u0000][^\\\u0000]*$/),
483
499
  lines: z6.string(),
484
500
  line_number: z6.int().min(1),
485
- submatches: z6.array(z6.strictObject({ match: z6.string(), start: nonNegInt, end: nonNegInt }))
501
+ submatches: z6.array(
502
+ z6.strictObject({ match: z6.strictObject({ text: z6.string() }), start: nonNegInt, end: nonNegInt })
503
+ )
486
504
  })
487
- ),
488
- truncated: z6.boolean()
505
+ )
489
506
  });
490
507
  var FsChange = z6.strictObject({
491
508
  type: z6.enum(["created", "modified", "deleted", "moved"]),