@sonde/shared 0.0.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.
Files changed (58) hide show
  1. package/dist/crypto/signing.d.ts +12 -0
  2. package/dist/crypto/signing.d.ts.map +1 -0
  3. package/dist/crypto/signing.js +35 -0
  4. package/dist/crypto/signing.js.map +1 -0
  5. package/dist/crypto/signing.test.d.ts +2 -0
  6. package/dist/crypto/signing.test.d.ts.map +1 -0
  7. package/dist/crypto/signing.test.js +57 -0
  8. package/dist/crypto/signing.test.js.map +1 -0
  9. package/dist/index.d.ts +10 -0
  10. package/dist/index.d.ts.map +1 -0
  11. package/dist/index.js +17 -0
  12. package/dist/index.js.map +1 -0
  13. package/dist/schemas/attestation.d.ts +42 -0
  14. package/dist/schemas/attestation.d.ts.map +1 -0
  15. package/dist/schemas/attestation.js +14 -0
  16. package/dist/schemas/attestation.js.map +1 -0
  17. package/dist/schemas/mcp.d.ts +174 -0
  18. package/dist/schemas/mcp.d.ts.map +1 -0
  19. package/dist/schemas/mcp.js +49 -0
  20. package/dist/schemas/mcp.js.map +1 -0
  21. package/dist/schemas/packs.d.ts +367 -0
  22. package/dist/schemas/packs.d.ts.map +1 -0
  23. package/dist/schemas/packs.js +81 -0
  24. package/dist/schemas/packs.js.map +1 -0
  25. package/dist/schemas/probes.d.ts +83 -0
  26. package/dist/schemas/probes.d.ts.map +1 -0
  27. package/dist/schemas/probes.js +38 -0
  28. package/dist/schemas/probes.js.map +1 -0
  29. package/dist/schemas/protocol.d.ts +35 -0
  30. package/dist/schemas/protocol.d.ts.map +1 -0
  31. package/dist/schemas/protocol.js +21 -0
  32. package/dist/schemas/protocol.js.map +1 -0
  33. package/dist/types/agent.d.ts +62 -0
  34. package/dist/types/agent.d.ts.map +1 -0
  35. package/dist/types/agent.js +17 -0
  36. package/dist/types/agent.js.map +1 -0
  37. package/dist/types/common.d.ts +18 -0
  38. package/dist/types/common.d.ts.map +1 -0
  39. package/dist/types/common.js +21 -0
  40. package/dist/types/common.js.map +1 -0
  41. package/dist/types/hub.d.ts +27 -0
  42. package/dist/types/hub.d.ts.map +1 -0
  43. package/dist/types/hub.js +15 -0
  44. package/dist/types/hub.js.map +1 -0
  45. package/package.json +26 -0
  46. package/src/crypto/signing.test.ts +65 -0
  47. package/src/crypto/signing.ts +38 -0
  48. package/src/index.ts +44 -0
  49. package/src/schemas/attestation.ts +15 -0
  50. package/src/schemas/mcp.ts +56 -0
  51. package/src/schemas/packs.ts +94 -0
  52. package/src/schemas/probes.ts +41 -0
  53. package/src/schemas/protocol.ts +22 -0
  54. package/src/types/agent.ts +20 -0
  55. package/src/types/common.ts +33 -0
  56. package/src/types/hub.ts +16 -0
  57. package/tsconfig.json +8 -0
  58. package/vitest.config.ts +8 -0
