@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/index.d.cts CHANGED
@@ -1,11 +1,13 @@
1
1
  import { z } from 'zod';
2
- export { e as CancelMsg, f as ClientToCoreMsg, C as ClientType, g as CloseCode, h as CloseCodeValue, j as CoreToClientMsg, k as CreditMsg, D as DesktopProtocolError, d as EVENTS, l as EndMsg, E as EndReason, m as ErrorCode, n as ErrorCodeName, o as ErrorData, p as ErrorMsg, q as ErrorReason, r as ErrorReasonName, s as EventMsg, t as EventName, H as HelloMsg, L as Limits, N as NAMED_SCHEMAS, u as NamedSchemaId, c as OPS, v as OpDescriptor, O as OpName, a as OpParams, b as OpResult, w as OpSpec, P as PING_TEXT, x as PONG_TEXT, y as ProtocolErrorBody, R as RelayMsg, z as RequestMsg, A as ResponseMsg, S as StreamMeta, B as StreamMsg, W as Welcome, i as isDesktopProtocolError } from './registry-DJbrsZ4u.cjs';
2
+ export { B as BEARER_PREFIX, e as CancelMsg, f as ClientToCoreMsg, C as ClientType, g as CloseCode, h as CloseCodeValue, j as CoreToClientMsg, k as CreditMsg, D as DesktopProtocolError, d as EVENTS, l as EndMsg, E as EndReason, m as ErrorCode, n as ErrorCodeName, o as ErrorData, p as ErrorMsg, q as ErrorReason, r as ErrorReasonName, s as EventMsg, t as EventName, F as FsPatchEditFailure, H as HelloMsg, L as Limits, N as NAMED_SCHEMAS, u as NamedSchemaId, c as OPS, v as OpDescriptor, O as OpName, a as OpParams, b as OpResult, w as OpSpec, P as PING_TEXT, x as PONG_TEXT, y as ProtocolErrorBody, R as RelayMsg, z as RequestMsg, A as ResponseMsg, G as SUBPROTOCOL, S as StreamMeta, I as StreamMsg, W as Welcome, i as isDesktopProtocolError } from './registry-CI-NpQ6L.cjs';
3
3
  export { BROADCAST_CID, DecodedFrame, FRAME_HEADER_BYTES, FRAME_STRUCT_FORMAT, FRAME_VERSION, FrameChannel, FrameChannelValue, FrameFlag, assertFrameHeader, connectionEndFrame, decodeFrame, encodeFrame, hasFlag, isConnectionEnd, readCid, stampCid } from './frame.cjs';
4
4
 
5
5
  /** @ai-matrx/desktop-protocol — version and primitive schemas. Schema source: lint-enforced rules in scripts/check-schema-source.mjs. */
6
6
 
7
7
  declare const PROTOCOL_MAJOR: 1;
8
8
  declare const PROTOCOL_MINOR: 0;
9
+ /** This package's version as the wire spells it ("major.minor"): hello, welcome, relay status. */
10
+ declare const PROTOCOL_VERSION: "1.0";
9
11
  /** Internal building blocks — deliberately unnamed in $defs (inlined wherever used). */
10
12
  declare const u32: z.ZodInt;
11
13
  declare const nonNegInt: z.ZodInt;
@@ -165,7 +167,10 @@ declare const FsKind: z.ZodEnum<{
165
167
  symlink: "symlink";
166
168
  }>;
167
169
  type FsKind = z.output<typeof FsKind>;
168
- /** = daemon get_stat_dict(), plus mtime in ms and hidden. */
170
+ /**
171
+ * = daemon get_stat_dict(), field for field (SPEC 6.1): what /fs/stat and every /fs/list entry
172
+ * answer in the cloud sandbox. Never follows symlinks; `target` is the fully resolved target.
173
+ */
169
174
  declare const FsEntry: z.ZodObject<{
170
175
  name: z.ZodString;
171
176
  path: z.ZodString;
@@ -176,10 +181,8 @@ declare const FsEntry: z.ZodObject<{
176
181
  }>;
177
182
  size: z.ZodInt;
178
183
  mtime: z.ZodNumber;
179
- mtime_ms: z.ZodInt;
180
184
  mode: z.ZodInt;
181
185
  target: z.ZodNullable<z.ZodString>;
182
- hidden: z.ZodBoolean;
183
186
  }, z.core.$strict>;
184
187
  type FsEntry = z.output<typeof FsEntry>;
185
188
  declare const FsListParams: z.ZodObject<{
@@ -209,10 +212,8 @@ declare const FsListResult: z.ZodObject<{
209
212
  }>;
210
213
  size: z.ZodInt;
211
214
  mtime: z.ZodNumber;
212
- mtime_ms: z.ZodInt;
213
215
  mode: z.ZodInt;
214
216
  target: z.ZodNullable<z.ZodString>;
215
- hidden: z.ZodBoolean;
216
217
  }, z.core.$strict>>;
217
218
  truncated: z.ZodBoolean;
218
219
  next_page_token: z.ZodNullable<z.ZodString>;
