@agentshouse/kit-wire 0.0.0-stage → 0.1.0-c3e145f6aa97e

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/wire.d.ts ADDED
@@ -0,0 +1,471 @@
1
+ import { z } from 'zod';
2
+ export declare const KIT_WIRE_HEADER = "x-house-kit-wire";
3
+ export declare const KIT_COMMANDS: z.ZodObject<{
4
+ linux: z.ZodString;
5
+ windows: z.ZodString;
6
+ }, z.core.$strict>;
7
+ export type KitCommands = z.infer<typeof KIT_COMMANDS>;
8
+ export declare const BUILDING_KIT: z.ZodObject<{
9
+ release: z.ZodString;
10
+ commands: z.ZodObject<{
11
+ linux: z.ZodString;
12
+ windows: z.ZodString;
13
+ }, z.core.$strict>;
14
+ }, z.core.$strict>;
15
+ export type BuildingKit = z.infer<typeof BUILDING_KIT>;
16
+ export declare const KIT_DECLARATION: {
17
+ header: string;
18
+ connection: {
19
+ path: string;
20
+ protocol: string;
21
+ calls: {
22
+ open: z.ZodObject<{
23
+ type: z.ZodLiteral<"input">;
24
+ input_id: z.ZodUUID;
25
+ conversation_id: z.ZodUUID;
26
+ agent_id: z.ZodUUID;
27
+ provider_session_id: z.ZodNullable<z.ZodString>;
28
+ kind: z.ZodLiteral<"open">;
29
+ afk: z.ZodOptional<z.ZodLiteral<true>>;
30
+ }, z.core.$strict>;
31
+ kill: z.ZodObject<{
32
+ type: z.ZodLiteral<"input">;
33
+ input_id: z.ZodUUID;
34
+ conversation_id: z.ZodUUID;
35
+ agent_id: z.ZodUUID;
36
+ provider_session_id: z.ZodNullable<z.ZodString>;
37
+ kind: z.ZodLiteral<"kill">;
38
+ }, z.core.$strict>;
39
+ done: z.ZodObject<{
40
+ type: z.ZodLiteral<"input">;
41
+ input_id: z.ZodUUID;
42
+ conversation_id: z.ZodUUID;
43
+ agent_id: z.ZodUUID;
44
+ provider_session_id: z.ZodNullable<z.ZodString>;
45
+ kind: z.ZodLiteral<"done">;
46
+ }, z.core.$strict>;
47
+ message: z.ZodObject<{
48
+ type: z.ZodLiteral<"input">;
49
+ input_id: z.ZodUUID;
50
+ conversation_id: z.ZodUUID;
51
+ agent_id: z.ZodUUID;
52
+ provider_session_id: z.ZodNullable<z.ZodString>;
53
+ kind: z.ZodLiteral<"message">;
54
+ message_id: z.ZodUUID;
55
+ text: z.ZodString;
56
+ first: z.ZodBoolean;
57
+ at_once: z.ZodOptional<z.ZodLiteral<true>>;
58
+ recent: z.ZodOptional<z.ZodString>;
59
+ afk: z.ZodOptional<z.ZodLiteral<true>>;
60
+ }, z.core.$strict>;
61
+ take_out: z.ZodObject<{
62
+ type: z.ZodLiteral<"input">;
63
+ input_id: z.ZodUUID;
64
+ conversation_id: z.ZodUUID;
65
+ agent_id: z.ZodUUID;
66
+ provider_session_id: z.ZodNullable<z.ZodString>;
67
+ kind: z.ZodLiteral<"take_out">;
68
+ message_id: z.ZodUUID;
69
+ }, z.core.$strict>;
70
+ interrupt: z.ZodObject<{
71
+ type: z.ZodLiteral<"input">;
72
+ input_id: z.ZodUUID;
73
+ conversation_id: z.ZodUUID;
74
+ agent_id: z.ZodUUID;
75
+ provider_session_id: z.ZodNullable<z.ZodString>;
76
+ kind: z.ZodLiteral<"interrupt">;
77
+ turn_id: z.ZodUUID;
78
+ }, z.core.$strict>;
79
+ answer: z.ZodObject<{
80
+ type: z.ZodLiteral<"input">;
81
+ input_id: z.ZodUUID;
82
+ conversation_id: z.ZodUUID;
83
+ agent_id: z.ZodUUID;
84
+ provider_session_id: z.ZodNullable<z.ZodString>;
85
+ kind: z.ZodLiteral<"answer">;
86
+ interaction_id: z.ZodUUID;
87
+ response: z.ZodUnknown;
88
+ request: z.ZodUnknown;
89
+ }, z.core.$strict>;
90
+ option: z.ZodObject<{
91
+ type: z.ZodLiteral<"input">;
92
+ input_id: z.ZodUUID;
93
+ conversation_id: z.ZodUUID;
94
+ agent_id: z.ZodUUID;
95
+ provider_session_id: z.ZodNullable<z.ZodString>;
96
+ kind: z.ZodLiteral<"option">;
97
+ option: z.ZodString;
98
+ value: z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>;
99
+ }, z.core.$strict>;
100
+ sign_in: z.ZodObject<{
101
+ type: z.ZodLiteral<"input">;
102
+ input_id: z.ZodUUID;
103
+ conversation_id: z.ZodNull;
104
+ agent_id: z.ZodNull;
105
+ provider_session_id: z.ZodNull;
106
+ kind: z.ZodLiteral<"sign_in">;
107
+ cli: z.ZodString;
108
+ ends_in: z.ZodInt;
109
+ }, z.core.$strict>;
110
+ update: z.ZodObject<{
111
+ type: z.ZodLiteral<"input">;
112
+ input_id: z.ZodUUID;
113
+ conversation_id: z.ZodNull;
114
+ agent_id: z.ZodNull;
115
+ provider_session_id: z.ZodNull;
116
+ kind: z.ZodLiteral<"update">;
117
+ release: z.ZodString;
118
+ }, z.core.$strict>;
119
+ run_wizard: z.ZodObject<{
120
+ type: z.ZodLiteral<"input">;
121
+ input_id: z.ZodUUID;
122
+ conversation_id: z.ZodNull;
123
+ agent_id: z.ZodNull;
124
+ provider_session_id: z.ZodNull;
125
+ kind: z.ZodLiteral<"run_wizard">;
126
+ script: z.ZodString;
127
+ }, z.core.$strict>;
128
+ run_function: z.ZodObject<{
129
+ type: z.ZodLiteral<"input">;
130
+ input_id: z.ZodUUID;
131
+ conversation_id: z.ZodNull;
132
+ agent_id: z.ZodNull;
133
+ provider_session_id: z.ZodNull;
134
+ kind: z.ZodLiteral<"run_function">;
135
+ script: z.ZodString;
136
+ input: z.ZodUnknown;
137
+ terminal: z.ZodBoolean;
138
+ time_cap: z.ZodInt;
139
+ output_cap: z.ZodInt;
140
+ }, z.core.$strict>;
141
+ };
142
+ results: z.ZodUnion<readonly [z.ZodObject<{
143
+ provider_session_id: z.ZodString;
144
+ }, z.core.$strict>, z.ZodObject<{
145
+ refused: z.ZodString;
146
+ resume_refused: z.ZodOptional<z.ZodLiteral<true>>;
147
+ }, z.core.$strict>, z.ZodObject<{
148
+ exit_code: z.ZodInt;
149
+ }, z.core.$strict>, z.ZodObject<{
150
+ output: z.ZodString;
151
+ cut: z.ZodBoolean;
152
+ exit_code: z.ZodInt;
153
+ }, z.core.$strict>, z.ZodObject<{
154
+ output: z.ZodString;
155
+ cut: z.ZodBoolean;
156
+ timed_out: z.ZodLiteral<true>;
157
+ }, z.core.$strict>, z.ZodObject<{
158
+ started: z.ZodLiteral<true>;
159
+ }, z.core.$strict>, z.ZodObject<{}, z.core.$strict>]>;
160
+ house: {
161
+ beat: z.ZodObject<{
162
+ type: z.ZodLiteral<"beat">;
163
+ }, z.core.$strict>;
164
+ watching: z.ZodObject<{
165
+ type: z.ZodLiteral<"watching">;
166
+ watching: z.ZodBoolean;
167
+ }, z.core.$strict>;
168
+ work_available: z.ZodObject<{
169
+ type: z.ZodLiteral<"work_available">;
170
+ subject: z.ZodLiteral<"agents">;
171
+ }, z.core.$strict>;
172
+ wizard_input: z.ZodObject<{
173
+ type: z.ZodLiteral<"wizard_input">;
174
+ wizard: z.ZodUUID;
175
+ data: z.ZodString;
176
+ }, z.core.$strict>;
177
+ wizard_size: z.ZodObject<{
178
+ type: z.ZodLiteral<"wizard_size">;
179
+ wizard: z.ZodUUID;
180
+ cols: z.ZodInt;
181
+ rows: z.ZodInt;
182
+ }, z.core.$strict>;
183
+ wizard_end: z.ZodObject<{
184
+ type: z.ZodLiteral<"wizard_end">;
185
+ wizard: z.ZodUUID;
186
+ }, z.core.$strict>;
187
+ refused: z.ZodObject<{
188
+ type: z.ZodLiteral<"refused">;
189
+ code: z.ZodLiteral<"invalid_message">;
190
+ }, z.core.$strict>;
191
+ };
192
+ kit: {
193
+ turn: z.ZodObject<{
194
+ conversation_id: z.ZodUUID;
195
+ type: z.ZodLiteral<"turn">;
196
+ turn_id: z.ZodUUID;
197
+ operation: z.ZodUnknown;
198
+ }, z.core.$strict>;
199
+ process: z.ZodObject<{
200
+ conversation_id: z.ZodUUID;
201
+ type: z.ZodLiteral<"process">;
202
+ running: z.ZodBoolean;
203
+ }, z.core.$strict>;
204
+ commands: z.ZodObject<{
205
+ conversation_id: z.ZodUUID;
206
+ type: z.ZodLiteral<"commands">;
207
+ commands: z.ZodArray<z.ZodObject<{
208
+ name: z.ZodString;
209
+ description: z.ZodString;
210
+ input: z.ZodOptional<z.ZodNullable<z.ZodObject<{
211
+ hint: z.ZodString;
212
+ }, z.core.$loose>>>;
213
+ }, z.core.$loose>>;
214
+ }, z.core.$strict>;
215
+ options: z.ZodObject<{
216
+ conversation_id: z.ZodUUID;
217
+ type: z.ZodLiteral<"options">;
218
+ options: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
219
+ id: z.ZodString;
220
+ name: z.ZodString;
221
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
222
+ category: z.ZodOptional<z.ZodNullable<z.ZodString>>;
223
+ type: z.ZodLiteral<"select">;
224
+ currentValue: z.ZodString;
225
+ options: z.ZodUnion<readonly [z.ZodArray<z.ZodObject<{
226
+ value: z.ZodString;
227
+ name: z.ZodString;
228
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
229
+ }, z.core.$loose>>, z.ZodArray<z.ZodObject<{
230
+ group: z.ZodString;
231
+ name: z.ZodString;
232
+ options: z.ZodArray<z.ZodObject<{
233
+ value: z.ZodString;
234
+ name: z.ZodString;
235
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
236
+ }, z.core.$loose>>;
237
+ }, z.core.$loose>>]>;
238
+ }, z.core.$loose>, z.ZodObject<{
239
+ id: z.ZodString;
240
+ name: z.ZodString;
241
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
242
+ category: z.ZodOptional<z.ZodNullable<z.ZodString>>;
243
+ type: z.ZodLiteral<"boolean">;
244
+ currentValue: z.ZodBoolean;
245
+ }, z.core.$loose>], "type">>;
246
+ }, z.core.$strict>;
247
+ starting: z.ZodObject<{
248
+ conversation_id: z.ZodUUID;
249
+ type: z.ZodLiteral<"starting">;
250
+ step: z.ZodNullable<z.ZodEnum<{
251
+ session: "session";
252
+ transcription: "transcription";
253
+ }>>;
254
+ }, z.core.$strict>;
255
+ state: z.ZodObject<{
256
+ conversation_id: z.ZodUUID;
257
+ type: z.ZodLiteral<"state">;
258
+ state: z.ZodUnknown;
259
+ }, z.core.$strict>;
260
+ wizard_output: z.ZodObject<{
261
+ type: z.ZodLiteral<"wizard_output">;
262
+ wizard: z.ZodUUID;
263
+ data: z.ZodString;
264
+ }, z.core.$strict>;
265
+ };
266
+ };
267
+ acts: {
268
+ 'secret-inputs/await': import("./acts.ts").KitActDeclaration<"subject", z.ZodObject<{
269
+ steps: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
270
+ kind: z.ZodLiteral<"visit">;
271
+ label: z.ZodString;
272
+ url: z.ZodString;
273
+ }, z.core.$strict>, z.ZodObject<{
274
+ kind: z.ZodLiteral<"show">;
275
+ label: z.ZodString;
276
+ text: z.ZodString;
277
+ }, z.core.$strict>, z.ZodObject<{
278
+ kind: z.ZodLiteral<"collect">;
279
+ label: z.ZodString;
280
+ name: z.ZodString;
281
+ description: z.ZodOptional<z.ZodString>;
282
+ }, z.core.$strict>], "kind">>;
283
+ }, z.core.$strict>, z.ZodDiscriminatedUnion<[z.ZodObject<{
284
+ outcome: z.ZodLiteral<"collected">;
285
+ content: z.ZodRecord<z.ZodString, z.ZodString>;
286
+ }, z.core.$strict>, z.ZodObject<{
287
+ outcome: z.ZodLiteral<"released">;
288
+ release: z.ZodEnum<{
289
+ held: "held";
290
+ superseded: "superseded";
291
+ withdrawn: "withdrawn";
292
+ }>;
293
+ }, z.core.$strict>], "outcome">>;
294
+ 'agents/report': import("./acts.ts").KitActDeclaration<never, z.ZodObject<{
295
+ os: z.ZodString;
296
+ kit_release: z.ZodString;
297
+ wire: z.ZodString;
298
+ form: z.ZodOptional<z.ZodEnum<{
299
+ desktop: "desktop";
300
+ laptop: "laptop";
301
+ server: "server";
302
+ }>>;
303
+ ssh_host_key: z.ZodOptional<z.ZodString>;
304
+ agent_base: z.ZodOptional<z.ZodString>;
305
+ reinstall: z.ZodOptional<z.ZodEnum<{
306
+ linux: "linux";
307
+ windows: "windows";
308
+ }>>;
309
+ agents: z.ZodArray<z.ZodObject<{
310
+ kind: z.ZodString;
311
+ release: z.ZodNullable<z.ZodString>;
312
+ minimum: z.ZodOptional<z.ZodString>;
313
+ update: z.ZodOptional<z.ZodString>;
314
+ failure: z.ZodNullable<z.ZodString>;
315
+ installing: z.ZodOptional<z.ZodLiteral<true>>;
316
+ signed_in: z.ZodBoolean;
317
+ models: z.ZodArray<z.ZodObject<{
318
+ model: z.ZodString;
319
+ name: z.ZodString;
320
+ efforts: z.ZodArray<z.ZodString>;
321
+ }, z.core.$strict>>;
322
+ default_model: z.ZodOptional<z.ZodString>;
323
+ default_effort: z.ZodOptional<z.ZodString>;
324
+ modes: z.ZodArray<z.ZodObject<{
325
+ mode: z.ZodString;
326
+ name: z.ZodString;
327
+ }, z.core.$strict>>;
328
+ full_access: z.ZodNullable<z.ZodString>;
329
+ }, z.core.$strict>>;
330
+ transcription: z.ZodOptional<z.ZodObject<{
331
+ installed: z.ZodBoolean;
332
+ failure: z.ZodNullable<z.ZodString>;
333
+ no_engine: z.ZodOptional<z.ZodLiteral<true>>;
334
+ }, z.core.$strict>>;
335
+ }, z.core.$strict>, z.ZodObject<{}, z.core.$strict>>;
336
+ 'agents/desired/list': import("./acts.ts").KitActDeclaration<never, z.ZodObject<{}, z.core.$strict>, z.ZodObject<{
337
+ agents: z.ZodArray<z.ZodString>;
338
+ routes: z.ZodArray<z.ZodObject<{
339
+ agent_id: z.ZodUUID;
340
+ kind: z.ZodString;
341
+ base_instructions: z.ZodString;
342
+ working_directory: z.ZodString;
343
+ model: z.ZodNullable<z.ZodString>;
344
+ effort: z.ZodNullable<z.ZodString>;
345
+ mode: z.ZodNullable<z.ZodString>;
346
+ }, z.core.$strict>>;
347
+ transcribe: z.ZodBoolean;
348
+ }, z.core.$strict>>;
349
+ 'kit-calls/results/return': import("./acts.ts").KitActDeclaration<"call", z.ZodUnion<readonly [z.ZodObject<{
350
+ provider_session_id: z.ZodString;
351
+ }, z.core.$strict>, z.ZodObject<{
352
+ refused: z.ZodString;
353
+ resume_refused: z.ZodOptional<z.ZodLiteral<true>>;
354
+ }, z.core.$strict>, z.ZodObject<{
355
+ exit_code: z.ZodInt;
356
+ }, z.core.$strict>, z.ZodObject<{
357
+ output: z.ZodString;
358
+ cut: z.ZodBoolean;
359
+ exit_code: z.ZodInt;
360
+ }, z.core.$strict>, z.ZodObject<{
361
+ output: z.ZodString;
362
+ cut: z.ZodBoolean;
363
+ timed_out: z.ZodLiteral<true>;
364
+ }, z.core.$strict>, z.ZodObject<{
365
+ started: z.ZodLiteral<true>;
366
+ }, z.core.$strict>, z.ZodObject<{}, z.core.$strict>]>, z.ZodObject<{}, z.core.$strict>>;
367
+ 'turns/start': import("./acts.ts").KitActDeclaration<"conversation" | "turn", z.ZodObject<{}, z.core.$strict>, z.ZodObject<{
368
+ run: z.ZodOptional<z.ZodLiteral<true>>;
369
+ }, z.core.$strict>>;
370
+ 'turns/activity/report': import("./acts.ts").KitActDeclaration<"conversation" | "turn", z.ZodObject<{}, z.core.$strict>, z.ZodObject<{}, z.core.$strict>>;
371
+ 'turns/end': import("./acts.ts").KitActDeclaration<"conversation" | "turn", z.ZodObject<{
372
+ content: z.ZodUnknown;
373
+ failed: z.ZodOptional<z.ZodString>;
374
+ }, z.core.$strict>, z.ZodObject<{}, z.core.$strict>>;
375
+ 'turns/images/declare': import("./acts.ts").KitActDeclaration<"conversation" | "turn", z.ZodObject<{
376
+ bytes: z.ZodInt;
377
+ sha256: z.ZodString;
378
+ name: z.ZodString;
379
+ media_type: z.ZodString;
380
+ }, z.core.$strict>, {
381
+ door: string;
382
+ }>;
383
+ 'transcripts/keep': import("./acts.ts").KitActDeclaration<"conversation" | "message", z.ZodObject<{
384
+ path: z.ZodString;
385
+ text: z.ZodString;
386
+ }, z.core.$strict>, z.ZodObject<{}, z.core.$strict>>;
387
+ 'uploads/finish': import("./acts.ts").KitActDeclaration<never, z.ZodObject<{
388
+ upload: z.ZodUUID;
389
+ part_sha256: z.ZodArray<z.ZodString>;
390
+ }, z.core.$strict>, {
391
+ door: string;
392
+ }>;
393
+ 'conversations/interaction/ask': import("./acts.ts").KitActDeclaration<"conversation" | "turn", z.ZodObject<{
394
+ interaction_id: z.ZodUUID;
395
+ request: z.ZodJSONSchema;
396
+ secret: z.ZodBoolean;
397
+ }, z.core.$strict>, z.ZodObject<{}, z.core.$strict>>;
398
+ 'kits/report-idle': import("./acts.ts").KitActDeclaration<never, z.ZodObject<{}, z.core.$strict>, z.ZodObject<{}, z.core.$strict>>;
399
+ 'kits/report-restart': import("./acts.ts").KitActDeclaration<never, z.ZodObject<{}, z.core.$strict>, z.ZodObject<{}, z.core.$strict>>;
400
+ 'conversations/credentials/issue': import("./acts.ts").KitActDeclaration<"conversation", z.ZodObject<{}, z.core.$strict>, z.ZodObject<{
401
+ credential: z.ZodString;
402
+ }, z.core.$strict>>;
403
+ 'kits/log-out': import("./acts.ts").KitActDeclaration<never, z.ZodObject<{}, z.core.$strict>, z.ZodObject<{
404
+ environment: z.ZodUUID;
405
+ revoked: z.ZodLiteral<true>;
406
+ }, z.core.$strict>>;
407
+ 'local-copies/selection/read': import("./acts.ts").KitActDeclaration<never, z.ZodObject<{}, z.core.$strict>, z.ZodObject<{
408
+ local_copy: z.ZodObject<{
409
+ rooms: z.ZodArray<z.ZodObject<{
410
+ room_ref: z.ZodString;
411
+ room_handle: z.ZodString;
412
+ }, z.core.$strict>>;
413
+ }, z.core.$strict>;
414
+ }, z.core.$strict>>;
415
+ };
416
+ door: readonly ["rooms/discover", "room-chunks/list", "changes/enumerate", "files/revisions/list", "files/batch"];
417
+ login: {
418
+ paths: {
419
+ readonly start: '/kit';
420
+ readonly poll: '/kit/token';
421
+ };
422
+ start: {
423
+ request: z.ZodObject<{
424
+ act: z.ZodEnum<{
425
+ existing_environment: "existing_environment";
426
+ new_environment: "new_environment";
427
+ }>;
428
+ environment_id: z.ZodOptional<z.ZodUUID>;
429
+ headless: z.ZodOptional<z.ZodLiteral<true>>;
430
+ rooms: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
431
+ reach: z.ZodLiteral<"all">;
432
+ }, z.core.$strict>, z.ZodObject<{
433
+ reach: z.ZodLiteral<"all_but_private">;
434
+ }, z.core.$strict>, z.ZodObject<{
435
+ reach: z.ZodLiteral<"selected">;
436
+ refs: z.ZodArray<z.ZodString>;
437
+ }, z.core.$strict>], "reach">>;
438
+ code_challenge: z.ZodString;
439
+ }, z.core.$strict>;
440
+ answer: z.ZodObject<{
441
+ start_url: z.ZodURL;
442
+ login: z.ZodUUID;
443
+ }, z.core.$strict>;
444
+ };
445
+ poll: {
446
+ request: z.ZodUnion<readonly [z.ZodObject<{
447
+ login: z.ZodUUID;
448
+ code_verifier: z.ZodString;
449
+ }, z.core.$strict>, z.ZodObject<{
450
+ code: z.ZodString;
451
+ }, z.core.$strict>]>;
452
+ answer: z.ZodObject<{
453
+ credential: z.ZodString;
454
+ environment: z.ZodUUID;
455
+ user: z.ZodUUID;
456
+ headless_credential: z.ZodOptional<z.ZodString>;
457
+ }, z.core.$strict>;
458
+ };
459
+ };
460
+ refusal: z.ZodObject<{
461
+ release: z.ZodString;
462
+ commands: z.ZodObject<{
463
+ linux: z.ZodString;
464
+ windows: z.ZodString;
465
+ }, z.core.$strict>;
466
+ }, z.core.$strict>;
467
+ };
468
+ export declare function kitWire(declaration: object): string;
469
+ export declare const KIT_WIRE: string;
470
+ export type KitWireRefusal = 'kit_declaration_invalid' | 'kit_update_required';
471
+ export declare function kitWireRefusal(named: string | readonly string[] | undefined): KitWireRefusal | null;
package/dist/wire.js ADDED
@@ -0,0 +1,55 @@
1
+ import { createHash } from 'node:crypto';
2
+ import { z } from 'zod';
3
+ import { KIT_ACTS, KIT_DOOR_ACTS } from './acts.js';
4
+ import { HOUSE_ONE_WAY_CALLS, KIT_CALL_RESULT, KIT_CALLS, KIT_CONNECTION_PATH, KIT_CONNECTION_PROTOCOL_PREFIX, KIT_ONE_WAY_CALLS, } from './connection.js';
5
+ import { KIT_LOGIN_ISSUED, KIT_LOGIN_PATHS, KIT_LOGIN_POLL, KIT_LOGIN_START, KIT_LOGIN_STARTED, } from './enrollment.js';
6
+ const WIRE_HEX_LENGTH = 16;
7
+ export const KIT_WIRE_HEADER = 'x-house-kit-wire';
8
+ export const KIT_COMMANDS = z.strictObject({
9
+ linux: z.string(),
10
+ windows: z.string(),
11
+ });
12
+ export const BUILDING_KIT = z.strictObject({ release: z.string(), commands: KIT_COMMANDS });
13
+ export const KIT_DECLARATION = {
14
+ header: KIT_WIRE_HEADER,
15
+ connection: {
16
+ path: KIT_CONNECTION_PATH,
17
+ protocol: KIT_CONNECTION_PROTOCOL_PREFIX,
18
+ calls: KIT_CALLS,
19
+ results: KIT_CALL_RESULT,
20
+ house: HOUSE_ONE_WAY_CALLS,
21
+ kit: KIT_ONE_WAY_CALLS,
22
+ },
23
+ acts: KIT_ACTS,
24
+ door: KIT_DOOR_ACTS,
25
+ login: {
26
+ paths: KIT_LOGIN_PATHS,
27
+ start: { request: KIT_LOGIN_START, answer: KIT_LOGIN_STARTED },
28
+ poll: { request: KIT_LOGIN_POLL, answer: KIT_LOGIN_ISSUED },
29
+ },
30
+ refusal: BUILDING_KIT,
31
+ };
32
+ function isSchema(value) {
33
+ return '_zod' in value;
34
+ }
35
+ function described(value) {
36
+ if (typeof value !== 'object' || value === null)
37
+ return value;
38
+ if (Array.isArray(value))
39
+ return value.map(described);
40
+ if (isSchema(value))
41
+ return z.toJSONSchema(value, { unrepresentable: 'any' });
42
+ return Object.fromEntries(Object.entries(value).map(([name, held]) => [name, described(held)]));
43
+ }
44
+ export function kitWire(declaration) {
45
+ return createHash('sha256')
46
+ .update(JSON.stringify(described(declaration)))
47
+ .digest('hex')
48
+ .slice(0, WIRE_HEX_LENGTH);
49
+ }
50
+ export const KIT_WIRE = 'edc5265562bfc73c';
51
+ export function kitWireRefusal(named) {
52
+ if (typeof named !== 'string')
53
+ return 'kit_declaration_invalid';
54
+ return named === KIT_WIRE ? null : 'kit_update_required';
55
+ }
package/package.json CHANGED
@@ -1,6 +1,34 @@
1
1
  {
2
2
  "name": "@agentshouse/kit-wire",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0-c3e145f6aa97e",
4
+ "description": "The Kit wire: every shape House and the Kit exchange, the Kit connection's frames and every /kit/ request and answer, and the wire computed from them",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "sideEffects": false,
8
+ "publishConfig": {
9
+ "access": "public"
10
+ },
11
+ "engines": {
12
+ "node": ">=24.22.1"
13
+ },
14
+ "exports": {
15
+ ".": {
16
+ "types": "./dist/index.d.ts",
17
+ "default": "./dist/index.js"
18
+ },
19
+ "./package.json": "./package.json"
20
+ },
21
+ "files": [
22
+ "dist",
23
+ "README.md",
24
+ "LICENSE"
25
+ ],
26
+ "dependencies": {
27
+ "zod": "4.6.7"
28
+ },
29
+ "repository": {
30
+ "type": "git",
31
+ "url": "git+https://github.com/agentshouse/core.git",
32
+ "directory": "kit-wire"
33
+ }
34
+ }