@agentdock/wire 0.0.46 → 0.0.47

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.
Files changed (102) hide show
  1. package/dist/agentCapabilities.js +1 -195
  2. package/dist/agentCommonEnv.js +1 -20
  3. package/dist/agentInstallGuide.js +1 -81
  4. package/dist/checkpointSchemas.js +1 -46
  5. package/dist/controlLevel.js +1 -11
  6. package/dist/edition.js +1 -13
  7. package/dist/envelope.d.ts +34 -0
  8. package/dist/envelope.js +1 -78
  9. package/dist/errorMessage.js +1 -6
  10. package/dist/events.d.ts +36 -0
  11. package/dist/events.js +1 -97
  12. package/dist/features.js +1 -112
  13. package/dist/feedback.d.ts +23 -5
  14. package/dist/feedback.js +1 -26
  15. package/dist/index.d.ts +4 -4
  16. package/dist/index.js +1 -64
  17. package/dist/interactionEvents.js +1 -108
  18. package/dist/legacyProtocol.js +1 -30
  19. package/dist/license.js +1 -17
  20. package/dist/machine.d.ts +4 -0
  21. package/dist/machine.js +1 -56
  22. package/dist/messageMeta.js +1 -60
  23. package/dist/messages.d.ts +84 -0
  24. package/dist/messages.js +1 -35
  25. package/dist/ops.js +1 -74
  26. package/dist/pairing.js +1 -115
  27. package/dist/protocol.js +1 -7
  28. package/dist/rpc.js +1 -246
  29. package/dist/scheduledTasks.js +1 -81
  30. package/dist/semver.js +1 -60
  31. package/dist/sessionResult.js +1 -23
  32. package/dist/socketEvents.d.ts +1 -0
  33. package/dist/socketEvents.js +1 -44
  34. package/dist/spawnError.js +1 -31
  35. package/dist/stats.d.ts +27 -422
  36. package/dist/stats.js +1 -126
  37. package/dist/sync.js +1 -78
  38. package/dist/telemetry.js +1 -80
  39. package/dist/utils.js +1 -2
  40. package/package.json +1 -1
  41. package/dist/agentCapabilities.d.ts.map +0 -1
  42. package/dist/agentCapabilities.js.map +0 -1
  43. package/dist/agentCommonEnv.d.ts.map +0 -1
  44. package/dist/agentCommonEnv.js.map +0 -1
  45. package/dist/agentInstallGuide.d.ts.map +0 -1
  46. package/dist/agentInstallGuide.js.map +0 -1
  47. package/dist/checkpointSchemas.d.ts.map +0 -1
  48. package/dist/checkpointSchemas.js.map +0 -1
  49. package/dist/controlLevel.d.ts.map +0 -1
  50. package/dist/controlLevel.js.map +0 -1
  51. package/dist/edition.d.ts.map +0 -1
  52. package/dist/edition.js.map +0 -1
  53. package/dist/envelope.d.ts.map +0 -1
  54. package/dist/envelope.js.map +0 -1
  55. package/dist/errorMessage.d.ts.map +0 -1
  56. package/dist/errorMessage.js.map +0 -1
  57. package/dist/events.d.ts.map +0 -1
  58. package/dist/events.js.map +0 -1
  59. package/dist/features.d.ts.map +0 -1
  60. package/dist/features.js.map +0 -1
  61. package/dist/feedback.d.ts.map +0 -1
  62. package/dist/feedback.js.map +0 -1
  63. package/dist/index.d.ts.map +0 -1
  64. package/dist/index.js.map +0 -1
  65. package/dist/interactionEvents.d.ts.map +0 -1
  66. package/dist/interactionEvents.js.map +0 -1
  67. package/dist/legacyProtocol.d.ts.map +0 -1
  68. package/dist/legacyProtocol.js.map +0 -1
  69. package/dist/license.d.ts.map +0 -1
  70. package/dist/license.js.map +0 -1
  71. package/dist/machine.d.ts.map +0 -1
  72. package/dist/machine.js.map +0 -1
  73. package/dist/messageMeta.d.ts.map +0 -1
  74. package/dist/messageMeta.js.map +0 -1
  75. package/dist/messages.d.ts.map +0 -1
  76. package/dist/messages.js.map +0 -1
  77. package/dist/ops.d.ts.map +0 -1
  78. package/dist/ops.js.map +0 -1
  79. package/dist/pairing.d.ts.map +0 -1
  80. package/dist/pairing.js.map +0 -1
  81. package/dist/protocol.d.ts.map +0 -1
  82. package/dist/protocol.js.map +0 -1
  83. package/dist/rpc.d.ts.map +0 -1
  84. package/dist/rpc.js.map +0 -1
  85. package/dist/scheduledTasks.d.ts.map +0 -1
  86. package/dist/scheduledTasks.js.map +0 -1
  87. package/dist/semver.d.ts.map +0 -1
  88. package/dist/semver.js.map +0 -1
  89. package/dist/sessionResult.d.ts.map +0 -1
  90. package/dist/sessionResult.js.map +0 -1
  91. package/dist/socketEvents.d.ts.map +0 -1
  92. package/dist/socketEvents.js.map +0 -1
  93. package/dist/spawnError.d.ts.map +0 -1
  94. package/dist/spawnError.js.map +0 -1
  95. package/dist/stats.d.ts.map +0 -1
  96. package/dist/stats.js.map +0 -1
  97. package/dist/sync.d.ts.map +0 -1
  98. package/dist/sync.js.map +0 -1
  99. package/dist/telemetry.d.ts.map +0 -1
  100. package/dist/telemetry.js.map +0 -1
  101. package/dist/utils.d.ts.map +0 -1
  102. package/dist/utils.js.map +0 -1