@@ -0,0 +1,367 @@
1
+ import { z } from 'zod';
2
+ /** Parameter definition for a probe */
3
+ export declare const ProbeParamDef: z.ZodObject<{
4
+ type: z.ZodEnum<["string", "number", "boolean"]>;
5
+ description: z.ZodString;
6
+ required: z.ZodDefault<z.ZodBoolean>;
7
+ default: z.ZodOptional<z.ZodUnknown>;
8
+ }, "strip", z.ZodTypeAny, {
9
+ type: "string" | "number" | "boolean";
10
+ description: string;
11
+ required: boolean;
12
+ default?: unknown;
13
+ }, {
14
+ type: "string" | "number" | "boolean";
15
+ description: string;
16
+ required?: boolean | undefined;
17
+ default?: unknown;
18
+ }>;
19
+ export type ProbeParamDef = z.infer<typeof ProbeParamDef>;
20
+ /** Database role access requirement */
21
+ export declare const DbRoleRequirement: z.ZodObject<{
22
+ type: z.ZodEnum<["postgres", "mysql", "mongodb"]>;
23
+ access: z.ZodEnum<["read-only", "read-write"]>;
24
+ }, "strip", z.ZodTypeAny, {
25
+ type: "postgres" | "mysql" | "mongodb";
26
+ access: "read-only" | "read-write";
27
+ }, {
28
+ type: "postgres" | "mysql" | "mongodb";
29
+ access: "read-only" | "read-write";
30
+ }>;
31
+ export type DbRoleRequirement = z.infer<typeof DbRoleRequirement>;
32
+ /** System access requirements for a pack */
33
+ export declare const PackRequirements: z.ZodObject<{
34
+ /** OS groups needed */
35
+ groups: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
36
+ /** File paths needed (glob OK) */
37
+ files: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
38
+ /** Binaries that must exist in PATH */
39
+ commands: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
40
+ /** Database access if needed */
41
+ dbRole: z.ZodOptional<z.ZodObject<{
42
+ type: z.ZodEnum<["postgres", "mysql", "mongodb"]>;
43
+ access: z.ZodEnum<["read-only", "read-write"]>;
44
+ }, "strip", z.ZodTypeAny, {
45
+ type: "postgres" | "mysql" | "mongodb";
46
+ access: "read-only" | "read-write";
47
+ }, {
48
+ type: "postgres" | "mysql" | "mongodb";
49
+ access: "read-only" | "read-write";
50
+ }>>;
51
+ }, "strip", z.ZodTypeAny, {
52
+ groups: string[];
53
+ files: string[];
54
+ commands: string[];
55
+ dbRole?: {
56
+ type: "postgres" | "mysql" | "mongodb";
57
+ access: "read-only" | "read-write";
58
+ } | undefined;
59
+ }, {
60
+ groups?: string[] | undefined;
61
+ files?: string[] | undefined;
62
+ commands?: string[] | undefined;
63
+ dbRole?: {
64
+ type: "postgres" | "mysql" | "mongodb";
65
+ access: "read-only" | "read-write";
66
+ } | undefined;
67
+ }>;
68
+ export type PackRequirements = z.infer<typeof PackRequirements>;
69
+ /** Probe definition within a pack */
70
+ export declare const ProbeDefinition: z.ZodObject<{
71
+ /** Probe name, e.g. "containers.list" */
72
+ name: z.ZodString;
73
+ /** Human-readable description */
74
+ description: z.ZodString;
75
+ /** Capability level required to execute */
76
+ capability: z.ZodEnum<["observe", "interact", "manage"]>;
77
+ /** Parameter definitions */
78
+ params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
79
+ type: z.ZodEnum<["string", "number", "boolean"]>;
80
+ description: z.ZodString;
81
+ required: z.ZodDefault<z.ZodBoolean>;
82
+ default: z.ZodOptional<z.ZodUnknown>;
83
+ }, "strip", z.ZodTypeAny, {
84
+ type: "string" | "number" | "boolean";
85
+ description: string;
86
+ required: boolean;
87
+ default?: unknown;
88
+ }, {
89
+ type: "string" | "number" | "boolean";
90
+ description: string;
91
+ required?: boolean | undefined;
92
+ default?: unknown;
93
+ }>>>;
94
+ /** Probe timeout in ms */
95
+ timeout: z.ZodDefault<z.ZodNumber>;
96
+ }, "strip", z.ZodTypeAny, {
97
+ timeout: number;
98
+ name: string;
99
+ description: string;
100
+ capability: "observe" | "interact" | "manage";
101
+ params?: Record<string, {
102
+ type: "string" | "number" | "boolean";
103
+ description: string;
104
+ required: boolean;
105
+ default?: unknown;
106
+ }> | undefined;
107
+ }, {
108
+ name: string;
109
+ description: string;
110
+ capability: "observe" | "interact" | "manage";
111
+ params?: Record<string, {
112
+ type: "string" | "number" | "boolean";
113
+ description: string;
114
+ required?: boolean | undefined;
115
+ default?: unknown;
116
+ }> | undefined;
117
+ timeout?: number | undefined;
118
+ }>;
119
+ export type ProbeDefinition = z.infer<typeof ProbeDefinition>;
120
+ /** Runbook definition (diagnostic workflow) */
121
+ export declare const RunbookDefinition: z.ZodObject<{
122
+ /** Category this runbook covers, e.g. "docker" */
123
+ category: z.ZodString;
124
+ /** Ordered list of probe names to run */
125
+ probes: z.ZodArray<z.ZodString, "many">;
126
+ /** Whether to run probes in parallel */
127
+ parallel: z.ZodDefault<z.ZodBoolean>;
128
+ }, "strip", z.ZodTypeAny, {
129
+ category: string;
130
+ probes: string[];
131
+ parallel: boolean;
132
+ }, {
133
+ category: string;
134
+ probes: string[];
135
+ parallel?: boolean | undefined;
136
+ }>;
137
+ export type RunbookDefinition = z.infer<typeof RunbookDefinition>;
138
+ /** Detection rules for auto-discovering installed software */
139
+ export declare const DetectRules: z.ZodObject<{
140
+ /** Check if these commands exist in PATH */
141
+ commands: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
142
+ /** Check if these files exist */
143
+ files: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
144
+ /** Check if these systemd services exist */
145
+ services: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
146
+ }, "strip", z.ZodTypeAny, {
147
+ files?: string[] | undefined;
148
+ commands?: string[] | undefined;
149
+ services?: string[] | undefined;
150
+ }, {
151
+ files?: string[] | undefined;
152
+ commands?: string[] | undefined;
153
+ services?: string[] | undefined;
154
+ }>;
155
+ export type DetectRules = z.infer<typeof DetectRules>;
156
+ /**
157
+ * Full pack manifest schema.
158
+ * Defines a pack's metadata, requirements, probes, runbook, and detection rules.
159
+ */
160
+ export declare const PackManifest: z.ZodObject<{
161
+ /** Pack name, e.g. "docker" */
162
+ name: z.ZodString;
163
+ /** Semver version */
164
+ version: z.ZodString;
165
+ /** Human-readable description */
166
+ description: z.ZodString;
167
+ /** Pack author */
168
+ author: z.ZodOptional<z.ZodString>;
169
+ /** Code signature (base64) */
170
+ signature: z.ZodOptional<z.ZodString>;
171
+ /** System access requirements */
172
+ requires: z.ZodObject<{
173
+ /** OS groups needed */
174
+ groups: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
175
+ /** File paths needed (glob OK) */
176
+ files: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
177
+ /** Binaries that must exist in PATH */
178
+ commands: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
179
+ /** Database access if needed */
180
+ dbRole: z.ZodOptional<z.ZodObject<{
181
+ type: z.ZodEnum<["postgres", "mysql", "mongodb"]>;
182
+ access: z.ZodEnum<["read-only", "read-write"]>;
183
+ }, "strip", z.ZodTypeAny, {
184
+ type: "postgres" | "mysql" | "mongodb";
185
+ access: "read-only" | "read-write";
186
+ }, {
187
+ type: "postgres" | "mysql" | "mongodb";
188
+ access: "read-only" | "read-write";
189
+ }>>;
190
+ }, "strip", z.ZodTypeAny, {
191
+ groups: string[];
192
+ files: string[];
193
+ commands: string[];
194
+ dbRole?: {
195
+ type: "postgres" | "mysql" | "mongodb";
196
+ access: "read-only" | "read-write";
197
+ } | undefined;
198
+ }, {
199
+ groups?: string[] | undefined;
200
+ files?: string[] | undefined;
201
+ commands?: string[] | undefined;
202
+ dbRole?: {
203
+ type: "postgres" | "mysql" | "mongodb";
204
+ access: "read-only" | "read-write";
205
+ } | undefined;
206
+ }>;
207
+ /** Probes this pack provides */
208
+ probes: z.ZodArray<z.ZodObject<{
209
+ /** Probe name, e.g. "containers.list" */
210
+ name: z.ZodString;
211
+ /** Human-readable description */
212
+ description: z.ZodString;
213
+ /** Capability level required to execute */
214
+ capability: z.ZodEnum<["observe", "interact", "manage"]>;
215
+ /** Parameter definitions */
216
+ params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
217
+ type: z.ZodEnum<["string", "number", "boolean"]>;
218
+ description: z.ZodString;
219
+ required: z.ZodDefault<z.ZodBoolean>;
220
+ default: z.ZodOptional<z.ZodUnknown>;
221
+ }, "strip", z.ZodTypeAny, {
222
+ type: "string" | "number" | "boolean";
223
+ description: string;
224
+ required: boolean;
225
+ default?: unknown;
226
+ }, {
227
+ type: "string" | "number" | "boolean";
228
+ description: string;
229
+ required?: boolean | undefined;
230
+ default?: unknown;
231
+ }>>>;
232
+ /** Probe timeout in ms */
233
+ timeout: z.ZodDefault<z.ZodNumber>;
234
+ }, "strip", z.ZodTypeAny, {
235
+ timeout: number;
236
+ name: string;
237
+ description: string;
238
+ capability: "observe" | "interact" | "manage";
239
+ params?: Record<string, {
240
+ type: "string" | "number" | "boolean";
241
+ description: string;
242
+ required: boolean;
243
+ default?: unknown;
244
+ }> | undefined;
245
+ }, {
246
+ name: string;
247
+ description: string;
248
+ capability: "observe" | "interact" | "manage";
249
+ params?: Record<string, {
250
+ type: "string" | "number" | "boolean";
251
+ description: string;
252
+ required?: boolean | undefined;
253
+ default?: unknown;
254
+ }> | undefined;
255
+ timeout?: number | undefined;
256
+ }>, "many">;
257
+ /** Default diagnostic runbook */
258
+ runbook: z.ZodOptional<z.ZodObject<{
259
+ /** Category this runbook covers, e.g. "docker" */
260
+ category: z.ZodString;
261
+ /** Ordered list of probe names to run */
262
+ probes: z.ZodArray<z.ZodString, "many">;
263
+ /** Whether to run probes in parallel */
264
+ parallel: z.ZodDefault<z.ZodBoolean>;
265
+ }, "strip", z.ZodTypeAny, {
266
+ category: string;
267
+ probes: string[];
268
+ parallel: boolean;
269
+ }, {
270
+ category: string;
271
+ probes: string[];
272
+ parallel?: boolean | undefined;
273
+ }>>;
274
+ /** Rules for auto-detecting this software on the system */
275
+ detect: z.ZodOptional<z.ZodObject<{
276
+ /** Check if these commands exist in PATH */
277
+ commands: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
278
+ /** Check if these files exist */
279
+ files: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
280
+ /** Check if these systemd services exist */
281
+ services: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
282
+ }, "strip", z.ZodTypeAny, {
283
+ files?: string[] | undefined;
284
+ commands?: string[] | undefined;
285
+ services?: string[] | undefined;
286
+ }, {
287
+ files?: string[] | undefined;
288
+ commands?: string[] | undefined;
289
+ services?: string[] | undefined;
290
+ }>>;
291
+ }, "strip", z.ZodTypeAny, {
292
+ name: string;
293
+ version: string;
294
+ description: string;
295
+ probes: {
296
+ timeout: number;
297
+ name: string;
298
+ description: string;
299
+ capability: "observe" | "interact" | "manage";
300
+ params?: Record<string, {
301
+ type: "string" | "number" | "boolean";
302
+ description: string;
303
+ required: boolean;
304
+ default?: unknown;
305
+ }> | undefined;
306
+ }[];
307
+ requires: {
308
+ groups: string[];
309
+ files: string[];
310
+ commands: string[];
311
+ dbRole?: {
312
+ type: "postgres" | "mysql" | "mongodb";
313
+ access: "read-only" | "read-write";
314
+ } | undefined;
315
+ };
316
+ signature?: string | undefined;
317
+ author?: string | undefined;
318
+ runbook?: {
319
+ category: string;
320
+ probes: string[];
321
+ parallel: boolean;
322
+ } | undefined;
323
+ detect?: {
324
+ files?: string[] | undefined;
325
+ commands?: string[] | undefined;
326
+ services?: string[] | undefined;
327
+ } | undefined;
328
+ }, {
329
+ name: string;
330
+ version: string;
331
+ description: string;
332
+ probes: {
333
+ name: string;
334
+ description: string;
335
+ capability: "observe" | "interact" | "manage";
336
+ params?: Record<string, {
337
+ type: "string" | "number" | "boolean";
338
+ description: string;
339
+ required?: boolean | undefined;
340
+ default?: unknown;
341
+ }> | undefined;
342
+ timeout?: number | undefined;
343
+ }[];
344
+ requires: {
345
+ groups?: string[] | undefined;
346
+ files?: string[] | undefined;
347
+ commands?: string[] | undefined;
348
+ dbRole?: {
349
+ type: "postgres" | "mysql" | "mongodb";
350
+ access: "read-only" | "read-write";
351
+ } | undefined;
352
+ };
353
+ signature?: string | undefined;
354
+ author?: string | undefined;
355
+ runbook?: {
356
+ category: string;
357
+ probes: string[];
358
+ parallel?: boolean | undefined;
359
+ } | undefined;
360
+ detect?: {
361
+ files?: string[] | undefined;
362
+ commands?: string[] | undefined;
363
+ services?: string[] | undefined;
364
+ } | undefined;
365
+ }>;
366
+ export type PackManifest = z.infer<typeof PackManifest>;
367
+ //# sourceMappingURL=packs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"packs.d.ts","sourceRoot":"","sources":["../../src/schemas/packs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,uCAAuC;AACvC,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;EAKxB,CAAC;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAE1D,uCAAuC;AACvC,eAAO,MAAM,iBAAiB;;;;;;;;;EAG5B,CAAC;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAElE,4CAA4C;AAC5C,eAAO,MAAM,gBAAgB;IAC3B,uBAAuB;;IAEvB,kCAAkC;;IAElC,uCAAuC;;IAEvC,gCAAgC;;;;;;;;;;;;;;;;;;;;;;;;;;;EAEhC,C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5C,iCAAiC;;QAEjC,4CAA4C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4B5C,CAAC;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC"}
@@ -0,0 +1,81 @@
1
+ import { z } from 'zod';
2
+ import { CapabilityLevel, DEFAULT_PROBE_TIMEOUT_MS } from '../types/common.js';
3
+ /** Parameter definition for a probe */
4
+ export const ProbeParamDef = z.object({
5
+ type: z.enum(['string', 'number', 'boolean']),
6
+ description: z.string(),
7
+ required: z.boolean().default(false),
8
+ default: z.unknown().optional(),
9
+ });
10
+ /** Database role access requirement */
11
+ export const DbRoleRequirement = z.object({
12
+ type: z.enum(['postgres', 'mysql', 'mongodb']),
13
+ access: z.enum(['read-only', 'read-write']),
14
+ });
15
+ /** System access requirements for a pack */
16
+ export const PackRequirements = z.object({
17
+ /** OS groups needed */
18
+ groups: z.array(z.string()).default([]),
19
+ /** File paths needed (glob OK) */
20
+ files: z.array(z.string()).default([]),
21
+ /** Binaries that must exist in PATH */
22
+ commands: z.array(z.string()).default([]),
23
+ /** Database access if needed */
24
+ dbRole: DbRoleRequirement.optional(),
25
+ });
26
+ /** Probe definition within a pack */
27
+ export const ProbeDefinition = z.object({
28
+ /** Probe name, e.g. "containers.list" */
29
+ name: z.string(),
30
+ /** Human-readable description */
31
+ description: z.string(),
32
+ /** Capability level required to execute */
33
+ capability: CapabilityLevel,
34
+ /** Parameter definitions */
35
+ params: z.record(ProbeParamDef).optional(),
36
+ /** Probe timeout in ms */
37
+ timeout: z.number().default(DEFAULT_PROBE_TIMEOUT_MS),
38
+ });
39
+ /** Runbook definition (diagnostic workflow) */
40
+ export const RunbookDefinition = z.object({
41
+ /** Category this runbook covers, e.g. "docker" */
42
+ category: z.string(),
43
+ /** Ordered list of probe names to run */
44
+ probes: z.array(z.string()),
45
+ /** Whether to run probes in parallel */
46
+ parallel: z.boolean().default(true),
47
+ });
48
+ /** Detection rules for auto-discovering installed software */
49
+ export const DetectRules = z.object({
50
+ /** Check if these commands exist in PATH */
51
+ commands: z.array(z.string()).optional(),
52
+ /** Check if these files exist */
53
+ files: z.array(z.string()).optional(),
54
+ /** Check if these systemd services exist */
55
+ services: z.array(z.string()).optional(),
56
+ });
57
+ /**
58
+ * Full pack manifest schema.
59
+ * Defines a pack's metadata, requirements, probes, runbook, and detection rules.
60
+ */
61
+ export const PackManifest = z.object({
62
+ /** Pack name, e.g. "docker" */
63
+ name: z.string(),
64
+ /** Semver version */
65
+ version: z.string().regex(/^\d+\.\d+\.\d+$/),
66
+ /** Human-readable description */
67
+ description: z.string(),
68
+ /** Pack author */
69
+ author: z.string().optional(),
70
+ /** Code signature (base64) */
71
+ signature: z.string().optional(),
72
+ /** System access requirements */
73
+ requires: PackRequirements,
74
+ /** Probes this pack provides */
75
+ probes: z.array(ProbeDefinition),
76
+ /** Default diagnostic runbook */
77
+ runbook: RunbookDefinition.optional(),
78
+ /** Rules for auto-detecting this software on the system */
79
+ detect: DetectRules.optional(),
80
+ });
81
+ //# sourceMappingURL=packs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"packs.js","sourceRoot":"","sources":["../../src/schemas/packs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAE/E,uCAAuC;AACvC,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAC,MAAM,CAAC;IACpC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;IAC7C,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;IACvB,QAAQ,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC;IACpC,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C;IACjC,QAAQ,EAAE,gBAAgB;IAC1B,gCAAgC;IAChC,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,eAAe,CAAC;IAChC,iCAAiC;IACjC,OAAO,EAAE,iBAAiB,CAAC,QAAQ,EAAE;IACrC,2DAA2D;IAC3D,MAAM,EAAE,WAAW,CAAC,QAAQ,EAAE;CAC/B,CAAC,CAAC"}
@@ -0,0 +1,83 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Probe request descriptor (Hub → Agent).
4
+ */
5
+ export declare const ProbeRequest: z.ZodObject<{
6
+ /** Fully qualified probe name, e.g. "docker.containers.list" */
7
+ probe: z.ZodString;
8
+ /** Probe-specific parameters */
9
+ params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
10
+ /** Max time for probe execution in ms */
11
+ timeout: z.ZodDefault<z.ZodNumber>;
12
+ /** API key ID or OAuth client ID that initiated the request */
13
+ requestedBy: z.ZodString;
14
+ /** Set if this probe is part of a runbook execution */
15
+ runbookId: z.ZodOptional<z.ZodString>;
16
+ }, "strip", z.ZodTypeAny, {
17
+ timeout: number;
18
+ probe: string;
19
+ requestedBy: string;
20
+ params?: Record<string, unknown> | undefined;
21
+ runbookId?: string | undefined;
22
+ }, {
23
+ probe: string;
24
+ requestedBy: string;
25
+ params?: Record<string, unknown> | undefined;
26
+ timeout?: number | undefined;
27
+ runbookId?: string | undefined;
28
+ }>;
29
+ export type ProbeRequest = z.infer<typeof ProbeRequest>;
30
+ /**
31
+ * Probe response (Agent → Hub).
32
+ */
33
+ export declare const ProbeResponse: z.ZodObject<{
34
+ /** Echo back which probe ran */
35
+ probe: z.ZodString;
36
+ /** Result status */
37
+ status: z.ZodEnum<["success", "error", "timeout", "unauthorized"]>;
38
+ /** Probe-specific result data (already scrubbed) */
39
+ data: z.ZodUnknown;
40
+ /** How long execution took in ms */
41
+ durationMs: z.ZodNumber;
42
+ /** Metadata about the agent/pack that executed the probe */
43
+ metadata: z.ZodObject<{
44
+ agentVersion: z.ZodString;
45
+ packName: z.ZodString;
46
+ packVersion: z.ZodString;
47
+ capabilityLevel: z.ZodEnum<["observe", "interact", "manage"]>;
48
+ }, "strip", z.ZodTypeAny, {
49
+ agentVersion: string;
50
+ packName: string;
51
+ packVersion: string;
52
+ capabilityLevel: "observe" | "interact" | "manage";
53
+ }, {
54
+ agentVersion: string;
55
+ packName: string;
56
+ packVersion: string;
57
+ capabilityLevel: "observe" | "interact" | "manage";
58
+ }>;
59
+ }, "strip", z.ZodTypeAny, {
60
+ status: "error" | "success" | "timeout" | "unauthorized";
61
+ probe: string;
62
+ durationMs: number;
63
+ metadata: {
64
+ agentVersion: string;
65
+ packName: string;
66
+ packVersion: string;
67
+ capabilityLevel: "observe" | "interact" | "manage";
68
+ };
69
+ data?: unknown;
70
+ }, {
71
+ status: "error" | "success" | "timeout" | "unauthorized";
72
+ probe: string;
73
+ durationMs: number;
74
+ metadata: {
75
+ agentVersion: string;
76
+ packName: string;
77
+ packVersion: string;
78
+ capabilityLevel: "observe" | "interact" | "manage";
79
+ };
80
+ data?: unknown;
81
+ }>;
82
+ export type ProbeResponse = z.infer<typeof ProbeResponse>;
83
+ //# sourceMappingURL=probes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"probes.d.ts","sourceRoot":"","sources":["../../src/schemas/probes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB;;GAEG;AACH,eAAO,MAAM,YAAY;IACvB,gEAAgE;;IAEhE,gCAAgC;;IAEhC,yCAAyC;;IAEzC,+DAA+D;;IAE/D,uDAAuD;;;;;;;;;;;;;;EAEvD,CAAC;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAExD;;GAEG;AACH,eAAO,MAAM,aAAa;IACxB,gCAAgC;;IAEhC,oBAAoB;;IAEpB,oDAAoD;;IAEpD,oCAAoC;;IAEpC,4DAA4D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAO5D,CAAC;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC"}
@@ -0,0 +1,38 @@
1
+ import { z } from 'zod';
2
+ import { CapabilityLevel, DEFAULT_PROBE_TIMEOUT_MS, ProbeStatus } from '../types/common.js';
3
+ /**
4
+ * Probe request descriptor (Hub → Agent).
5
+ */
6
+ export const ProbeRequest = z.object({
7
+ /** Fully qualified probe name, e.g. "docker.containers.list" */
8
+ probe: z.string(),
9
+ /** Probe-specific parameters */
10
+ params: z.record(z.unknown()).optional(),
11
+ /** Max time for probe execution in ms */
12
+ timeout: z.number().default(DEFAULT_PROBE_TIMEOUT_MS),
13
+ /** API key ID or OAuth client ID that initiated the request */
14
+ requestedBy: z.string(),
15
+ /** Set if this probe is part of a runbook execution */
16
+ runbookId: z.string().optional(),
17
+ });
18
+ /**
19
+ * Probe response (Agent → Hub).
20
+ */
21
+ export const ProbeResponse = z.object({
22
+ /** Echo back which probe ran */
23
+ probe: z.string(),
24
+ /** Result status */
25
+ status: ProbeStatus,
26
+ /** Probe-specific result data (already scrubbed) */
27
+ data: z.unknown(),
28
+ /** How long execution took in ms */
29
+ durationMs: z.number(),
30
+ /** Metadata about the agent/pack that executed the probe */
31
+ metadata: z.object({
32
+ agentVersion: z.string(),
33
+ packName: z.string(),
34
+ packVersion: z.string(),
35
+ capabilityLevel: CapabilityLevel,
36
+ }),
37
+ });
38
+ //# sourceMappingURL=probes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"probes.js","sourceRoot":"","sources":["../../src/schemas/probes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,wBAAwB,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAE5F;;GAEG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC;IACnC,gEAAgE;IAChE,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,gCAAgC;IAChC,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,QAAQ,EAAE;IACxC,yCAAyC;IACzC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,wBAAwB,CAAC;IACrD,+DAA+D;IAC/D,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;IACvB,uDAAuD;IACvD,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CACjC,CAAC,CAAC;AAGH;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAC,MAAM,CAAC;IACpC,gCAAgC;IAChC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,oBAAoB;IACpB,MAAM,EAAE,WAAW;IACnB,oDAAoD;IACpD,IAAI,EAAE,CAAC,CAAC,OAAO,EAAE;IACjB,oCAAoC;IACpC,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE;IACtB,4DAA4D;IAC5D,QAAQ,EAAE,CAAC,CAAC,MAAM,CAAC;QACjB,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE;QACxB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;QACpB,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;QACvB,eAAe,EAAE,eAAe;KACjC,CAAC;CACH,CAAC,CAAC"}
@@ -0,0 +1,35 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * WebSocket message envelope.
4
+ * All agent ↔ hub communication uses this envelope.
5
+ */
6
+ export declare const MessageEnvelope: z.ZodObject<{
7
+ /** Unique message ID */
8
+ id: z.ZodString;
9
+ /** Message type discriminator */
10
+ type: z.ZodEnum<["probe.request", "probe.response", "probe.error", "agent.register", "agent.heartbeat", "hub.ack", "hub.reject"]>;
11
+ /** ISO 8601 timestamp */
12
+ timestamp: z.ZodString;
13
+ /** Set after registration */
14
+ agentId: z.ZodOptional<z.ZodString>;
15
+ /** Payload signature (base64) */
16
+ signature: z.ZodString;
17
+ /** Type-specific payload (validated per type) */
18
+ payload: z.ZodUnknown;
19
+ }, "strip", z.ZodTypeAny, {
20
+ type: "probe.request" | "probe.response" | "probe.error" | "agent.register" | "agent.heartbeat" | "hub.ack" | "hub.reject";
21
+ id: string;
22
+ timestamp: string;
23
+ signature: string;
24
+ agentId?: string | undefined;
25
+ payload?: unknown;
26
+ }, {
27
+ type: "probe.request" | "probe.response" | "probe.error" | "agent.register" | "agent.heartbeat" | "hub.ack" | "hub.reject";
28
+ id: string;
29
+ timestamp: string;
30
+ signature: string;
31
+ agentId?: string | undefined;
32
+ payload?: unknown;
33
+ }>;
34
+ export type MessageEnvelope = z.infer<typeof MessageEnvelope>;
35
+ //# sourceMappingURL=protocol.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../../src/schemas/protocol.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB;;;GAGG;AACH,eAAO,MAAM,eAAe;IAC1B,wBAAwB;;IAExB,iCAAiC;;IAEjC,yBAAyB;;IAEzB,6BAA6B;;IAE7B,iCAAiC;;IAEjC,iDAAiD;;;;;;;;;;;;;;;;EAEjD,CAAC;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC"}
@@ -0,0 +1,21 @@
1
+ import { z } from 'zod';
2
+ import { MessageType } from '../types/common.js';
3
+ /**
4
+ * WebSocket message envelope.
5
+ * All agent ↔ hub communication uses this envelope.
6
+ */
7
+ export const MessageEnvelope = z.object({
8
+ /** Unique message ID */
9
+ id: z.string().uuid(),
10
+ /** Message type discriminator */
11
+ type: MessageType,
12
+ /** ISO 8601 timestamp */
13
+ timestamp: z.string().datetime(),
14
+ /** Set after registration */
15
+ agentId: z.string().optional(),
16
+ /** Payload signature (base64) */
17
+ signature: z.string(),
18
+ /** Type-specific payload (validated per type) */
19
+ payload: z.unknown(),
20
+ });
21
+ //# sourceMappingURL=protocol.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"protocol.js","sourceRoot":"","sources":["../../src/schemas/protocol.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD;;;GAGG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC;IACtC,wBAAwB;IACxB,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE;IACrB,iCAAiC;IACjC,IAAI,EAAE,WAAW;IACjB,yBAAyB;IACzB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAChC,6BAA6B;IAC7B,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC9B,iCAAiC;IACjC,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,iDAAiD;IACjD,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE;CACrB,CAAC,CAAC"}