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

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