package/dist/machine.d.ts CHANGED
@@ -28,6 +28,8 @@ export declare const MachineSummarySchema: z.ZodObject<{
28
28
  totalSessions: z.ZodOptional<z.ZodNumber>;
29
29
  /** Agent types available on this machine (persisted on each daemon connect). */
30
30
  availableAgents: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
31
+ /** Agent versions keyed by agent type name (e.g. { claude: "1.2.3" }). */
32
+ agentVersions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
31
33
  /** RPC methods this machine's daemon has registered (RFC-035). */
32
34
  supportedMethods: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
33
35
  /** Why the machine disconnected — 'upgrade-required' triggers UI upgrade prompts (RFC-037). */
@@ -52,6 +54,7 @@ export declare const MachineSummarySchema: z.ZodObject<{
52
54
  hasTerminal?: boolean | undefined;
53
55
  activeSessions?: number | undefined;
54
56
  totalSessions?: number | undefined;
57
+ agentVersions?: Record<string, string> | undefined;
55
58
  supportedMethods?: string[] | undefined;
56
59
  disconnectReason?: "normal" | "upgrade-required" | undefined;
57
60
  upgradeStatus?: "idle" | "failed" | "preflight" | "downloading" | "switching" | undefined;
@@ -71,6 +74,7 @@ export declare const MachineSummarySchema: z.ZodObject<{
71
74
  hasTerminal?: boolean | undefined;
72
75
  activeSessions?: number | undefined;
73
76
  totalSessions?: number | undefined;
77
+ agentVersions?: Record<string, string> | undefined;
74
78
  supportedMethods?: string[] | undefined;
75
79
  disconnectReason?: "normal" | "upgrade-required" | undefined;
76
80
  upgradeStatus?: "idle" | "failed" | "preflight" | "downloading" | "switching" | undefined;
package/dist/machine.js CHANGED
@@ -1,56 +1 @@
1
- /**
2
- * Machine and session status schemas for Dashboard & Machine Management.
3
- *
4
- * MachineSummary — device info returned by GET /v1/machines.
5
- * SessionStatus — real-time session state indicator.
6
- * Platform — OS platform enum matching Node's process.platform.
7
- */
8
- import { z } from 'zod';
9
- import { LabsSettingsSchema } from './rpc.js';
10
- export const PlatformSchema = z.enum(['darwin', 'linux', 'win32']);
11
- export const SessionStatusSchema = z.enum([
12
- 'idle',
13
- 'thinking',
14
- 'tool_running',
15
- 'permission_required',
16
- 'disconnected',
17
- ]);
18
- export const MachineSummarySchema = z.object({
19
- id: z.string(),
20
- hostname: z.string(),
21
- platform: PlatformSchema,
22
- arch: z.string().optional(),
23
- displayName: z.string().optional(),
24
- daemonVersion: z.string().optional(),
25
- active: z.boolean(),
26
- activeAt: z.number(),
27
- createdAt: z.number(),
28
- /** Whether this machine has an active terminal-server tunnel. */
29
- hasTerminal: z.boolean().optional(),
30
- /** Number of active sessions on this machine. */
31
- activeSessions: z.number().optional(),
32
- /** Total number of sessions on this machine. */
33
- totalSessions: z.number().optional(),
34
- /** Agent types available on this machine (persisted on each daemon connect). */
35
- availableAgents: z.array(z.string()).optional(),
36
- /** RPC methods this machine's daemon has registered (RFC-035). */
37
- supportedMethods: z.array(z.string()).optional(),
38
- /** Why the machine disconnected — 'upgrade-required' triggers UI upgrade prompts (RFC-037). */
39
- disconnectReason: z.enum(['normal', 'upgrade-required']).optional(),
40
- /** Current upgrade state reported by the daemon (RFC-042). */
41
- upgradeStatus: z.enum(['idle', 'preflight', 'downloading', 'switching', 'failed']).optional(),
42
- /** Error message when upgradeStatus is 'failed' (RFC-042). */
43
- upgradeError: z.string().optional(),
44
- /** True when this machine has been replaced by a new one (container rebuild). */
45
- superseded: z.boolean().optional(),
46
- });
47
- export const MachineRegisterResultSchema = z.object({
48
- ok: z.boolean(),
49
- error: z.string().optional(),
50
- latestVersion: z.string().optional(),
51
- labsSettings: LabsSettingsSchema.optional(),
52
- });
53
- export const SetDefaultMachineBodySchema = z.object({
54
- machineId: z.string().nullable(),
55
- });
56
- //# sourceMappingURL=machine.js.map
1
+ "use strict";import{z as o}from"zod";import{LabsSettingsSchema as n}from"./rpc.js";export const PlatformSchema=o.enum(["darwin","linux","win32"]),SessionStatusSchema=o.enum(["idle","thinking","tool_running","permission_required","disconnected"]),MachineSummarySchema=o.object({id:o.string(),hostname:o.string(),platform:PlatformSchema,arch:o.string().optional(),displayName:o.string().optional(),daemonVersion:o.string().optional(),active:o.boolean(),activeAt:o.number(),createdAt:o.number(),hasTerminal:o.boolean().optional(),activeSessions:o.number().optional(),totalSessions:o.number().optional(),availableAgents:o.array(o.string()).optional(),agentVersions:o.record(o.string()).optional(),supportedMethods:o.array(o.string()).optional(),disconnectReason:o.enum(["normal","upgrade-required"]).optional(),upgradeStatus:o.enum(["idle","preflight","downloading","switching","failed"]).optional(),upgradeError:o.string().optional(),superseded:o.boolean().optional()}),MachineRegisterResultSchema=o.object({ok:o.boolean(),error:o.string().optional(),latestVersion:o.string().optional(),labsSettings:n.optional()}),SetDefaultMachineBodySchema=o.object({machineId:o.string().nullable()});
@@ -1,60 +1 @@
1
- import { z } from 'zod';
2
- import { PermissionModeSchema } from './interactionEvents.js';
3
- /** Supported agent types for avatar and UI differentiation. */
4
- export const AgentTypeSchema = z.enum([
5
- 'claude',
6
- 'copilot',
7
- 'codex',
8
- 'gemini',
9
- 'opencode',
10
- 'hermes',
11
- 'openclaw',
12
- 'custom',
13
- ]);
14
- /** All agent type values derived from the schema (single source of truth). */
15
- export const AGENT_TYPES = AgentTypeSchema.options;
16
- /** Agent types that can be spawned as sessions (excludes 'custom'). */
17
- export const SPAWNABLE_AGENTS = AGENT_TYPES.filter((a) => a !== 'custom');
18
- /** CLI identifiers accepted by spawn-session RPC. */
19
- export const CLI_AGENT_TYPES = [
20
- 'claude',
21
- 'copilot',
22
- 'opencode',
23
- 'codex',
24
- 'gemini',
25
- 'hermes',
26
- 'openclaw',
27
- ];
28
- export const MessageMetaSchema = z.object({
29
- sentFrom: z.string().optional(),
30
- permissionMode: PermissionModeSchema.optional(),
31
- model: z.string().nullable().optional(),
32
- fallbackModel: z.string().nullable().optional(),
33
- customSystemPrompt: z.string().nullable().optional(),
34
- appendSystemPrompt: z.string().nullable().optional(),
35
- allowedTools: z.array(z.string()).nullable().optional(),
36
- disallowedTools: z.array(z.string()).nullable().optional(),
37
- displayText: z.string().optional(),
38
- /** Agent type for UI differentiation (avatar, colors). */
39
- agentType: AgentTypeSchema.nullable().optional(),
40
- /** Session start timestamp (Unix ms). */
41
- startedAt: z.number().nullable().optional(),
42
- /** Session status for info display. */
43
- sessionStatus: z
44
- .enum(['running', 'idle', 'completed', 'failed', 'cancelled'])
45
- .nullable()
46
- .optional(),
47
- });
48
- /** Hardcoded per-agent image support. UX-driven: hides image button immediately on agent selection.
49
- * Updated when agents add ACP promptCapabilities.image support. */
50
- export const AGENT_SUPPORTS_IMAGES = {
51
- claude: true,
52
- copilot: true,
53
- codex: false, // Only supports URL/localPath, not base64
54
- gemini: true,
55
- opencode: true,
56
- hermes: false, // ACP: promptCapabilities.image = false
57
- openclaw: false, // ACP: promptCapabilities.image = false
58
- custom: true, // Unknown, assume yes
59
- };
60
- //# sourceMappingURL=messageMeta.js.map
1
+ "use strict";import{z as e}from"zod";import{PermissionModeSchema as l}from"./interactionEvents.js";export const AgentTypeSchema=e.enum(["claude","copilot","codex","gemini","opencode","hermes","openclaw","custom"]),AGENT_TYPES=AgentTypeSchema.options,SPAWNABLE_AGENTS=AGENT_TYPES.filter(o=>o!=="custom"),CLI_AGENT_TYPES=["claude","copilot","opencode","codex","gemini","hermes","openclaw"],MessageMetaSchema=e.object({sentFrom:e.string().optional(),permissionMode:l.optional(),model:e.string().nullable().optional(),fallbackModel:e.string().nullable().optional(),customSystemPrompt:e.string().nullable().optional(),appendSystemPrompt:e.string().nullable().optional(),allowedTools:e.array(e.string()).nullable().optional(),disallowedTools:e.array(e.string()).nullable().optional(),displayText:e.string().optional(),agentType:AgentTypeSchema.nullable().optional(),startedAt:e.number().nullable().optional(),sessionStatus:e.enum(["running","idle","completed","failed","cancelled"]).nullable().optional()}),AGENT_SUPPORTS_IMAGES={claude:!0,copilot:!0,codex:!1,gemini:!0,opencode:!0,hermes:!1,openclaw:!1,custom:!0};
@@ -67,13 +67,31 @@ export declare const SessionProtocolMessageSchema: z.ZodObject<{
67
67
  t: z.ZodLiteral<"text">;
68
68
  text: z.ZodString;
69
69
  thinking: z.ZodOptional<z.ZodBoolean>;
70
+ images: z.ZodOptional<z.ZodArray<z.ZodObject<{
71
+ data: z.ZodString;
72
+ mediaType: z.ZodString;
73
+ }, "strip", z.ZodTypeAny, {
74
+ data: string;
75
+ mediaType: string;
76
+ }, {
77
+ data: string;
78
+ mediaType: string;
79
+ }>, "many">>;
70
80
  }, "strip", z.ZodTypeAny, {
71
81
  t: "text";
72
82
  text: string;
83
+ images?: {
84
+ data: string;
85
+ mediaType: string;
86
+ }[] | undefined;
73
87
  thinking?: boolean | undefined;
74
88
  }, {
75
89
  t: "text";
76
90
  text: string;
91
+ images?: {
92
+ data: string;
93
+ mediaType: string;
94
+ }[] | undefined;
77
95
  thinking?: boolean | undefined;
78
96
  }>, z.ZodObject<{
79
97
  t: z.ZodLiteral<"service">;
@@ -353,6 +371,10 @@ export declare const SessionProtocolMessageSchema: z.ZodObject<{
353
371
  } | {
354
372
  t: "text";
355
373
  text: string;
374
+ images?: {
375
+ data: string;
376
+ mediaType: string;
377
+ }[] | undefined;
356
378
  thinking?: boolean | undefined;
357
379
  } | {
358
380
  t: "service";
@@ -438,6 +460,10 @@ export declare const SessionProtocolMessageSchema: z.ZodObject<{
438
460
  } | {
439
461
  t: "text";
440
462
  text: string;
463
+ images?: {
464
+ data: string;
465
+ mediaType: string;
466
+ }[] | undefined;
441
467
  thinking?: boolean | undefined;
442
468
  } | {
443
469
  t: "service";
@@ -523,6 +549,10 @@ export declare const SessionProtocolMessageSchema: z.ZodObject<{
523
549
  } | {
524
550
  t: "text";
525
551
  text: string;
552
+ images?: {
553
+ data: string;
554
+ mediaType: string;
555
+ }[] | undefined;
526
556
  thinking?: boolean | undefined;
527
557
  } | {
528
558
  t: "service";
@@ -608,6 +638,10 @@ export declare const SessionProtocolMessageSchema: z.ZodObject<{
608
638
  } | {
609
639
  t: "text";
610
640
  text: string;
641
+ images?: {
642
+ data: string;
643
+ mediaType: string;
644
+ }[] | undefined;
611
645
  thinking?: boolean | undefined;
612
646
  } | {
613
647
  t: "service";
@@ -736,6 +770,10 @@ export declare const SessionProtocolMessageSchema: z.ZodObject<{
736
770
  } | {
737
771
  t: "text";
738
772
  text: string;
773
+ images?: {
774
+ data: string;
775
+ mediaType: string;
776
+ }[] | undefined;
739
777
  thinking?: boolean | undefined;
740
778
  } | {
741
779
  t: "service";
@@ -838,6 +876,10 @@ export declare const SessionProtocolMessageSchema: z.ZodObject<{
838
876
  } | {
839
877
  t: "text";
840
878
  text: string;
879
+ images?: {
880
+ data: string;
881
+ mediaType: string;
882
+ }[] | undefined;
841
883
  thinking?: boolean | undefined;
842
884
  } | {
843
885
  t: "service";
@@ -1105,13 +1147,31 @@ export declare const MessageContentSchema: z.ZodDiscriminatedUnion<"role", [z.Zo
1105
1147
  t: z.ZodLiteral<"text">;
1106
1148
  text: z.ZodString;
1107
1149
  thinking: z.ZodOptional<z.ZodBoolean>;
1150
+ images: z.ZodOptional<z.ZodArray<z.ZodObject<{
1151
+ data: z.ZodString;
1152
+ mediaType: z.ZodString;
1153
+ }, "strip", z.ZodTypeAny, {
1154
+ data: string;
1155
+ mediaType: string;
1156
+ }, {
1157
+ data: string;
1158
+ mediaType: string;
1159
+ }>, "many">>;
1108
1160
  }, "strip", z.ZodTypeAny, {
1109
1161
  t: "text";
1110
1162
  text: string;
1163
+ images?: {
1164
+ data: string;
1165
+ mediaType: string;
1166
+ }[] | undefined;
1111
1167
  thinking?: boolean | undefined;
1112
1168
  }, {
1113
1169
  t: "text";
1114
1170
  text: string;
1171
+ images?: {
1172
+ data: string;
1173
+ mediaType: string;
1174
+ }[] | undefined;
1115
1175
  thinking?: boolean | undefined;
1116
1176
  }>, z.ZodObject<{
1117
1177
  t: z.ZodLiteral<"service">;
@@ -1391,6 +1451,10 @@ export declare const MessageContentSchema: z.ZodDiscriminatedUnion<"role", [z.Zo
1391
1451
  } | {
1392
1452
  t: "text";
1393
1453
  text: string;
1454
+ images?: {
1455
+ data: string;
1456
+ mediaType: string;
1457
+ }[] | undefined;
1394
1458
  thinking?: boolean | undefined;
1395
1459
  } | {
1396
1460
  t: "service";
@@ -1476,6 +1540,10 @@ export declare const MessageContentSchema: z.ZodDiscriminatedUnion<"role", [z.Zo
1476
1540
  } | {
1477
1541
  t: "text";
1478
1542
  text: string;
1543
+ images?: {
1544
+ data: string;
1545
+ mediaType: string;
1546
+ }[] | undefined;
1479
1547
  thinking?: boolean | undefined;
1480
1548
  } | {
1481
1549
  t: "service";
@@ -1561,6 +1629,10 @@ export declare const MessageContentSchema: z.ZodDiscriminatedUnion<"role", [z.Zo
1561
1629
  } | {
1562
1630
  t: "text";
1563
1631
  text: string;
1632
+ images?: {
1633
+ data: string;
1634
+ mediaType: string;
1635
+ }[] | undefined;
1564
1636
  thinking?: boolean | undefined;
1565
1637
  } | {
1566
1638
  t: "service";
@@ -1646,6 +1718,10 @@ export declare const MessageContentSchema: z.ZodDiscriminatedUnion<"role", [z.Zo
1646
1718
  } | {
1647
1719
  t: "text";
1648
1720
  text: string;
1721
+ images?: {
1722
+ data: string;
1723
+ mediaType: string;
1724
+ }[] | undefined;
1649
1725
  thinking?: boolean | undefined;
1650
1726
  } | {
1651
1727
  t: "service";
@@ -1774,6 +1850,10 @@ export declare const MessageContentSchema: z.ZodDiscriminatedUnion<"role", [z.Zo
1774
1850
  } | {
1775
1851
  t: "text";
1776
1852
  text: string;
1853
+ images?: {
1854
+ data: string;
1855
+ mediaType: string;
1856
+ }[] | undefined;
1777
1857
  thinking?: boolean | undefined;
1778
1858
  } | {
1779
1859
  t: "service";
@@ -1876,6 +1956,10 @@ export declare const MessageContentSchema: z.ZodDiscriminatedUnion<"role", [z.Zo
1876
1956
  } | {
1877
1957
  t: "text";
1878
1958
  text: string;
1959
+ images?: {
1960
+ data: string;
1961
+ mediaType: string;
1962
+ }[] | undefined;
1879
1963
  thinking?: boolean | undefined;
1880
1964
  } | {
1881
1965
  t: "service";
package/dist/messages.js CHANGED
@@ -1,35 +1 @@
1
- /**
2
- * Message schemas — aligned with Happy messages.ts.
3
- *
4
- * SessionMessage: encrypted content container.
5
- * Timestamps are Unix numbers (milliseconds).
6
- */
7
- import { z } from 'zod';
8
- import { SessionEnvelopeSchema } from './envelope.js';
9
- import { MessageMetaSchema } from './messageMeta.js';
10
- import { UserMessageSchema, AgentMessageSchema } from './legacyProtocol.js';
11
- export const SessionMessageContentSchema = z.object({
12
- c: z.string(),
13
- t: z.enum(['encrypted', 'plaintext']),
14
- });
15
- export const SessionMessageSchema = z.object({
16
- id: z.string(),
17
- seq: z.number(),
18
- localId: z.string().nullish(),
19
- content: SessionMessageContentSchema,
20
- createdAt: z.number(),
21
- updatedAt: z.number(),
22
- });
23
- // ── SessionProtocolMessage (bridges envelope into message content) ──
24
- export const SessionProtocolMessageSchema = z.object({
25
- role: z.literal('session'),
26
- content: SessionEnvelopeSchema,
27
- meta: MessageMetaSchema.optional(),
28
- });
29
- // ── MessageContent (union of all message content types) ─────────────
30
- export const MessageContentSchema = z.discriminatedUnion('role', [
31
- UserMessageSchema,
32
- AgentMessageSchema,
33
- SessionProtocolMessageSchema,
34
- ]);
35
- //# sourceMappingURL=messages.js.map
1
+ "use strict";import{z as e}from"zod";import{SessionEnvelopeSchema as t}from"./envelope.js";import{MessageMetaSchema as o}from"./messageMeta.js";import{UserMessageSchema as s,AgentMessageSchema as n}from"./legacyProtocol.js";export const SessionMessageContentSchema=e.object({c:e.string(),t:e.enum(["encrypted","plaintext"])}),SessionMessageSchema=e.object({id:e.string(),seq:e.number(),localId:e.string().nullish(),content:SessionMessageContentSchema,createdAt:e.number(),updatedAt:e.number()}),SessionProtocolMessageSchema=e.object({role:e.literal("session"),content:t,meta:o.optional()}),MessageContentSchema=e.discriminatedUnion("role",[s,n,SessionProtocolMessageSchema]);
package/dist/ops.js CHANGED
@@ -1,74 +1 @@
1
- import { z } from 'zod';
2
- /**
3
- * Ops RPC method naming convention: namespace.action
4
- * - file.* — RFC-033 file management
5
- * - sync.* — RFC-034 data sync (Ops Agent → Server)
6
- * - config.* — RFC-034 policy push (Server → Ops Agent)
7
- */
8
- export const OpsMethodSchema = z
9
- .string()
10
- .min(1)
11
- .regex(/^[a-z]+\.[a-z][a-z0-9-]*$/);
12
- export const OpsRpcTypeSchema = z.enum(['request', 'response', 'event']);
13
- /** Unified RPC message over the ops-upstream tunnel. */
14
- export const OpsRpcMessageSchema = z.object({
15
- id: z.string().min(1),
16
- type: OpsRpcTypeSchema,
17
- method: OpsMethodSchema,
18
- payload: z.unknown(),
19
- });
20
- // FileEntry — directory listing item
21
- export const FileEntrySchema = z.object({
22
- name: z.string(),
23
- type: z.enum(['file', 'directory']),
24
- size: z.number().int().nonnegative(),
25
- modifiedAt: z.string(),
26
- mimeType: z.string().optional(),
27
- });
28
- // FileStat — detailed metadata
29
- export const FileStatSchema = z.object({
30
- name: z.string(),
31
- path: z.string(),
32
- type: z.enum(['file', 'directory']),
33
- size: z.number().int().nonnegative(),
34
- modifiedAt: z.string(),
35
- createdAt: z.string(),
36
- mimeType: z.string().optional(),
37
- });
38
- // StorageUsage — quota info
39
- export const StorageUsageSchema = z.object({
40
- used: z.number().int().nonnegative(),
41
- limit: z.number().int().nonnegative(),
42
- fileCount: z.number().int().nonnegative(),
43
- });
44
- // ─── Sync payloads (RFC-034 P1) ─────────────────────────
45
- /** A single user record in a full sync push. */
46
- export const SyncUserSchema = z.object({
47
- username: z.string().min(1),
48
- displayName: z.string(),
49
- machineId: z.string().nullable(),
50
- containerStatus: z.string(),
51
- healthStatus: z.string().nullable(),
52
- enabled: z.boolean(),
53
- });
54
- /** sync.full — all users pushed on tunnel connect/reconnect. */
55
- export const SyncFullPayloadSchema = z.object({
56
- users: z.array(SyncUserSchema),
57
- });
58
- /** sync.user-created — single user just created. */
59
- export const SyncUserCreatedPayloadSchema = z.object({
60
- username: z.string().min(1),
61
- displayName: z.string(),
62
- });
63
- /** sync.container-status — container state change. */
64
- export const SyncContainerStatusPayloadSchema = z.object({
65
- username: z.string().min(1),
66
- containerStatus: z.string(),
67
- healthStatus: z.string().nullable().optional(),
68
- });
69
- /** sync.user-paired — daemon pairing detected, machineId available. */
70
- export const SyncUserPairedPayloadSchema = z.object({
71
- username: z.string().min(1),
72
- machineId: z.string().min(1),
73
- });
74
- //# sourceMappingURL=ops.js.map
1
+ "use strict";import{z as e}from"zod";export const OpsMethodSchema=e.string().min(1).regex(/^[a-z]+\.[a-z][a-z0-9-]*$/),OpsRpcTypeSchema=e.enum(["request","response","event"]),OpsRpcMessageSchema=e.object({id:e.string().min(1),type:OpsRpcTypeSchema,method:OpsMethodSchema,payload:e.unknown()}),FileEntrySchema=e.object({name:e.string(),type:e.enum(["file","directory"]),size:e.number().int().nonnegative(),modifiedAt:e.string(),mimeType:e.string().optional()}),FileStatSchema=e.object({name:e.string(),path:e.string(),type:e.enum(["file","directory"]),size:e.number().int().nonnegative(),modifiedAt:e.string(),createdAt:e.string(),mimeType:e.string().optional()}),StorageUsageSchema=e.object({used:e.number().int().nonnegative(),limit:e.number().int().nonnegative(),fileCount:e.number().int().nonnegative()}),SyncUserSchema=e.object({username:e.string().min(1),displayName:e.string(),machineId:e.string().nullable(),containerStatus:e.string(),healthStatus:e.string().nullable(),enabled:e.boolean()}),SyncFullPayloadSchema=e.object({users:e.array(SyncUserSchema)}),SyncUserCreatedPayloadSchema=e.object({username:e.string().min(1),displayName:e.string()}),SyncContainerStatusPayloadSchema=e.object({username:e.string().min(1),containerStatus:e.string(),healthStatus:e.string().nullable().optional()}),SyncUserPairedPayloadSchema=e.object({username:e.string().min(1),machineId:e.string().min(1)});
package/dist/pairing.js CHANGED
@@ -1,115 +1 @@
1
- /**
2
- * Pairing protocol schemas.
3
- *
4
- * Defines the wire format for device pairing:
5
- * - PairingRequest: CLI sends publicKey + optional PIN to server
6
- * - PairingResponse: Web sends encrypted payload back via server
7
- * - PairingStatus: Polling response — discriminated union on state
8
- *
9
- * Security: Uses NaCl Box (Curve25519 + XSalsa20-Poly1305) for key exchange.
10
- * PIN code provides iOS PWA fallback where QR scanning is unreliable.
11
- */
12
- import { z } from 'zod';
13
- /** 6-digit numeric PIN for iOS PWA fallback. */
14
- const PinSchema = z.string().regex(/^\d{6}$/, 'PIN must be exactly 6 digits');
15
- /** Pairing state machine. */
16
- export const PairingState = z.enum(['pending', 'exchange', 'authorized', 'expired']);
17
- /**
18
- * Validates that a string is a base64/base64url-encoded 32-byte Curve25519 public key.
19
- * Accepts both standard base64 (with padding) and base64url (without padding).
20
- */
21
- /**
22
- * Check if a base64/base64url string decodes to exactly `expectedBytes` bytes.
23
- * Uses string-length math: 4 base64 chars = 3 bytes.
24
- * No runtime decoding needed — just validate charset + length.
25
- */
26
- function isBase64OfLength(val, expectedBytes) {
27
- // Must be non-empty and only valid base64/base64url characters
28
- if (!/^[A-Za-z0-9+/\-_]+=*$/.test(val))
29
- return false;
30
- // Normalize base64url → standard base64
31
- const b64 = val.replace(/-/g, '+').replace(/_/g, '/');
32
- const padded = b64.padEnd(b64.length + ((4 - (b64.length % 4)) % 4), '=');
33
- // Count padding
34
- const paddingCount = (padded.match(/=+$/) ?? [''])[0].length;
35
- const totalBytes = (padded.length / 4) * 3 - paddingCount;
36
- return totalBytes === expectedBytes;
37
- }
38
- const Curve25519PublicKeySchema = z
39
- .string()
40
- .min(1)
41
- .refine((val) => isBase64OfLength(val, 32), {
42
- message: 'publicKey must be a base64-encoded 32-byte Curve25519 key',
43
- });
44
- /**
45
- * CLI → Server: initiate a pairing request.
46
- *
47
- * publicKey: base64-encoded Curve25519 public key (32 bytes)
48
- * pin: optional 6-digit PIN for manual entry (iOS PWA fallback)
49
- * label: optional human-readable device label
50
- */
51
- export const PairingRequestSchema = z.object({
52
- publicKey: Curve25519PublicKeySchema,
53
- pin: PinSchema.optional(),
54
- label: z.string().max(100).optional(),
55
- type: z.enum(['join', 'invite']).optional(),
56
- });
57
- /**
58
- * Web → Server: approve pairing with encrypted key material.
59
- *
60
- * publicKey: identifies which pairing request to respond to (32-byte Curve25519 key)
61
- * encryptedPayload: NaCl Box encrypted data (base64) containing the DEK
62
- */
63
- export const PairingResponseSchema = z.object({
64
- publicKey: Curve25519PublicKeySchema,
65
- encryptedPayload: z.string().min(1),
66
- });
67
- /**
68
- * New device → Server: submit device's temporary Curve25519 public key.
69
- * Used in invite flow when a new device joins an existing account.
70
- */
71
- export const PairingExchangeSchema = z.object({
72
- daemonPublicKey: Curve25519PublicKeySchema,
73
- devicePublicKey: Curve25519PublicKeySchema,
74
- });
75
- /**
76
- * Daemon → Server: deliver encrypted master secret to new device.
77
- * Requires Bearer auth. Encrypted via NaCl Box using device's public key.
78
- */
79
- export const PairingDeliverSchema = z.object({
80
- publicKey: Curve25519PublicKeySchema,
81
- encryptedPayload: z.string().min(1),
82
- });
83
- /**
84
- * Server → CLI: current pairing status (polled).
85
- * Discriminated union on `state`:
86
- * - pending: waiting for web approval
87
- * - authorized: web approved, encryptedPayload + token required
88
- * - expired: request timed out
89
- */
90
- const PairingStatusPending = z.object({
91
- state: z.literal('pending'),
92
- publicKey: z.string().min(1),
93
- });
94
- const PairingStatusExchange = z.object({
95
- state: z.literal('exchange'),
96
- publicKey: z.string().min(1),
97
- devicePublicKey: z.string().min(1),
98
- });
99
- const PairingStatusAuthorized = z.object({
100
- state: z.literal('authorized'),
101
- publicKey: z.string().min(1),
102
- encryptedPayload: z.string().min(1),
103
- token: z.string().min(1),
104
- });
105
- const PairingStatusExpired = z.object({
106
- state: z.literal('expired'),
107
- publicKey: z.string().min(1),
108
- });
109
- export const PairingStatusSchema = z.discriminatedUnion('state', [
110
- PairingStatusPending,
111
- PairingStatusExchange,
112
- PairingStatusAuthorized,
113
- PairingStatusExpired,
114
- ]);
115
- //# sourceMappingURL=pairing.js.map
1
+ "use strict";import{z as e}from"zod";const o=e.string().regex(/^\d{6}$/,"PIN must be exactly 6 digits");export const PairingState=e.enum(["pending","exchange","authorized","expired"]);function s(i,c){if(!/^[A-Za-z0-9+/\-_]+=*$/.test(i))return!1;const n=i.replace(/-/g,"+").replace(/_/g,"/"),a=n.padEnd(n.length+(4-n.length%4)%4,"="),r=(a.match(/=+$/)??[""])[0].length;return a.length/4*3-r===c}const t=e.string().min(1).refine(i=>s(i,32),{message:"publicKey must be a base64-encoded 32-byte Curve25519 key"});export const PairingRequestSchema=e.object({publicKey:t,pin:o.optional(),label:e.string().max(100).optional(),type:e.enum(["join","invite"]).optional()}),PairingResponseSchema=e.object({publicKey:t,encryptedPayload:e.string().min(1)}),PairingExchangeSchema=e.object({daemonPublicKey:t,devicePublicKey:t}),PairingDeliverSchema=e.object({publicKey:t,encryptedPayload:e.string().min(1)});const g=e.object({state:e.literal("pending"),publicKey:e.string().min(1)}),l=e.object({state:e.literal("exchange"),publicKey:e.string().min(1),devicePublicKey:e.string().min(1)}),p=e.object({state:e.literal("authorized"),publicKey:e.string().min(1),encryptedPayload:e.string().min(1),token:e.string().min(1)}),d=e.object({state:e.literal("expired"),publicKey:e.string().min(1)});export const PairingStatusSchema=e.discriminatedUnion("state",[g,l,p,d]);
package/dist/protocol.js CHANGED
@@ -1,7 +1 @@
1
- /**
2
- * Wire protocol version.
3
- * Increment ONLY on breaking schema changes (new enum values, renamed events, required fields).
4
- * See RFC-021 for the full versioning strategy.
5
- */
6
- export const PROTOCOL_VERSION = 1;
7
- //# sourceMappingURL=protocol.js.map
1
+ "use strict";export const PROTOCOL_VERSION=1;