@domicile-desktop/sdk 0.0.0-alpha-54d26039996e → 0.0.0-alpha-4e64bb0bd178

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.
@@ -256,6 +256,95 @@ export declare const shellConfigSchema: z.ZodObject<{
256
256
  keys: z.ZodRecord<z.ZodString, z.ZodNumber>;
257
257
  type: z.ZodLiteral<"shell_config">;
258
258
  }, z.core.$loose>;
259
+ declare const systemReplySchema: z.ZodObject<{
260
+ id: z.ZodNumber;
261
+ reply: z.ZodDiscriminatedUnion<[z.ZodObject<{
262
+ data: z.ZodString;
263
+ kind: z.ZodLiteral<"read">;
264
+ }, z.core.$loose>, z.ZodObject<{
265
+ kind: z.ZodLiteral<"written">;
266
+ }, z.core.$loose>, z.ZodObject<{
267
+ entries: z.ZodArray<z.ZodObject<{
268
+ file_type: z.ZodEnum<{
269
+ directory: "directory";
270
+ file: "file";
271
+ other: "other";
272
+ symlink: "symlink";
273
+ }>;
274
+ name: z.ZodString;
275
+ }, z.core.$loose>>;
276
+ kind: z.ZodLiteral<"entries">;
277
+ }, z.core.$loose>, z.ZodObject<{
278
+ file_type: z.ZodEnum<{
279
+ directory: "directory";
280
+ file: "file";
281
+ other: "other";
282
+ symlink: "symlink";
283
+ }>;
284
+ kind: z.ZodLiteral<"stat">;
285
+ modified_ms: z.ZodNullable<z.ZodNumber>;
286
+ size: z.ZodNumber;
287
+ }, z.core.$loose>, z.ZodObject<{
288
+ kind: z.ZodLiteral<"started">;
289
+ }, z.core.$loose>, z.ZodObject<{
290
+ error: z.ZodObject<{
291
+ kind: z.ZodEnum<{
292
+ already_exists: "already_exists";
293
+ invalid_input: "invalid_input";
294
+ is_a_directory: "is_a_directory";
295
+ locked: "locked";
296
+ not_a_directory: "not_a_directory";
297
+ not_found: "not_found";
298
+ other: "other";
299
+ permission_denied: "permission_denied";
300
+ }>;
301
+ message: z.ZodString;
302
+ }, z.core.$loose>;
303
+ kind: z.ZodLiteral<"failed">;
304
+ }, z.core.$loose>], "kind">;
305
+ type: z.ZodLiteral<"system_reply">;
306
+ }, z.core.$loose>;
307
+ declare const systemEventSchema: z.ZodObject<{
308
+ event: z.ZodDiscriminatedUnion<[z.ZodObject<{
309
+ data: z.ZodString;
310
+ kind: z.ZodLiteral<"output">;
311
+ stream: z.ZodEnum<{
312
+ stderr: "stderr";
313
+ stdout: "stdout";
314
+ }>;
315
+ }, z.core.$loose>, z.ZodObject<{
316
+ kind: z.ZodLiteral<"changed">;
317
+ path: z.ZodString;
318
+ }, z.core.$loose>], "kind">;
319
+ id: z.ZodNumber;
320
+ type: z.ZodLiteral<"system_event">;
321
+ }, z.core.$loose>;
322
+ declare const systemEndSchema: z.ZodObject<{
323
+ end: z.ZodDiscriminatedUnion<[z.ZodObject<{
324
+ code: z.ZodNullable<z.ZodNumber>;
325
+ kind: z.ZodLiteral<"exited">;
326
+ signal: z.ZodNullable<z.ZodNumber>;
327
+ }, z.core.$loose>, z.ZodObject<{
328
+ kind: z.ZodLiteral<"stopped">;
329
+ }, z.core.$loose>, z.ZodObject<{
330
+ error: z.ZodObject<{
331
+ kind: z.ZodEnum<{
332
+ already_exists: "already_exists";
333
+ invalid_input: "invalid_input";
334
+ is_a_directory: "is_a_directory";
335
+ locked: "locked";
336
+ not_a_directory: "not_a_directory";
337
+ not_found: "not_found";
338
+ other: "other";
339
+ permission_denied: "permission_denied";
340
+ }>;
341
+ message: z.ZodString;
342
+ }, z.core.$loose>;
343
+ kind: z.ZodLiteral<"failed">;
344
+ }, z.core.$loose>], "kind">;
345
+ id: z.ZodNumber;
346
+ type: z.ZodLiteral<"system_end">;
347
+ }, z.core.$loose>;
259
348
  /**
260
349
  * A host message this build understands. {@link parseHostMessage} returns
261
350
  * `undefined` for unknown types so a newer host can add messages.
@@ -540,6 +629,92 @@ export declare const hostMessageSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
540
629
  }, z.core.$loose>, z.ZodObject<{
541
630
  keys: z.ZodRecord<z.ZodString, z.ZodNumber>;
542
631
  type: z.ZodLiteral<"shell_config">;
632
+ }, z.core.$loose>, z.ZodObject<{
633
+ id: z.ZodNumber;
634
+ reply: z.ZodDiscriminatedUnion<[z.ZodObject<{
635
+ data: z.ZodString;
636
+ kind: z.ZodLiteral<"read">;
637
+ }, z.core.$loose>, z.ZodObject<{
638
+ kind: z.ZodLiteral<"written">;
639
+ }, z.core.$loose>, z.ZodObject<{
640
+ entries: z.ZodArray<z.ZodObject<{
641
+ file_type: z.ZodEnum<{
642
+ directory: "directory";
643
+ file: "file";
644
+ other: "other";
645
+ symlink: "symlink";
646
+ }>;
647
+ name: z.ZodString;
648
+ }, z.core.$loose>>;
649
+ kind: z.ZodLiteral<"entries">;
650
+ }, z.core.$loose>, z.ZodObject<{
651
+ file_type: z.ZodEnum<{
652
+ directory: "directory";
653
+ file: "file";
654
+ other: "other";
655
+ symlink: "symlink";
656
+ }>;
657
+ kind: z.ZodLiteral<"stat">;
658
+ modified_ms: z.ZodNullable<z.ZodNumber>;
659
+ size: z.ZodNumber;
660
+ }, z.core.$loose>, z.ZodObject<{
661
+ kind: z.ZodLiteral<"started">;
662
+ }, z.core.$loose>, z.ZodObject<{
663
+ error: z.ZodObject<{
664
+ kind: z.ZodEnum<{
665
+ already_exists: "already_exists";
666
+ invalid_input: "invalid_input";
667
+ is_a_directory: "is_a_directory";
668
+ locked: "locked";
669
+ not_a_directory: "not_a_directory";
670
+ not_found: "not_found";
671
+ other: "other";
672
+ permission_denied: "permission_denied";
673
+ }>;
674
+ message: z.ZodString;
675
+ }, z.core.$loose>;
676
+ kind: z.ZodLiteral<"failed">;
677
+ }, z.core.$loose>], "kind">;
678
+ type: z.ZodLiteral<"system_reply">;
679
+ }, z.core.$loose>, z.ZodObject<{
680
+ event: z.ZodDiscriminatedUnion<[z.ZodObject<{
681
+ data: z.ZodString;
682
+ kind: z.ZodLiteral<"output">;
683
+ stream: z.ZodEnum<{
684
+ stderr: "stderr";
685
+ stdout: "stdout";
686
+ }>;
687
+ }, z.core.$loose>, z.ZodObject<{
688
+ kind: z.ZodLiteral<"changed">;
689
+ path: z.ZodString;
690
+ }, z.core.$loose>], "kind">;
691
+ id: z.ZodNumber;
692
+ type: z.ZodLiteral<"system_event">;
693
+ }, z.core.$loose>, z.ZodObject<{
694
+ end: z.ZodDiscriminatedUnion<[z.ZodObject<{
695
+ code: z.ZodNullable<z.ZodNumber>;
696
+ kind: z.ZodLiteral<"exited">;
697
+ signal: z.ZodNullable<z.ZodNumber>;
698
+ }, z.core.$loose>, z.ZodObject<{
699
+ kind: z.ZodLiteral<"stopped">;
700
+ }, z.core.$loose>, z.ZodObject<{
701
+ error: z.ZodObject<{
702
+ kind: z.ZodEnum<{
703
+ already_exists: "already_exists";
704
+ invalid_input: "invalid_input";
705
+ is_a_directory: "is_a_directory";
706
+ locked: "locked";
707
+ not_a_directory: "not_a_directory";
708
+ not_found: "not_found";
709
+ other: "other";
710
+ permission_denied: "permission_denied";
711
+ }>;
712
+ message: z.ZodString;
713
+ }, z.core.$loose>;
714
+ kind: z.ZodLiteral<"failed">;
715
+ }, z.core.$loose>], "kind">;
716
+ id: z.ZodNumber;
717
+ type: z.ZodLiteral<"system_end">;
543
718
  }, z.core.$loose>], "type">;
544
719
  /** A decoded host message. */