@@ -233,10 +234,8 @@ declare const FsStatResult: z.ZodObject<{
233
234
  }>;
234
235
  size: z.ZodInt;
235
236
  mtime: z.ZodNumber;
236
- mtime_ms: z.ZodInt;
237
237
  mode: z.ZodInt;
238
238
  target: z.ZodNullable<z.ZodString>;
239
- hidden: z.ZodBoolean;
240
239
  }, z.core.$strict>;
241
240
  type FsStatResult = z.output<typeof FsStatResult>;
242
241
  declare const FsEncoding: z.ZodEnum<{
@@ -367,13 +366,43 @@ declare const FsPatchParams: z.ZodObject<{
367
366
  create_if_missing: z.ZodDefault<z.ZodBoolean>;
368
367
  }, z.core.$strict>;
369
368
  type FsPatchParams = z.output<typeof FsPatchParams>;
369
+ /**
370
+ * = the daemon's /fs/patch answer per edit: edits apply in order, each sees the previous result; an
371
+ * edit whose old_text is missing, or matches more than once without replace_all, is skipped and
372
+ * listed in edits_failed with the daemon's reason; the file is written when at least one applied.
373
+ * (Every edit failing is a CONFLICT whose data.edits_failed lists them — the daemon's 422.)
374
+ */
370
375
  declare const FsPatchResult: z.ZodObject<{
371
376
  path: z.ZodString;
372
377
  applied: z.ZodInt;
373
378
  size: z.ZodInt;
374
379
  mtime_ms: z.ZodInt;
380
+ edits_applied: z.ZodArray<z.ZodObject<{
381
+ edit_index: z.ZodInt;
382
+ mode: z.ZodEnum<{
383
+ replace_all: "replace_all";
384
+ create: "create";
385
+ replace: "replace";
386
+ }>;
387
+ matches_replaced: z.ZodOptional<z.ZodInt>;
388
+ }, z.core.$strict>>;
389
+ edits_failed: z.ZodArray<z.ZodObject<{
390
+ edit_index: z.ZodInt;
391
+ reason: z.ZodString;
392
+ }, z.core.$strict>>;
375
393
  }, z.core.$strict>;
376
394
  type FsPatchResult = z.output<typeof FsPatchResult>;
395
+ /** One edit fs.patch applied — the daemon's `edits_applied[]` entry, verbatim. */
396
+ declare const FsPatchEditApplied: z.ZodObject<{
397
+ edit_index: z.ZodInt;
398
+ mode: z.ZodEnum<{
399
+ replace_all: "replace_all";
400
+ create: "create";
401
+ replace: "replace";
402
+ }>;
403
+ matches_replaced: z.ZodOptional<z.ZodInt>;
404
+ }, z.core.$strict>;
405
+ type FsPatchEditApplied = z.output<typeof FsPatchEditApplied>;
377
406
  /** = daemon SearchPathRequest (/search/paths). */
378
407
  declare const FsSearchPathsParams: z.ZodObject<{
379
408
  pattern: z.ZodString;
@@ -382,9 +411,12 @@ declare const FsSearchPathsParams: z.ZodObject<{
382
411
  max_results: z.ZodDefault<z.ZodInt>;
383
412
  }, z.core.$strict>;
384
413
  type FsSearchPathsParams = z.output<typeof FsSearchPathsParams>;
414
+ /**
415
+ * = the daemon's /search/paths answer (fd 8.3.1 in the sandbox image): paths RELATIVE to `cwd`, each
416
+ * prefixed "./", sorted, cut to max_results. No truncation flag (the daemon has none).
417
+ */
385
418
  declare const FsSearchPathsResult: z.ZodObject<{
386
419
  paths: z.ZodArray<z.ZodString>;
387
- truncated: z.ZodBoolean;
388
420
  }, z.core.$strict>;
389
421
  type FsSearchPathsResult = z.output<typeof FsSearchPathsResult>;
390
422
  /** = daemon SearchContentRequest (/search/content). */
@@ -398,18 +430,25 @@ declare const FsSearchContentParams: z.ZodObject<{
398
430
  max_results: z.ZodDefault<z.ZodInt>;
399
431
  }, z.core.$strict>;
400
432
  type FsSearchContentParams = z.output<typeof FsSearchContentParams>;
433
+ /**
434
+ * = the daemon's /search/content answer (ripgrep 13 --json run in `cwd`): `path` RELATIVE to `cwd`
435
+ * with no "./"; `lines` is the matching line with its newline; submatches are ripgrep's, byte
436
+ * offsets within the line. max_results is per FILE (rg -m), as the daemon passes it. No truncation
437
+ * flag (the daemon has none).
438
+ */
401
439
  declare const FsSearchContentResult: z.ZodObject<{
402
440
  results: z.ZodArray<z.ZodObject<{
403
441
  path: z.ZodString;
404
442
  lines: z.ZodString;
405
443
  line_number: z.ZodInt;
406
444
  submatches: z.ZodArray<z.ZodObject<{
407
- match: z.ZodString;
445
+ match: z.ZodObject<{
446
+ text: z.ZodString;
447
+ }, z.core.$strict>;
408
448
  start: z.ZodInt;
409
449
  end: z.ZodInt;
410
450
  }, z.core.$strict>>;
411
451
  }, z.core.$strict>>;
412
- truncated: z.ZodBoolean;
413
452
  }, z.core.$strict>;
414
453
  type FsSearchContentResult = z.output<typeof FsSearchContentResult>;
415
454
  declare const FsChange: z.ZodObject<{
@@ -941,6 +980,10 @@ declare const RelayCallResponse: z.ZodDiscriminatedUnion<[z.ZodObject<{
941
980
  settings_url: z.ZodOptional<z.ZodString>;
942
981
  retry_after_ms: z.ZodOptional<z.ZodInt>;
943
982
  limit_bytes: z.ZodOptional<z.ZodInt>;
983
+ edits_failed: z.ZodOptional<z.ZodArray<z.ZodObject<{
984
+ edit_index: z.ZodInt;
985
+ reason: z.ZodString;
986
+ }, z.core.$strict>>>;
944
987
  upgrade: z.ZodOptional<z.ZodObject<{
945
988
  min_version: z.ZodString;
946
989
  max_version: z.ZodString;
@@ -975,4 +1018,4 @@ declare const RelayCallEnvelope: z.ZodObject<{
975
1018
  }, z.core.$strict>;
976
1019
  type RelayCallEnvelope = z.output<typeof RelayCallEnvelope>;
977
1020
 
978
- export { AbsPath, DEFAULT_MAX_FRAME_PAYLOAD_BYTES, DEFAULT_MAX_MESSAGE_BYTES, DEFAULT_WINDOW_BYTES, DeviceId, ExecCwdEvent, ExecExitedEvent, ExecListParams, ExecListResult, ExecPtyKillParams, ExecPtyKillResult, ExecPtyResizeParams, ExecPtyResizeResult, ExecPtySignalParams, ExecPtySignalResult, ExecPtyStartParams, ExecPtyStartResult, ExecPtyWriteParams, ExecPtyWriteResult, ExecRunParams, ExecRunResult, ExecTitleEvent, FrameHeader, FsChange, FsChangedEvent, FsDeleteParams, FsDeleteResult, FsEncoding, FsEntry, FsKind, FsListParams, FsListResult, FsMkdirParams, FsMkdirResult, FsMoveParams, FsMoveResult, FsPatchParams, FsPatchResult, FsReadParams, FsReadResult, FsReadStreamParams, FsReadStreamResult, FsSearchContentParams, FsSearchContentResult, FsSearchPathsParams, FsSearchPathsResult, FsStatParams, FsStatResult, FsWatchParams, FsWatchResult, FsWriteParams, FsWriteResult, OsPermissionName, PROTOCOL_MAJOR, PROTOCOL_MINOR, ProtocolVersion, PtyInfo, RELAY_CALL_HELLO_ID, RELAY_CALL_REQUEST_ID, RelayAuthExpiringEvent, RelayCallEnvelope, RelayCallHello, RelayCallRequest, RelayCallResponse, RelayDeviceStatusEvent, RelayHopConnectionEnd, RelayHopEnvelopeHeader, RelayStatusResponse, RequestId, ResourceId, ResourceInfo, SessionAttachParams, SessionAttachResult, SessionControlChangedEvent, SessionDetachParams, SessionDetachResult, SessionListParams, SessionListResult, SessionReleaseParams, SessionReleaseResult, Signal, SysinfoGetParams, SysinfoGetResult, epochMs, nonNegInt, u32 };
1021
+ export { AbsPath, DEFAULT_MAX_FRAME_PAYLOAD_BYTES, DEFAULT_MAX_MESSAGE_BYTES, DEFAULT_WINDOW_BYTES, DeviceId, ExecCwdEvent, ExecExitedEvent, ExecListParams, ExecListResult, ExecPtyKillParams, ExecPtyKillResult, ExecPtyResizeParams, ExecPtyResizeResult, ExecPtySignalParams, ExecPtySignalResult, ExecPtyStartParams, ExecPtyStartResult, ExecPtyWriteParams, ExecPtyWriteResult, ExecRunParams, ExecRunResult, ExecTitleEvent, FrameHeader, FsChange, FsChangedEvent, FsDeleteParams, FsDeleteResult, FsEncoding, FsEntry, FsKind, FsListParams, FsListResult, FsMkdirParams, FsMkdirResult, FsMoveParams, FsMoveResult, FsPatchEditApplied, FsPatchParams, FsPatchResult, FsReadParams, FsReadResult, FsReadStreamParams, FsReadStreamResult, FsSearchContentParams, FsSearchContentResult, FsSearchPathsParams, FsSearchPathsResult, FsStatParams, FsStatResult, FsWatchParams, FsWatchResult, FsWriteParams, FsWriteResult, OsPermissionName, PROTOCOL_MAJOR, PROTOCOL_MINOR, PROTOCOL_VERSION, ProtocolVersion, PtyInfo, RELAY_CALL_HELLO_ID, RELAY_CALL_REQUEST_ID, RelayAuthExpiringEvent, RelayCallEnvelope, RelayCallHello, RelayCallRequest, RelayCallResponse, RelayDeviceStatusEvent, RelayHopConnectionEnd, RelayHopEnvelopeHeader, RelayStatusResponse, RequestId, ResourceId, ResourceInfo, SessionAttachParams, SessionAttachResult, SessionControlChangedEvent, SessionDetachParams, SessionDetachResult, SessionListParams, SessionListResult, SessionReleaseParams, SessionReleaseResult, Signal, SysinfoGetParams, SysinfoGetResult, epochMs, nonNegInt, u32 };
package/dist/index.d.ts CHANGED
@@ -1,11 +1,13 @@
1
1
  import { z } from 'zod';
2
- export { e as CancelMsg, f as ClientToCoreMsg, C as ClientType, g as CloseCode, h as CloseCodeValue, j as CoreToClientMsg, k as CreditMsg, D as DesktopProtocolError, d as EVENTS, l as EndMsg, E as EndReason, m as ErrorCode, n as ErrorCodeName, o as ErrorData, p as ErrorMsg, q as ErrorReason, r as ErrorReasonName, s as EventMsg, t as EventName, H as HelloMsg, L as Limits, N as NAMED_SCHEMAS, u as NamedSchemaId, c as OPS, v as OpDescriptor, O as OpName, a as OpParams, b as OpResult, w as OpSpec, P as PING_TEXT, x as PONG_TEXT, y as ProtocolErrorBody, R as RelayMsg, z as RequestMsg, A as ResponseMsg, S as StreamMeta, B as StreamMsg, W as Welcome, i as isDesktopProtocolError } from './registry-DJbrsZ4u.js';
2
+ export { B as BEARER_PREFIX, e as CancelMsg, f as ClientToCoreMsg, C as ClientType, g as CloseCode, h as CloseCodeValue, j as CoreToClientMsg, k as CreditMsg, D as DesktopProtocolError, d as EVENTS, l as EndMsg, E as EndReason, m as ErrorCode, n as ErrorCodeName, o as ErrorData, p as ErrorMsg, q as ErrorReason, r as ErrorReasonName, s as EventMsg, t as EventName, F as FsPatchEditFailure, H as HelloMsg, L as Limits, N as NAMED_SCHEMAS, u as NamedSchemaId, c as OPS, v as OpDescriptor, O as OpName, a as OpParams, b as OpResult, w as OpSpec, P as PING_TEXT, x as PONG_TEXT, y as ProtocolErrorBody, R as RelayMsg, z as RequestMsg, A as ResponseMsg, G as SUBPROTOCOL, S as StreamMeta, I as StreamMsg, W as Welcome, i as isDesktopProtocolError } from './registry-CI-NpQ6L.js';
3
3
  export { BROADCAST_CID, DecodedFrame, FRAME_HEADER_BYTES, FRAME_STRUCT_FORMAT, FRAME_VERSION, FrameChannel, FrameChannelValue, FrameFlag, assertFrameHeader, connectionEndFrame, decodeFrame, encodeFrame, hasFlag, isConnectionEnd, readCid, stampCid } from './frame.js';
4
4
 
5
5
  /** @ai-matrx/desktop-protocol — version and primitive schemas. Schema source: lint-enforced rules in scripts/check-schema-source.mjs. */
6
6
 
7
7
  declare const PROTOCOL_MAJOR: 1;
8
8
  declare const PROTOCOL_MINOR: 0;
9
+ /** This package's version as the wire spells it ("major.minor"): hello, welcome, relay status. */
10
+ declare const PROTOCOL_VERSION: "1.0";
9
11
  /** Internal building blocks — deliberately unnamed in $defs (inlined wherever used). */
10
12
  declare const u32: z.ZodInt;
11
13
  declare const nonNegInt: z.ZodInt;
@@ -165,7 +167,10 @@ declare const FsKind: z.ZodEnum<{
165
167
  symlink: "symlink";
166
168
  }>;
167
169
  type FsKind = z.output<typeof FsKind>;
168
- /** = daemon get_stat_dict(), plus mtime in ms and hidden. */
170
+ /**
171
+ * = daemon get_stat_dict(), field for field (SPEC 6.1): what /fs/stat and every /fs/list entry
172
+ * answer in the cloud sandbox. Never follows symlinks; `target` is the fully resolved target.
173
+ */
169
174
  declare const FsEntry: z.ZodObject<{
170
175
  name: z.ZodString;
171
176
  path: z.ZodString;
@@ -176,10 +181,8 @@ declare const FsEntry: z.ZodObject<{
176
181
  }>;
177
182
  size: z.ZodInt;
178
183
  mtime: z.ZodNumber;
179
- mtime_ms: z.ZodInt;
180
184
  mode: z.ZodInt;
181
185
  target: z.ZodNullable<z.ZodString>;
182
- hidden: z.ZodBoolean;
183
186
  }, z.core.$strict>;
184
187
  type FsEntry = z.output<typeof FsEntry>;
185
188
  declare const FsListParams: z.ZodObject<{
@@ -209,10 +212,8 @@ declare const FsListResult: z.ZodObject<{
209
212
  }>;
210
213
  size: z.ZodInt;
211
214
  mtime: z.ZodNumber;
212
- mtime_ms: z.ZodInt;
213
215
  mode: z.ZodInt;
214
216
  target: z.ZodNullable<z.ZodString>;
215
- hidden: z.ZodBoolean;
216
217
  }, z.core.$strict>>;
217
218
  truncated: z.ZodBoolean;
218
219
  next_page_token: z.ZodNullable<z.ZodString>;
@@ -233,10 +234,8 @@ declare const FsStatResult: z.ZodObject<{
233
234
  }>;
234
235
  size: z.ZodInt;
235
236
  mtime: z.ZodNumber;
236
- mtime_ms: z.ZodInt;
237
237
  mode: z.ZodInt;
238
238
  target: z.ZodNullable<z.ZodString>;
239
- hidden: z.ZodBoolean;
240
239
  }, z.core.$strict>;
241
240
  type FsStatResult = z.output<typeof FsStatResult>;
242
241
  declare const FsEncoding: z.ZodEnum<{
@@ -367,13 +366,43 @@ declare const FsPatchParams: z.ZodObject<{
367
366
  create_if_missing: z.ZodDefault<z.ZodBoolean>;
368
367
  }, z.core.$strict>;
369
368
  type FsPatchParams = z.output<typeof FsPatchParams>;
369
+ /**
370
+ * = the daemon's /fs/patch answer per edit: edits apply in order, each sees the previous result; an
371
+ * edit whose old_text is missing, or matches more than once without replace_all, is skipped and
372
+ * listed in edits_failed with the daemon's reason; the file is written when at least one applied.
373
+ * (Every edit failing is a CONFLICT whose data.edits_failed lists them — the daemon's 422.)
374
+ */
370
375
  declare const FsPatchResult: z.ZodObject<{
371
376
  path: z.ZodString;
372
377
  applied: z.ZodInt;
373
378
  size: z.ZodInt;
374
379
  mtime_ms: z.ZodInt;
380
+ edits_applied: z.ZodArray<z.ZodObject<{
381
+ edit_index: z.ZodInt;
382
+ mode: z.ZodEnum<{
383
+ replace_all: "replace_all";
384
+ create: "create";
385
+ replace: "replace";
386
+ }>;
387
+ matches_replaced: z.ZodOptional<z.ZodInt>;
388
+ }, z.core.$strict>>;
389
+ edits_failed: z.ZodArray<z.ZodObject<{
390
+ edit_index: z.ZodInt;
391
+ reason: z.ZodString;
392
+ }, z.core.$strict>>;
375
393
  }, z.core.$strict>;
376
394
  type FsPatchResult = z.output<typeof FsPatchResult>;
395
+ /** One edit fs.patch applied — the daemon's `edits_applied[]` entry, verbatim. */
396
+ declare const FsPatchEditApplied: z.ZodObject<{
397
+ edit_index: z.ZodInt;
398
+ mode: z.ZodEnum<{
399
+ replace_all: "replace_all";
400
+ create: "create";
401
+ replace: "replace";
402
+ }>;
403
+ matches_replaced: z.ZodOptional<z.ZodInt>;
404
+ }, z.core.$strict>;
405
+ type FsPatchEditApplied = z.output<typeof FsPatchEditApplied>;
377
406
  /** = daemon SearchPathRequest (/search/paths). */
378
407
  declare const FsSearchPathsParams: z.ZodObject<{
379
408
  pattern: z.ZodString;
@@ -382,9 +411,12 @@ declare const FsSearchPathsParams: z.ZodObject<{
382
411
  max_results: z.ZodDefault<z.ZodInt>;
383
412
  }, z.core.$strict>;
384
413
  type FsSearchPathsParams = z.output<typeof FsSearchPathsParams>;
414
+ /**
415
+ * = the daemon's /search/paths answer (fd 8.3.1 in the sandbox image): paths RELATIVE to `cwd`, each
416
+ * prefixed "./", sorted, cut to max_results. No truncation flag (the daemon has none).
417
+ */
385
418
  declare const FsSearchPathsResult: z.ZodObject<{
386
419
  paths: z.ZodArray<z.ZodString>;
387
- truncated: z.ZodBoolean;
388
420
  }, z.core.$strict>;
389
421
  type FsSearchPathsResult = z.output<typeof FsSearchPathsResult>;
390
422
  /** = daemon SearchContentRequest (/search/content). */
@@ -398,18 +430,25 @@ declare const FsSearchContentParams: z.ZodObject<{
398
430
  max_results: z.ZodDefault<z.ZodInt>;
399
431
  }, z.core.$strict>;
400
432
  type FsSearchContentParams = z.output<typeof FsSearchContentParams>;
433
+ /**
434
+ * = the daemon's /search/content answer (ripgrep 13 --json run in `cwd`): `path` RELATIVE to `cwd`
435
+ * with no "./"; `lines` is the matching line with its newline; submatches are ripgrep's, byte
436
+ * offsets within the line. max_results is per FILE (rg -m), as the daemon passes it. No truncation
437
+ * flag (the daemon has none).
438
+ */
401
439
  declare const FsSearchContentResult: z.ZodObject<{
402
440
  results: z.ZodArray<z.ZodObject<{
403
441
  path: z.ZodString;
404
442
  lines: z.ZodString;
405
443
  line_number: z.ZodInt;
406
444
  submatches: z.ZodArray<z.ZodObject<{
407
- match: z.ZodString;
445
+ match: z.ZodObject<{
446
+ text: z.ZodString;
447
+ }, z.core.$strict>;
408
448
  start: z.ZodInt;
409
449
  end: z.ZodInt;
410
450
  }, z.core.$strict>>;
411
451
  }, z.core.$strict>>;
412
- truncated: z.ZodBoolean;
413
452
  }, z.core.$strict>;
414
453
  type FsSearchContentResult = z.output<typeof FsSearchContentResult>;
415
454
  declare const FsChange: z.ZodObject<{
@@ -941,6 +980,10 @@ declare const RelayCallResponse: z.ZodDiscriminatedUnion<[z.ZodObject<{
941
980
  settings_url: z.ZodOptional<z.ZodString>;
942
981
  retry_after_ms: z.ZodOptional<z.ZodInt>;
943
982
  limit_bytes: z.ZodOptional<z.ZodInt>;
983
+ edits_failed: z.ZodOptional<z.ZodArray<z.ZodObject<{
984
+ edit_index: z.ZodInt;
985
+ reason: z.ZodString;
986
+ }, z.core.$strict>>>;
944
987
  upgrade: z.ZodOptional<z.ZodObject<{
945
988
  min_version: z.ZodString;
946
989
  max_version: z.ZodString;
@@ -975,4 +1018,4 @@ declare const RelayCallEnvelope: z.ZodObject<{
975
1018
  }, z.core.$strict>;
976
1019
  type RelayCallEnvelope = z.output<typeof RelayCallEnvelope>;
977
1020
 
978
- export { AbsPath, DEFAULT_MAX_FRAME_PAYLOAD_BYTES, DEFAULT_MAX_MESSAGE_BYTES, DEFAULT_WINDOW_BYTES, DeviceId, ExecCwdEvent, ExecExitedEvent, ExecListParams, ExecListResult, ExecPtyKillParams, ExecPtyKillResult, ExecPtyResizeParams, ExecPtyResizeResult, ExecPtySignalParams, ExecPtySignalResult, ExecPtyStartParams, ExecPtyStartResult, ExecPtyWriteParams, ExecPtyWriteResult, ExecRunParams, ExecRunResult, ExecTitleEvent, FrameHeader, FsChange, FsChangedEvent, FsDeleteParams, FsDeleteResult, FsEncoding, FsEntry, FsKind, FsListParams, FsListResult, FsMkdirParams, FsMkdirResult, FsMoveParams, FsMoveResult, FsPatchParams, FsPatchResult, FsReadParams, FsReadResult, FsReadStreamParams, FsReadStreamResult, FsSearchContentParams, FsSearchContentResult, FsSearchPathsParams, FsSearchPathsResult, FsStatParams, FsStatResult, FsWatchParams, FsWatchResult, FsWriteParams, FsWriteResult, OsPermissionName, PROTOCOL_MAJOR, PROTOCOL_MINOR, ProtocolVersion, PtyInfo, RELAY_CALL_HELLO_ID, RELAY_CALL_REQUEST_ID, RelayAuthExpiringEvent, RelayCallEnvelope, RelayCallHello, RelayCallRequest, RelayCallResponse, RelayDeviceStatusEvent, RelayHopConnectionEnd, RelayHopEnvelopeHeader, RelayStatusResponse, RequestId, ResourceId, ResourceInfo, SessionAttachParams, SessionAttachResult, SessionControlChangedEvent, SessionDetachParams, SessionDetachResult, SessionListParams, SessionListResult, SessionReleaseParams, SessionReleaseResult, Signal, SysinfoGetParams, SysinfoGetResult, epochMs, nonNegInt, u32 };
1021
+ export { AbsPath, DEFAULT_MAX_FRAME_PAYLOAD_BYTES, DEFAULT_MAX_MESSAGE_BYTES, DEFAULT_WINDOW_BYTES, DeviceId, ExecCwdEvent, ExecExitedEvent, ExecListParams, ExecListResult, ExecPtyKillParams, ExecPtyKillResult, ExecPtyResizeParams, ExecPtyResizeResult, ExecPtySignalParams, ExecPtySignalResult, ExecPtyStartParams, ExecPtyStartResult, ExecPtyWriteParams, ExecPtyWriteResult, ExecRunParams, ExecRunResult, ExecTitleEvent, FrameHeader, FsChange, FsChangedEvent, FsDeleteParams, FsDeleteResult, FsEncoding, FsEntry, FsKind, FsListParams, FsListResult, FsMkdirParams, FsMkdirResult, FsMoveParams, FsMoveResult, FsPatchEditApplied, FsPatchParams, FsPatchResult, FsReadParams, FsReadResult, FsReadStreamParams, FsReadStreamResult, FsSearchContentParams, FsSearchContentResult, FsSearchPathsParams, FsSearchPathsResult, FsStatParams, FsStatResult, FsWatchParams, FsWatchResult, FsWriteParams, FsWriteResult, OsPermissionName, PROTOCOL_MAJOR, PROTOCOL_MINOR, PROTOCOL_VERSION, ProtocolVersion, PtyInfo, RELAY_CALL_HELLO_ID, RELAY_CALL_REQUEST_ID, RelayAuthExpiringEvent, RelayCallEnvelope, RelayCallHello, RelayCallRequest, RelayCallResponse, RelayDeviceStatusEvent, RelayHopConnectionEnd, RelayHopEnvelopeHeader, RelayStatusResponse, RequestId, ResourceId, ResourceInfo, SessionAttachParams, SessionAttachResult, SessionControlChangedEvent, SessionDetachParams, SessionDetachResult, SessionListParams, SessionListResult, SessionReleaseParams, SessionReleaseResult, Signal, SysinfoGetParams, SysinfoGetResult, epochMs, nonNegInt, u32 };
package/dist/index.js CHANGED
@@ -2,6 +2,7 @@
2
2
  import { z } from "zod";
3
3
  var PROTOCOL_MAJOR = 1;
4
4
  var PROTOCOL_MINOR = 0;
5
+ var PROTOCOL_VERSION = `${PROTOCOL_MAJOR}.${PROTOCOL_MINOR}`;
5
6
  var ProtocolVersion = z.string().regex(/^[1-9][0-9]{0,2}\.[0-9]{1,3}$/);
6
7
  var RequestId = z.string().min(1).max(64).regex(/^[A-Za-z0-9_-]+$/);
7
8
  var ResourceId = z.string().regex(/^(pty|watch)_[A-Za-z0-9]{16,40}$/);
@@ -61,6 +62,7 @@ var ErrorReason = z2.enum([
61
62
  // another client of the same user took control
62
63
  "window_exhausted"
63
64
  ]);
65
+ var FsPatchEditFailure = z2.strictObject({ edit_index: nonNegInt, reason: z2.string().max(300) });
64
66
  var ProtocolErrorBody = z2.strictObject({
65
67
  code: ErrorCode,
66
68
  message: z2.string().max(300),
@@ -75,6 +77,8 @@ var ProtocolErrorBody = z2.strictObject({
75
77
  // PERMISSION_DENIED_OS deep link
76
78
  retry_after_ms: nonNegInt.optional(),
77
79
  limit_bytes: nonNegInt.optional(),
80
+ /** fs.patch when every edit failed (CONFLICT, patch_no_match / patch_ambiguous): the daemon's 422 `failures`. */
81
+ edits_failed: z2.array(FsPatchEditFailure).max(256).optional(),
78
82
  upgrade: z2.strictObject({
79
83
  min_version: ProtocolVersion,
80
84
  max_version: ProtocolVersion,
@@ -298,6 +302,8 @@ var RelayMsg = z4.discriminatedUnion("op", [
298
302
  ]);
299
303
  var PING_TEXT = '{"type":"ping"}';
300
304
  var PONG_TEXT = '{"type":"pong"}';
305
+ var SUBPROTOCOL = "matrx.v1";
306
+ var BEARER_PREFIX = "bearer.";
301
307
  var ClientToCoreMsg = z4.discriminatedUnion("type", [HelloMsg, RequestMsg, CancelMsg, CreditMsg]);
302
308
  var CoreToClientMsg = z4.discriminatedUnion("type", [ResponseMsg, ErrorMsg, StreamMsg, EndMsg, CreditMsg, EventMsg]);
303
309
  var CloseCode = {
@@ -386,12 +392,9 @@ var FsEntry = z6.strictObject({
386
392
  kind: FsKind,
387
393
  size: nonNegInt,
388
394
  mtime: z6.number().min(0),
389
- // seconds, float — daemon parity
390
- mtime_ms: epochMs,
395
+ // seconds, float
391
396
  mode: z6.int().min(0).max(4095),
392
- target: AbsPath.nullable(),
393
- // symlink target, never followed
394
- hidden: z6.boolean()
397
+ target: AbsPath.nullable()
395
398
  });
396
399
  var FsListParams = z6.strictObject({
397
400
  path: AbsPath,
@@ -399,10 +402,12 @@ var FsListParams = z6.strictObject({
399
402
  depth: z6.int().min(1).max(32).default(1),
400
403
  pattern: z6.string().max(256).optional(),
401
404
  // glob on name
402
- limit: z6.int().min(1).max(5e3).default(500),
405
+ limit: z6.int().min(1).max(5e3).default(1e3),
403
406
  page_token: z6.string().max(256).optional(),
404
- show_hidden: z6.boolean().default(false),
405
- sort: z6.enum(["name", "mtime", "size", "kind"]).default("kind")
407
+ // Desktop additions; their defaults ARE the daemon's behaviour: dotfiles listed, siblings in
408
+ // binary (byte) order of name, depth-first.
409
+ show_hidden: z6.boolean().default(true),
410
+ sort: z6.enum(["name", "mtime", "size", "kind"]).default("name")
406
411
  });
407
412
  var FsListResult = z6.strictObject({
408
413
  entries: z6.array(FsEntry),
@@ -479,14 +484,27 @@ var FsPatchParams = z6.strictObject({
479
484
  ).min(1).max(256),
480
485
  create_if_missing: z6.boolean().default(false)
481
486
  });
482
- var FsPatchResult = z6.strictObject({ path: AbsPath, applied: nonNegInt, size: nonNegInt, mtime_ms: epochMs });
487
+ var FsPatchEditApplied = z6.strictObject({
488
+ edit_index: nonNegInt,
489
+ mode: z6.enum(["create", "replace", "replace_all"]),
490
+ /** Present for replace_all only, as the daemon sends it. */
491
+ matches_replaced: nonNegInt.optional()
492
+ });
493
+ var FsPatchResult = z6.strictObject({
494
+ path: AbsPath,
495
+ applied: nonNegInt,
496
+ size: nonNegInt,
497
+ mtime_ms: epochMs,
498
+ edits_applied: z6.array(FsPatchEditApplied).max(256),
499
+ edits_failed: z6.array(FsPatchEditFailure).max(256)
500
+ });
483
501
  var FsSearchPathsParams = z6.strictObject({
484
502
  pattern: z6.string().min(1).max(512),
485
503
  cwd: AbsPath,
486
504
  hidden: z6.boolean().default(false),
487
505
  max_results: z6.int().min(1).max(5e3).default(100)
488
506
  });
489
- var FsSearchPathsResult = z6.strictObject({ paths: z6.array(AbsPath), truncated: z6.boolean() });
507
+ var FsSearchPathsResult = z6.strictObject({ paths: z6.array(z6.string().min(3).max(4096).regex(/^\.\/[^\\\u0000]+$/)) });
490
508
  var FsSearchContentParams = z6.strictObject({
491
509
  query: z6.string().min(1).max(1024),
492
510
  cwd: AbsPath,
@@ -499,13 +517,14 @@ var FsSearchContentParams = z6.strictObject({
499
517
  var FsSearchContentResult = z6.strictObject({
500
518
  results: z6.array(
501
519
  z6.strictObject({
502
- path: AbsPath,
520
+ path: z6.string().min(1).max(4096).regex(/^[^/\\\u0000][^\\\u0000]*$/),
503
521
  lines: z6.string(),
504
522
  line_number: z6.int().min(1),
505
- submatches: z6.array(z6.strictObject({ match: z6.string(), start: nonNegInt, end: nonNegInt }))
523
+ submatches: z6.array(
524
+ z6.strictObject({ match: z6.strictObject({ text: z6.string() }), start: nonNegInt, end: nonNegInt })
525
+ )
506
526
  })
507
- ),
508
- truncated: z6.boolean()
527
+ )
509
528
  });
510
529
  var FsChange = z6.strictObject({
511
530
  type: z6.enum(["created", "modified", "deleted", "moved"]),
@@ -695,6 +714,7 @@ var NAMED_SCHEMAS = {
695
714
  AbsPath,
696
715
  ErrorCode,
697
716
  ErrorReason,
717
+ FsPatchEditFailure,
698
718
  ProtocolErrorBody,
699
719
  FrameHeader,
700
720
  ClientType,
@@ -738,6 +758,7 @@ var NAMED_SCHEMAS = {
738
758
  FsDeleteResult,
739
759
  FsWatchParams,
740
760
  FsWatchResult,
761
+ FsPatchEditApplied,
741
762
  FsPatchParams,
742
763
  FsPatchResult,
743
764
  FsSearchPathsParams,
@@ -785,6 +806,7 @@ var NAMED_SCHEMAS = {
785
806
  };
786
807
  export {
787
808
  AbsPath,
809
+ BEARER_PREFIX,
788
810
  BROADCAST_CID,
789
811
  CancelMsg,
790
812
  ClientToCoreMsg,
@@ -841,6 +863,8 @@ export {
841
863
  FsMkdirResult,
842
864
  FsMoveParams,
843
865
  FsMoveResult,
866
+ FsPatchEditApplied,
867
+ FsPatchEditFailure,
844
868
  FsPatchParams,
845
869
  FsPatchResult,
846
870
  FsReadParams,
@@ -867,6 +891,7 @@ export {
867
891
  PONG_TEXT,
868
892
  PROTOCOL_MAJOR,
869
893
  PROTOCOL_MINOR,
894
+ PROTOCOL_VERSION,
870
895
  ProtocolErrorBody,
871
896
  ProtocolVersion,
872
897
  PtyInfo,
@@ -887,6 +912,7 @@ export {
887
912
  ResourceId,
888
913
  ResourceInfo,
889
914
  ResponseMsg,
915
+ SUBPROTOCOL,
890
916
  SessionAttachParams,
891
917
  SessionAttachResult,
892
918
  SessionControlChangedEvent,