@agentshouse/kit-wire 0.0.0-placeholder → 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.
@@ -0,0 +1,376 @@
1
+ import { z } from 'zod';
2
+ export declare const KIT_CONNECTION_PATH = "/kit/stream";
3
+ export declare const KIT_CONNECTION_PROTOCOL_PREFIX = "house.kit.stream.";
4
+ export declare const KIT_CAUSE: z.ZodString;
5
+ export declare const KIT_CALL_RESULT: z.ZodUnion<readonly [z.ZodObject<{
6
+ provider_session_id: z.ZodString;
7
+ }, z.core.$strict>, z.ZodObject<{
8
+ refused: z.ZodString;
9
+ resume_refused: z.ZodOptional<z.ZodLiteral<true>>;
10
+ }, z.core.$strict>, z.ZodObject<{
11
+ exit_code: z.ZodInt;
12
+ }, z.core.$strict>, z.ZodObject<{
13
+ output: z.ZodString;
14
+ cut: z.ZodBoolean;
15
+ exit_code: z.ZodInt;
16
+ }, z.core.$strict>, z.ZodObject<{
17
+ output: z.ZodString;
18
+ cut: z.ZodBoolean;
19
+ timed_out: z.ZodLiteral<true>;
20
+ }, z.core.$strict>, z.ZodObject<{
21
+ started: z.ZodLiteral<true>;
22
+ }, z.core.$strict>, z.ZodObject<{}, z.core.$strict>]>;
23
+ export type KitCallResult = z.infer<typeof KIT_CALL_RESULT>;
24
+ export declare const KIT_CALLS: {
25
+ open: z.ZodObject<{
26
+ type: z.ZodLiteral<"input">;
27
+ input_id: z.ZodUUID;
28
+ conversation_id: z.ZodUUID;
29
+ agent_id: z.ZodUUID;
30
+ provider_session_id: z.ZodNullable<z.ZodString>;
31
+ kind: z.ZodLiteral<"open">;
32
+ afk: z.ZodOptional<z.ZodLiteral<true>>;
33
+ }, z.core.$strict>;
34
+ kill: z.ZodObject<{
35
+ type: z.ZodLiteral<"input">;
36
+ input_id: z.ZodUUID;
37
+ conversation_id: z.ZodUUID;
38
+ agent_id: z.ZodUUID;
39
+ provider_session_id: z.ZodNullable<z.ZodString>;
40
+ kind: z.ZodLiteral<"kill">;
41
+ }, z.core.$strict>;
42
+ done: z.ZodObject<{
43
+ type: z.ZodLiteral<"input">;
44
+ input_id: z.ZodUUID;
45
+ conversation_id: z.ZodUUID;
46
+ agent_id: z.ZodUUID;
47
+ provider_session_id: z.ZodNullable<z.ZodString>;
48
+ kind: z.ZodLiteral<"done">;
49
+ }, z.core.$strict>;
50
+ message: z.ZodObject<{
51
+ type: z.ZodLiteral<"input">;
52
+ input_id: z.ZodUUID;
53
+ conversation_id: z.ZodUUID;
54
+ agent_id: z.ZodUUID;
55
+ provider_session_id: z.ZodNullable<z.ZodString>;
56
+ kind: z.ZodLiteral<"message">;
57
+ message_id: z.ZodUUID;
58
+ text: z.ZodString;
59
+ first: z.ZodBoolean;
60
+ at_once: z.ZodOptional<z.ZodLiteral<true>>;
61
+ recent: z.ZodOptional<z.ZodString>;
62
+ afk: z.ZodOptional<z.ZodLiteral<true>>;
63
+ }, z.core.$strict>;
64
+ take_out: z.ZodObject<{
65
+ type: z.ZodLiteral<"input">;
66
+ input_id: z.ZodUUID;
67
+ conversation_id: z.ZodUUID;
68
+ agent_id: z.ZodUUID;
69
+ provider_session_id: z.ZodNullable<z.ZodString>;
70
+ kind: z.ZodLiteral<"take_out">;
71
+ message_id: z.ZodUUID;
72
+ }, z.core.$strict>;
73
+ interrupt: z.ZodObject<{
74
+ type: z.ZodLiteral<"input">;
75
+ input_id: z.ZodUUID;
76
+ conversation_id: z.ZodUUID;
77
+ agent_id: z.ZodUUID;
78
+ provider_session_id: z.ZodNullable<z.ZodString>;
79
+ kind: z.ZodLiteral<"interrupt">;
80
+ turn_id: z.ZodUUID;
81
+ }, z.core.$strict>;
82
+ answer: z.ZodObject<{
83
+ type: z.ZodLiteral<"input">;
84
+ input_id: z.ZodUUID;
85
+ conversation_id: z.ZodUUID;
86
+ agent_id: z.ZodUUID;
87
+ provider_session_id: z.ZodNullable<z.ZodString>;
88
+ kind: z.ZodLiteral<"answer">;
89
+ interaction_id: z.ZodUUID;
90
+ response: z.ZodUnknown;
91
+ request: z.ZodUnknown;
92
+ }, z.core.$strict>;
93
+ option: z.ZodObject<{
94
+ type: z.ZodLiteral<"input">;
95
+ input_id: z.ZodUUID;
96
+ conversation_id: z.ZodUUID;
97
+ agent_id: z.ZodUUID;
98
+ provider_session_id: z.ZodNullable<z.ZodString>;
99
+ kind: z.ZodLiteral<"option">;
100
+ option: z.ZodString;
101
+ value: z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>;
102
+ }, z.core.$strict>;
103
+ sign_in: z.ZodObject<{
104
+ type: z.ZodLiteral<"input">;
105
+ input_id: z.ZodUUID;
106
+ conversation_id: z.ZodNull;
107
+ agent_id: z.ZodNull;
108
+ provider_session_id: z.ZodNull;
109
+ kind: z.ZodLiteral<"sign_in">;
110
+ cli: z.ZodString;
111
+ ends_in: z.ZodInt;
112
+ }, z.core.$strict>;
113
+ update: z.ZodObject<{
114
+ type: z.ZodLiteral<"input">;
115
+ input_id: z.ZodUUID;
116
+ conversation_id: z.ZodNull;
117
+ agent_id: z.ZodNull;
118
+ provider_session_id: z.ZodNull;
119
+ kind: z.ZodLiteral<"update">;
120
+ release: z.ZodString;
121
+ }, z.core.$strict>;
122
+ run_wizard: z.ZodObject<{
123
+ type: z.ZodLiteral<"input">;
124
+ input_id: z.ZodUUID;
125
+ conversation_id: z.ZodNull;
126
+ agent_id: z.ZodNull;
127
+ provider_session_id: z.ZodNull;
128
+ kind: z.ZodLiteral<"run_wizard">;
129
+ script: z.ZodString;
130
+ }, z.core.$strict>;
131
+ run_function: z.ZodObject<{
132
+ type: z.ZodLiteral<"input">;
133
+ input_id: z.ZodUUID;
134
+ conversation_id: z.ZodNull;
135
+ agent_id: z.ZodNull;
136
+ provider_session_id: z.ZodNull;
137
+ kind: z.ZodLiteral<"run_function">;
138
+ script: z.ZodString;
139
+ input: z.ZodUnknown;
140
+ terminal: z.ZodBoolean;
141
+ time_cap: z.ZodInt;
142
+ output_cap: z.ZodInt;
143
+ }, z.core.$strict>;
144
+ };
145
+ export declare const KIT_CALL: z.ZodDiscriminatedUnion<[z.ZodObject<{
146
+ type: z.ZodLiteral<"input">;
147
+ input_id: z.ZodUUID;
148
+ conversation_id: z.ZodUUID;
149
+ agent_id: z.ZodUUID;
150
+ provider_session_id: z.ZodNullable<z.ZodString>;
151
+ kind: z.ZodLiteral<"open">;
152
+ afk: z.ZodOptional<z.ZodLiteral<true>>;
153
+ }, z.core.$strict>, z.ZodObject<{
154
+ type: z.ZodLiteral<"input">;
155
+ input_id: z.ZodUUID;
156
+ conversation_id: z.ZodUUID;
157
+ agent_id: z.ZodUUID;
158
+ provider_session_id: z.ZodNullable<z.ZodString>;
159
+ kind: z.ZodLiteral<"kill">;
160
+ }, z.core.$strict>, z.ZodObject<{
161
+ type: z.ZodLiteral<"input">;
162
+ input_id: z.ZodUUID;
163
+ conversation_id: z.ZodUUID;
164
+ agent_id: z.ZodUUID;
165
+ provider_session_id: z.ZodNullable<z.ZodString>;
166
+ kind: z.ZodLiteral<"done">;
167
+ }, z.core.$strict>, z.ZodObject<{
168
+ type: z.ZodLiteral<"input">;
169
+ input_id: z.ZodUUID;
170
+ conversation_id: z.ZodUUID;
171
+ agent_id: z.ZodUUID;
172
+ provider_session_id: z.ZodNullable<z.ZodString>;
173
+ kind: z.ZodLiteral<"message">;
174
+ message_id: z.ZodUUID;
175
+ text: z.ZodString;
176
+ first: z.ZodBoolean;
177
+ at_once: z.ZodOptional<z.ZodLiteral<true>>;
178
+ recent: z.ZodOptional<z.ZodString>;
179
+ afk: z.ZodOptional<z.ZodLiteral<true>>;
180
+ }, z.core.$strict>, z.ZodObject<{
181
+ type: z.ZodLiteral<"input">;
182
+ input_id: z.ZodUUID;
183
+ conversation_id: z.ZodUUID;
184
+ agent_id: z.ZodUUID;
185
+ provider_session_id: z.ZodNullable<z.ZodString>;
186
+ kind: z.ZodLiteral<"take_out">;
187
+ message_id: z.ZodUUID;
188
+ }, z.core.$strict>, z.ZodObject<{
189
+ type: z.ZodLiteral<"input">;
190
+ input_id: z.ZodUUID;
191
+ conversation_id: z.ZodUUID;
192
+ agent_id: z.ZodUUID;
193
+ provider_session_id: z.ZodNullable<z.ZodString>;
194
+ kind: z.ZodLiteral<"interrupt">;
195
+ turn_id: z.ZodUUID;
196
+ }, z.core.$strict>, z.ZodObject<{
197
+ type: z.ZodLiteral<"input">;
198
+ input_id: z.ZodUUID;
199
+ conversation_id: z.ZodUUID;
200
+ agent_id: z.ZodUUID;
201
+ provider_session_id: z.ZodNullable<z.ZodString>;
202
+ kind: z.ZodLiteral<"answer">;
203
+ interaction_id: z.ZodUUID;
204
+ response: z.ZodUnknown;
205
+ request: z.ZodUnknown;
206
+ }, z.core.$strict>, z.ZodObject<{
207
+ type: z.ZodLiteral<"input">;
208
+ input_id: z.ZodUUID;
209
+ conversation_id: z.ZodUUID;
210
+ agent_id: z.ZodUUID;
211
+ provider_session_id: z.ZodNullable<z.ZodString>;
212
+ kind: z.ZodLiteral<"option">;
213
+ option: z.ZodString;
214
+ value: z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>;
215
+ }, z.core.$strict>, z.ZodObject<{
216
+ type: z.ZodLiteral<"input">;
217
+ input_id: z.ZodUUID;
218
+ conversation_id: z.ZodNull;
219
+ agent_id: z.ZodNull;
220
+ provider_session_id: z.ZodNull;
221
+ kind: z.ZodLiteral<"sign_in">;
222
+ cli: z.ZodString;
223
+ ends_in: z.ZodInt;
224
+ }, z.core.$strict>, z.ZodObject<{
225
+ type: z.ZodLiteral<"input">;
226
+ input_id: z.ZodUUID;
227
+ conversation_id: z.ZodNull;
228
+ agent_id: z.ZodNull;
229
+ provider_session_id: z.ZodNull;
230
+ kind: z.ZodLiteral<"update">;
231
+ release: z.ZodString;
232
+ }, z.core.$strict>, z.ZodObject<{
233
+ type: z.ZodLiteral<"input">;
234
+ input_id: z.ZodUUID;
235
+ conversation_id: z.ZodNull;
236
+ agent_id: z.ZodNull;
237
+ provider_session_id: z.ZodNull;
238
+ kind: z.ZodLiteral<"run_wizard">;
239
+ script: z.ZodString;
240
+ }, z.core.$strict>, z.ZodObject<{
241
+ type: z.ZodLiteral<"input">;
242
+ input_id: z.ZodUUID;
243
+ conversation_id: z.ZodNull;
244
+ agent_id: z.ZodNull;
245
+ provider_session_id: z.ZodNull;
246
+ kind: z.ZodLiteral<"run_function">;
247
+ script: z.ZodString;
248
+ input: z.ZodUnknown;
249
+ terminal: z.ZodBoolean;
250
+ time_cap: z.ZodInt;
251
+ output_cap: z.ZodInt;
252
+ }, z.core.$strict>], "kind">;
253
+ export type KitCall = z.infer<typeof KIT_CALL>;
254
+ export type KitMethod = KitCall['kind'];
255
+ export type KitCallOf<Method extends KitMethod> = Extract<KitCall, {
256
+ kind: Method;
257
+ }>;
258
+ export declare const HOUSE_ONE_WAY_CALLS: {
259
+ beat: z.ZodObject<{
260
+ type: z.ZodLiteral<"beat">;
261
+ }, z.core.$strict>;
262
+ watching: z.ZodObject<{
263
+ type: z.ZodLiteral<"watching">;
264
+ watching: z.ZodBoolean;
265
+ }, z.core.$strict>;
266
+ work_available: z.ZodObject<{
267
+ type: z.ZodLiteral<"work_available">;
268
+ subject: z.ZodLiteral<"agents">;
269
+ }, z.core.$strict>;
270
+ wizard_input: z.ZodObject<{
271
+ type: z.ZodLiteral<"wizard_input">;
272
+ wizard: z.ZodUUID;
273
+ data: z.ZodString;
274
+ }, z.core.$strict>;
275
+ wizard_size: z.ZodObject<{
276
+ type: z.ZodLiteral<"wizard_size">;
277
+ wizard: z.ZodUUID;
278
+ cols: z.ZodInt;
279
+ rows: z.ZodInt;
280
+ }, z.core.$strict>;
281
+ wizard_end: z.ZodObject<{
282
+ type: z.ZodLiteral<"wizard_end">;
283
+ wizard: z.ZodUUID;
284
+ }, z.core.$strict>;
285
+ refused: z.ZodObject<{
286
+ type: z.ZodLiteral<"refused">;
287
+ code: z.ZodLiteral<"invalid_message">;
288
+ }, z.core.$strict>;
289
+ };
290
+ export type HouseOneWayCall = {
291
+ [Type in keyof typeof HOUSE_ONE_WAY_CALLS]: z.infer<(typeof HOUSE_ONE_WAY_CALLS)[Type]>;
292
+ }[keyof typeof HOUSE_ONE_WAY_CALLS];
293
+ export type HouseOneWayCallOf<Type extends HouseOneWayCall['type']> = Extract<HouseOneWayCall, {
294
+ type: Type;
295
+ }>;
296
+ export declare const STARTING_STEPS: readonly ['transcription', 'session'];
297
+ export declare const KIT_ONE_WAY_CALLS: {
298
+ turn: z.ZodObject<{
299
+ conversation_id: z.ZodUUID;
300
+ type: z.ZodLiteral<"turn">;
301
+ turn_id: z.ZodUUID;
302
+ operation: z.ZodUnknown;
303
+ }, z.core.$strict>;
304
+ process: z.ZodObject<{
305
+ conversation_id: z.ZodUUID;
306
+ type: z.ZodLiteral<"process">;
307
+ running: z.ZodBoolean;
308
+ }, z.core.$strict>;
309
+ commands: z.ZodObject<{
310
+ conversation_id: z.ZodUUID;
311
+ type: z.ZodLiteral<"commands">;
312
+ commands: z.ZodArray<z.ZodObject<{
313
+ name: z.ZodString;
314
+ description: z.ZodString;
315
+ input: z.ZodOptional<z.ZodNullable<z.ZodObject<{
316
+ hint: z.ZodString;
317
+ }, z.core.$loose>>>;
318
+ }, z.core.$loose>>;
319
+ }, z.core.$strict>;
320
+ options: z.ZodObject<{
321
+ conversation_id: z.ZodUUID;
322
+ type: z.ZodLiteral<"options">;
323
+ options: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
324
+ id: z.ZodString;
325
+ name: z.ZodString;
326
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
327
+ category: z.ZodOptional<z.ZodNullable<z.ZodString>>;
328
+ type: z.ZodLiteral<"select">;
329
+ currentValue: z.ZodString;
330
+ options: z.ZodUnion<readonly [z.ZodArray<z.ZodObject<{
331
+ value: z.ZodString;
332
+ name: z.ZodString;
333
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
334
+ }, z.core.$loose>>, z.ZodArray<z.ZodObject<{
335
+ group: z.ZodString;
336
+ name: z.ZodString;
337
+ options: z.ZodArray<z.ZodObject<{
338
+ value: z.ZodString;
339
+ name: z.ZodString;
340
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
341
+ }, z.core.$loose>>;
342
+ }, z.core.$loose>>]>;
343
+ }, z.core.$loose>, z.ZodObject<{
344
+ id: z.ZodString;
345
+ name: z.ZodString;
346
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
347
+ category: z.ZodOptional<z.ZodNullable<z.ZodString>>;
348
+ type: z.ZodLiteral<"boolean">;
349
+ currentValue: z.ZodBoolean;
350
+ }, z.core.$loose>], "type">>;
351
+ }, z.core.$strict>;
352
+ starting: z.ZodObject<{
353
+ conversation_id: z.ZodUUID;
354
+ type: z.ZodLiteral<"starting">;
355
+ step: z.ZodNullable<z.ZodEnum<{
356
+ session: "session";
357
+ transcription: "transcription";
358
+ }>>;
359
+ }, z.core.$strict>;
360
+ state: z.ZodObject<{
361
+ conversation_id: z.ZodUUID;
362
+ type: z.ZodLiteral<"state">;
363
+ state: z.ZodUnknown;
364
+ }, z.core.$strict>;
365
+ wizard_output: z.ZodObject<{
366
+ type: z.ZodLiteral<"wizard_output">;
367
+ wizard: z.ZodUUID;
368
+ data: z.ZodString;
369
+ }, z.core.$strict>;
370
+ };
371
+ export type KitOneWayCall = {
372
+ [Type in keyof typeof KIT_ONE_WAY_CALLS]: z.infer<(typeof KIT_ONE_WAY_CALLS)[Type]>;
373
+ }[keyof typeof KIT_ONE_WAY_CALLS];
374
+ export type KitOneWayCallOf<Type extends KitOneWayCall['type']> = Extract<KitOneWayCall, {
375
+ type: Type;
376
+ }>;
@@ -0,0 +1,172 @@
1
+ import { z } from 'zod';
2
+ export const KIT_CONNECTION_PATH = '/kit/stream';
3
+ export const KIT_CONNECTION_PROTOCOL_PREFIX = 'house.kit.stream.';
4
+ const PROVIDER_SESSION_ID_MAX = 256;
5
+ const EXIT_STATUS_MAX = 255;
6
+ const TERMINAL_SIDE_MAX = 65_535;
7
+ export const KIT_CAUSE = z.string().min(1).max(4096);
8
+ const EXIT_CODE = z.int().min(0).max(EXIT_STATUS_MAX);
9
+ const KEPT_OUTPUT = { output: z.string(), cut: z.boolean() };
10
+ export const KIT_CALL_RESULT = z.union([
11
+ z.strictObject({ provider_session_id: z.string().min(1).max(PROVIDER_SESSION_ID_MAX) }),
12
+ z.strictObject({ refused: KIT_CAUSE, resume_refused: z.literal(true).optional() }),
13
+ z.strictObject({ exit_code: EXIT_CODE }),
14
+ z.strictObject({ exit_code: EXIT_CODE, ...KEPT_OUTPUT }),
15
+ z.strictObject({ timed_out: z.literal(true), ...KEPT_OUTPUT }),
16
+ z.strictObject({ started: z.literal(true) }),
17
+ z.strictObject({}),
18
+ ]);
19
+ const CONVERSATION_CALL = {
20
+ type: z.literal('input'),
21
+ input_id: z.uuid(),
22
+ conversation_id: z.uuid(),
23
+ agent_id: z.uuid(),
24
+ provider_session_id: z.string().nullable(),
25
+ };
26
+ const ENVIRONMENT_CALL = {
27
+ type: z.literal('input'),
28
+ input_id: z.uuid(),
29
+ conversation_id: z.null(),
30
+ agent_id: z.null(),
31
+ provider_session_id: z.null(),
32
+ };
33
+ function conversationCall(kind, params) {
34
+ return z.strictObject({ ...CONVERSATION_CALL, kind: z.literal(kind), ...params });
35
+ }
36
+ function environmentCall(kind, params) {
37
+ return z.strictObject({ ...ENVIRONMENT_CALL, kind: z.literal(kind), ...params });
38
+ }
39
+ const AFK = z.literal(true).optional();
40
+ export const KIT_CALLS = {
41
+ open: conversationCall('open', { afk: AFK }),
42
+ kill: conversationCall('kill', {}),
43
+ done: conversationCall('done', {}),
44
+ message: conversationCall('message', {
45
+ message_id: z.uuid(),
46
+ text: z.string(),
47
+ first: z.boolean(),
48
+ at_once: z.literal(true).optional(),
49
+ recent: z.string().optional(),
50
+ afk: AFK,
51
+ }),
52
+ take_out: conversationCall('take_out', { message_id: z.uuid() }),
53
+ interrupt: conversationCall('interrupt', { turn_id: z.uuid() }),
54
+ answer: conversationCall('answer', {
55
+ interaction_id: z.uuid(),
56
+ response: z.unknown(),
57
+ request: z.unknown(),
58
+ }),
59
+ option: conversationCall('option', {
60
+ option: z.string(),
61
+ value: z.union([z.string(), z.boolean()]),
62
+ }),
63
+ sign_in: environmentCall('sign_in', { cli: z.string(), ends_in: z.int().nonnegative() }),
64
+ update: environmentCall('update', { release: z.string() }),
65
+ run_wizard: environmentCall('run_wizard', { script: z.string() }),
66
+ run_function: environmentCall('run_function', {
67
+ script: z.string(),
68
+ input: z.unknown(),
69
+ terminal: z.boolean(),
70
+ time_cap: z.int().positive(),
71
+ output_cap: z.int().positive(),
72
+ }),
73
+ };
74
+ export const KIT_CALL = z.discriminatedUnion('kind', [
75
+ KIT_CALLS.open,
76
+ KIT_CALLS.kill,
77
+ KIT_CALLS.done,
78
+ KIT_CALLS.message,
79
+ KIT_CALLS.take_out,
80
+ KIT_CALLS.interrupt,
81
+ KIT_CALLS.answer,
82
+ KIT_CALLS.option,
83
+ KIT_CALLS.sign_in,
84
+ KIT_CALLS.update,
85
+ KIT_CALLS.run_wizard,
86
+ KIT_CALLS.run_function,
87
+ ]);
88
+ const WIZARD = z.uuid();
89
+ const SIDE = z.int().min(1).max(TERMINAL_SIDE_MAX);
90
+ export const HOUSE_ONE_WAY_CALLS = {
91
+ beat: z.strictObject({ type: z.literal('beat') }),
92
+ watching: z.strictObject({ type: z.literal('watching'), watching: z.boolean() }),
93
+ work_available: z.strictObject({
94
+ type: z.literal('work_available'),
95
+ subject: z.literal('agents'),
96
+ }),
97
+ wizard_input: z.strictObject({
98
+ type: z.literal('wizard_input'),
99
+ wizard: WIZARD,
100
+ data: z.string().min(1),
101
+ }),
102
+ wizard_size: z.strictObject({
103
+ type: z.literal('wizard_size'),
104
+ wizard: WIZARD,
105
+ cols: SIDE,
106
+ rows: SIDE,
107
+ }),
108
+ wizard_end: z.strictObject({ type: z.literal('wizard_end'), wizard: WIZARD }),
109
+ refused: z.strictObject({ type: z.literal('refused'), code: z.literal('invalid_message') }),
110
+ };
111
+ const CONVERSATION = { conversation_id: z.uuid() };
112
+ const COMMAND = z.looseObject({
113
+ name: z.string(),
114
+ description: z.string(),
115
+ input: z.looseObject({ hint: z.string() }).nullish(),
116
+ });
117
+ const SELECT_VALUE = z.looseObject({
118
+ value: z.string(),
119
+ name: z.string(),
120
+ description: z.string().nullish(),
121
+ });
122
+ const SELECT_GROUP = z.looseObject({
123
+ group: z.string(),
124
+ name: z.string(),
125
+ options: z.array(SELECT_VALUE),
126
+ });
127
+ const OPTION = {
128
+ id: z.string(),
129
+ name: z.string(),
130
+ description: z.string().nullish(),
131
+ category: z.string().nullish(),
132
+ };
133
+ const SESSION_OPTION = z.discriminatedUnion('type', [
134
+ z.looseObject({
135
+ ...OPTION,
136
+ type: z.literal('select'),
137
+ currentValue: z.string(),
138
+ options: z.union([z.array(SELECT_VALUE), z.array(SELECT_GROUP)]),
139
+ }),
140
+ z.looseObject({ ...OPTION, type: z.literal('boolean'), currentValue: z.boolean() }),
141
+ ]);
142
+ export const STARTING_STEPS = ['transcription', 'session'];
143
+ export const KIT_ONE_WAY_CALLS = {
144
+ turn: z.strictObject({
145
+ type: z.literal('turn'),
146
+ ...CONVERSATION,
147
+ turn_id: z.uuid(),
148
+ operation: z.unknown(),
149
+ }),
150
+ process: z.strictObject({ type: z.literal('process'), ...CONVERSATION, running: z.boolean() }),
151
+ commands: z.strictObject({
152
+ type: z.literal('commands'),
153
+ ...CONVERSATION,
154
+ commands: z.array(COMMAND),
155
+ }),
156
+ options: z.strictObject({
157
+ type: z.literal('options'),
158
+ ...CONVERSATION,
159
+ options: z.array(SESSION_OPTION),
160
+ }),
161
+ starting: z.strictObject({
162
+ type: z.literal('starting'),
163
+ ...CONVERSATION,
164
+ step: z.enum(STARTING_STEPS).nullable(),
165
+ }),
166
+ state: z.strictObject({ type: z.literal('state'), ...CONVERSATION, state: z.unknown() }),
167
+ wizard_output: z.strictObject({
168
+ type: z.literal('wizard_output'),
169
+ wizard: WIZARD,
170
+ data: z.string().min(1),
171
+ }),
172
+ };
@@ -0,0 +1,54 @@
1
+ import { z } from 'zod';
2
+ export declare const ENVIRONMENT_REACHES: readonly ['all', 'all_but_private', 'selected'];
3
+ export type EnvironmentReach = (typeof ENVIRONMENT_REACHES)[number];
4
+ export declare const ENVIRONMENT_ROOM_LIMIT = 256;
5
+ export declare const ENVIRONMENT_ROOM_REFS: z.ZodArray<z.ZodString>;
6
+ export declare const ENVIRONMENT_ROOMS: z.ZodDiscriminatedUnion<[z.ZodObject<{
7
+ reach: z.ZodLiteral<"all">;
8
+ }, z.core.$strict>, z.ZodObject<{
9
+ reach: z.ZodLiteral<"all_but_private">;
10
+ }, z.core.$strict>, z.ZodObject<{
11
+ reach: z.ZodLiteral<"selected">;
12
+ refs: z.ZodArray<z.ZodString>;
13
+ }, z.core.$strict>], "reach">;
14
+ export type EnvironmentRooms = z.infer<typeof ENVIRONMENT_ROOMS>;
15
+ export declare const KIT_ENROLLMENT_ACTS: readonly ['new_environment', 'existing_environment'];
16
+ export type KitEnrollmentAct = (typeof KIT_ENROLLMENT_ACTS)[number];
17
+ export declare const KIT_LOGIN_START: z.ZodObject<{
18
+ act: z.ZodEnum<{
19
+ existing_environment: "existing_environment";
20
+ new_environment: "new_environment";
21
+ }>;
22
+ environment_id: z.ZodOptional<z.ZodUUID>;
23
+ replaces: z.ZodOptional<z.ZodUUID>;
24
+ headless: z.ZodOptional<z.ZodLiteral<true>>;
25
+ rooms: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
26
+ reach: z.ZodLiteral<"all">;
27
+ }, z.core.$strict>, z.ZodObject<{
28
+ reach: z.ZodLiteral<"all_but_private">;
29
+ }, z.core.$strict>, z.ZodObject<{
30
+ reach: z.ZodLiteral<"selected">;
31
+ refs: z.ZodArray<z.ZodString>;
32
+ }, z.core.$strict>], "reach">>;
33
+ code_challenge: z.ZodString;
34
+ }, z.core.$strict>;
35
+ export declare const KIT_LOGIN_STARTED: z.ZodObject<{
36
+ start_url: z.ZodURL;
37
+ login: z.ZodUUID;
38
+ }, z.core.$strict>;
39
+ export declare const KIT_LOGIN_POLL: z.ZodUnion<readonly [z.ZodObject<{
40
+ login: z.ZodUUID;
41
+ code_verifier: z.ZodString;
42
+ }, z.core.$strict>, z.ZodObject<{
43
+ code: z.ZodString;
44
+ }, z.core.$strict>]>;
45
+ export declare const KIT_LOGIN_ISSUED: z.ZodObject<{
46
+ credential: z.ZodString;
47
+ environment: z.ZodUUID;
48
+ user: z.ZodUUID;
49
+ headless_credential: z.ZodOptional<z.ZodString>;
50
+ }, z.core.$strict>;
51
+ export declare const KIT_LOGIN_PATHS: {
52
+ readonly start: '/kit';
53
+ readonly poll: '/kit/token';
54
+ };
@@ -0,0 +1,36 @@
1
+ import { z } from 'zod';
2
+ export const ENVIRONMENT_REACHES = ['all', 'all_but_private', 'selected'];
3
+ export const ENVIRONMENT_ROOM_LIMIT = 256;
4
+ export const ENVIRONMENT_ROOM_REFS = z
5
+ .array(z.string().min(1))
6
+ .min(1)
7
+ .refine((refs) => new Set(refs).size === refs.length, 'list each Room once');
8
+ export const ENVIRONMENT_ROOMS = z.discriminatedUnion('reach', [
9
+ z.strictObject({ reach: z.literal('all') }),
10
+ z.strictObject({ reach: z.literal('all_but_private') }),
11
+ z.strictObject({
12
+ reach: z.literal('selected'),
13
+ refs: ENVIRONMENT_ROOM_REFS.max(ENVIRONMENT_ROOM_LIMIT),
14
+ }),
15
+ ]);
16
+ export const KIT_ENROLLMENT_ACTS = ['new_environment', 'existing_environment'];
17
+ export const KIT_LOGIN_START = z.strictObject({
18
+ act: z.enum(KIT_ENROLLMENT_ACTS),
19
+ environment_id: z.uuid().optional(),
20
+ replaces: z.uuid().optional(),
21
+ headless: z.literal(true).optional(),
22
+ rooms: ENVIRONMENT_ROOMS.optional(),
23
+ code_challenge: z.string().regex(/^[A-Za-z0-9_-]{43}$/),
24
+ });
25
+ export const KIT_LOGIN_STARTED = z.strictObject({ start_url: z.url(), login: z.uuid() });
26
+ export const KIT_LOGIN_POLL = z.union([
27
+ z.strictObject({ login: z.uuid(), code_verifier: z.string().min(43).max(128) }),
28
+ z.strictObject({ code: z.string().max(128) }),
29
+ ]);
30
+ export const KIT_LOGIN_ISSUED = z.strictObject({
31
+ credential: z.string().min(1),
32
+ environment: z.uuid(),
33
+ user: z.uuid(),
34
+ headless_credential: z.string().min(1).optional(),
35
+ });
36
+ export const KIT_LOGIN_PATHS = { start: '/kit', poll: '/kit/token' };
@@ -0,0 +1,8 @@
1
+ export { HOUSE_ONE_WAY_CALLS, KIT_CALL, KIT_CALL_RESULT, KIT_CALLS, KIT_CAUSE, KIT_CONNECTION_PATH, KIT_CONNECTION_PROTOCOL_PREFIX, KIT_ONE_WAY_CALLS, STARTING_STEPS, } from './connection.ts';
2
+ export type { HouseOneWayCall, HouseOneWayCallOf, KitCall, KitCallOf, KitCallResult, KitMethod, KitOneWayCall, KitOneWayCallOf, } from './connection.ts';
3
+ export { AGENT_CAPABILITY_DECLARATION, DECLARED_SECRET_CEREMONY, DESIRED_AGENT_ROUTE, DESIRED_AGENTS, ENVIRONMENT_FORMS, FILE_BYTES, FILE_NAME, FILE_NAME_MAX, KIT_ACTS, KIT_DOOR_ACTS, KIT_QUESTION, KIT_TURN_END, KIT_TURN_IMAGE, KIT_UPLOAD_FINISH, LOCAL_COPY_ROOM, MEDIA_TYPE, PART_SHA256, REPORTED_AGENT_KIND, SECRET_CEREMONY_STEPS_MAX, SECRET_RELAY_OUTCOME, SECRET_RELAY_RELEASES, SHA256, TRANSCRIPT, } from './acts.ts';
4
+ export type { AgentCapabilityDeclaration, DeclaredSecretCeremony, DesiredAgentRoute, KitActAnswer, KitActDeclaration, KitActName, KitActRequest, KitDoorAct, KitDoorAnswer, KitQuestion, KitTurnEnd, KitTurnImage, LocalCopyRoom, ReportedAgentKind, SecretCeremonyStep, SecretRelayOutcome, Transcript, TranscriptionReport, } from './acts.ts';
5
+ export { ENVIRONMENT_REACHES, ENVIRONMENT_ROOM_LIMIT, ENVIRONMENT_ROOM_REFS, ENVIRONMENT_ROOMS, KIT_ENROLLMENT_ACTS, KIT_LOGIN_ISSUED, KIT_LOGIN_PATHS, KIT_LOGIN_POLL, KIT_LOGIN_START, KIT_LOGIN_STARTED, } from './enrollment.ts';
6
+ export type { EnvironmentReach, EnvironmentRooms, KitEnrollmentAct } from './enrollment.ts';
7
+ export { BUILDING_KIT, KIT_COMMANDS, KIT_DECLARATION, KIT_WIRE, KIT_WIRE_HEADER, kitWire, kitWireRefusal, } from './wire.ts';
8
+ export type { BuildingKit, KitCommands, KitWireRefusal } from './wire.ts';
package/dist/index.js ADDED
@@ -0,0 +1,4 @@
1
+ export { HOUSE_ONE_WAY_CALLS, KIT_CALL, KIT_CALL_RESULT, KIT_CALLS, KIT_CAUSE, KIT_CONNECTION_PATH, KIT_CONNECTION_PROTOCOL_PREFIX, KIT_ONE_WAY_CALLS, STARTING_STEPS, } from './connection.js';
2
+ export { AGENT_CAPABILITY_DECLARATION, DECLARED_SECRET_CEREMONY, DESIRED_AGENT_ROUTE, DESIRED_AGENTS, ENVIRONMENT_FORMS, FILE_BYTES, FILE_NAME, FILE_NAME_MAX, KIT_ACTS, KIT_DOOR_ACTS, KIT_QUESTION, KIT_TURN_END, KIT_TURN_IMAGE, KIT_UPLOAD_FINISH, LOCAL_COPY_ROOM, MEDIA_TYPE, PART_SHA256, REPORTED_AGENT_KIND, SECRET_CEREMONY_STEPS_MAX, SECRET_RELAY_OUTCOME, SECRET_RELAY_RELEASES, SHA256, TRANSCRIPT, } from './acts.js';
3
+ export { ENVIRONMENT_REACHES, ENVIRONMENT_ROOM_LIMIT, ENVIRONMENT_ROOM_REFS, ENVIRONMENT_ROOMS, KIT_ENROLLMENT_ACTS, KIT_LOGIN_ISSUED, KIT_LOGIN_PATHS, KIT_LOGIN_POLL, KIT_LOGIN_START, KIT_LOGIN_STARTED, } from './enrollment.js';
4
+ export { BUILDING_KIT, KIT_COMMANDS, KIT_DECLARATION, KIT_WIRE, KIT_WIRE_HEADER, kitWire, kitWireRefusal, } from './wire.js';