545
720
  export type HostMessage = z.infer<typeof hostMessageSchema>;
@@ -572,6 +747,9 @@ export type IdleMessage = z.infer<typeof idleSchema>;
572
747
  export type LockedMessage = z.infer<typeof lockedSchema>;
573
748
  export type WindowsThemeMessage = z.infer<typeof windowsThemeMessageSchema>;
574
749
  export type ShellConfigMessage = z.infer<typeof shellConfigSchema>;
750
+ export type SystemReplyMessage = z.infer<typeof systemReplySchema>;
751
+ export type SystemEventMessage = z.infer<typeof systemEventSchema>;
752
+ export type SystemEndMessage = z.infer<typeof systemEndSchema>;
575
753
  /** One thing that was copied, as a row of the clipboard's history. */
576
754
  export type ClipboardEntry = z.infer<typeof clipboardEntrySchema>;
577
755
  /** One display of the desktop, in the coordinates the shell lays out in. */
package/dist/protocol.js CHANGED
@@ -375,6 +375,69 @@ const audioLevelsSchema = z.looseObject({
375
375
  levels: z.array(z.looseObject({ id: z.string(), peak: z.number() })),
376
376
  type: z.literal("audio_levels"),
377
377
  });
378
+ const systemErrorSchema = z.looseObject({
379
+ kind: z.enum([
380
+ "not_found",
381
+ "permission_denied",
382
+ "already_exists",
383
+ "not_a_directory",
384
+ "is_a_directory",
385
+ "invalid_input",
386
+ "locked",
387
+ "other",
388
+ ]),
389
+ message: z.string(),
390
+ });
391
+ const fileTypeSchema = z.enum(["file", "directory", "symlink", "other"]);
392
+ // The answer to a `system_request`. Bytes are base64. See
393
+ // `docs/architecture/SYSTEM-ACCESS.md`.
394
+ const systemReplySchema = z.looseObject({
395
+ id: z.number(),
396
+ reply: z.discriminatedUnion("kind", [
397
+ z.looseObject({ data: z.string(), kind: z.literal("read") }),
398
+ z.looseObject({ kind: z.literal("written") }),
399
+ z.looseObject({
400
+ entries: z.array(z.looseObject({ file_type: fileTypeSchema, name: z.string() })),
401
+ kind: z.literal("entries"),
402
+ }),
403
+ z.looseObject({
404
+ file_type: fileTypeSchema,
405
+ kind: z.literal("stat"),
406
+ modified_ms: z.number().nullable(),
407
+ size: z.number(),
408
+ }),
409
+ z.looseObject({ kind: z.literal("started") }),
410
+ z.looseObject({ error: systemErrorSchema, kind: z.literal("failed") }),
411
+ ]),
412
+ type: z.literal("system_reply"),
413
+ });
414
+ // Output from a running process, or a change a watch saw.
415
+ const systemEventSchema = z.looseObject({
416
+ event: z.discriminatedUnion("kind", [
417
+ z.looseObject({
418
+ data: z.string(),
419
+ kind: z.literal("output"),
420
+ stream: z.enum(["stdout", "stderr"]),
421
+ }),
422
+ z.looseObject({ kind: z.literal("changed"), path: z.string() }),
423
+ ]),
424
+ id: z.number(),
425
+ type: z.literal("system_event"),
426
+ });
427
+ // The last message for a watch or process.
428
+ const systemEndSchema = z.looseObject({
429
+ end: z.discriminatedUnion("kind", [
430
+ z.looseObject({
431
+ code: z.number().nullable(),
432
+ kind: z.literal("exited"),
433
+ signal: z.number().nullable(),
434
+ }),
435
+ z.looseObject({ kind: z.literal("stopped") }),
436
+ z.looseObject({ error: systemErrorSchema, kind: z.literal("failed") }),
437
+ ]),
438
+ id: z.number(),
439
+ type: z.literal("system_end"),
440
+ });
378
441
  /**
379
442
  * A host message this build understands. {@link parseHostMessage} returns
380
443
  * `undefined` for unknown types so a newer host can add messages.
@@ -411,6 +474,9 @@ export const hostMessageSchema = z.discriminatedUnion("type", [
411
474
  lockedSchema,
412
475
  windowsThemeMessageSchema,
413
476
  shellConfigSchema,
477
+ systemReplySchema,
478
+ systemEventSchema,
479
+ systemEndSchema,
414
480
  ]);
415
481
  // A frame without a string `type` is malformed, not unknown.
416
482
  const envelopeSchema = z.looseObject({ type: z.string() });
package/package.json CHANGED
@@ -150,7 +150,7 @@
150
150
  "test:unit": "bun test"
151
151
  },
152
152
  "type": "module",
153
- "version": "0.0.0-alpha-54d26039996e",
153
+ "version": "0.0.0-alpha-4e64bb0bd178",
154
154
  "repository": {
155
155
  "type": "git",
156
156
  "url": "git+https://github.com/cprussin/domicile.git",