@fungi.computer/whistle 0.0.0-stage → 0.0.1

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,1033 @@
1
+ <!-- Generated by Botanical API docs (TypeDoc + typedoc-plugin-markdown). Do not edit. -->
2
+
3
+ [**@fungi.computer/whistle**](README.md)
4
+
5
+ ---
6
+
7
+ [@fungi.computer/whistle](README.md) / wire
8
+
9
+ # wire
10
+
11
+ ## Type Aliases
12
+
13
+ ### ReadonlySchemaValue
14
+
15
+ ```ts
16
+ type ReadonlySchemaValue<T> = T extends infer Item[] ? readonly ReadonlySchemaValue<Item>[] : T extends object ? { readonly [Key in keyof T]: ReadonlySchemaValue<T[Key]> } : T;
17
+ ```
18
+
19
+ Preserve readonly domain collections while deriving contracts from schemas.
20
+
21
+ #### Type Parameters
22
+
23
+ | Type Parameter |
24
+ | -------------- |
25
+ | `T` |
26
+
27
+ ---
28
+
29
+ ### WhistleJsonValue
30
+
31
+ ```ts
32
+ type WhistleJsonValue = ReadonlySchemaValue<
33
+ z.output<typeof WhistleJsonValueSchema>
34
+ >;
35
+ ```
36
+
37
+ JSON values accepted at Whistle transport boundaries.
38
+
39
+ ---
40
+
41
+ ### WhistleJsonObject
42
+
43
+ ```ts
44
+ type WhistleJsonObject = ReadonlySchemaValue<
45
+ z.output<typeof WhistleJsonObjectSchema>
46
+ >;
47
+ ```
48
+
49
+ A JSON object accepted at Whistle transport boundaries.
50
+
51
+ ---
52
+
53
+ ### WhistleFailure
54
+
55
+ ```ts
56
+ type WhistleFailure = ReadonlySchemaValue<
57
+ z.output<typeof WhistleFailureSchema>
58
+ >;
59
+ ```
60
+
61
+ Portable failure data that crosses Whistle transports.
62
+
63
+ ---
64
+
65
+ ### WhistleActionSchema
66
+
67
+ ```ts
68
+ type WhistleActionSchema = ReadonlySchemaValue<
69
+ z.output<typeof WhistleActionSchemaSchema>
70
+ >;
71
+ ```
72
+
73
+ JSON Schema document used as an action input or output contract.
74
+
75
+ ---
76
+
77
+ ### WhistleAvailability
78
+
79
+ ```ts
80
+ type WhistleAvailability = ReadonlySchemaValue<
81
+ z.output<typeof WhistleAvailabilitySchema>
82
+ >;
83
+ ```
84
+
85
+ Host-owned availability fact carried in agent snapshots.
86
+
87
+ ---
88
+
89
+ ### WhistleActionPresentation
90
+
91
+ ```ts
92
+ type WhistleActionPresentation = ReadonlySchemaValue<
93
+ z.output<typeof WhistleActionPresentationSchema>
94
+ >;
95
+ ```
96
+
97
+ Renderer-neutral presentation data attached to an action.
98
+
99
+ ---
100
+
101
+ ### WhistleAction
102
+
103
+ ```ts
104
+ type WhistleAction = ReadonlySchemaValue<
105
+ z.output<typeof WhistleActionDataSchema>
106
+ >;
107
+ ```
108
+
109
+ Serializable action data accepted by Whistle.
110
+
111
+ ---
112
+
113
+ ### WhistleSlashArguments
114
+
115
+ ```ts
116
+ type WhistleSlashArguments = ReadonlySchemaValue<
117
+ z.output<typeof WhistleSlashArgumentsSchema>
118
+ >;
119
+ ```
120
+
121
+ Slash command parsing metadata accepted from transport owners.
122
+
123
+ ---
124
+
125
+ ### WhistleSlashWord
126
+
127
+ ```ts
128
+ type WhistleSlashWord = ReadonlySchemaValue<
129
+ NonNullable<z.output<typeof WhistleSlashArgumentsSchema>["words"]>[number]
130
+ >;
131
+ ```
132
+
133
+ A fixed word and its action arguments within a slash command.
134
+
135
+ ---
136
+
137
+ ### WhistleCommandProjections
138
+
139
+ ```ts
140
+ type WhistleCommandProjections = ReadonlySchemaValue<
141
+ z.output<typeof WhistleCommandProjectionsSchema>
142
+ >;
143
+ ```
144
+
145
+ Projection membership selected by a semantic command owner.
146
+
147
+ ---
148
+
149
+ ### WhistleCommandDefinition
150
+
151
+ ```ts
152
+ type WhistleCommandDefinition = ReadonlySchemaValue<
153
+ z.output<typeof WhistleCommandDefinitionSchema>
154
+ >;
155
+ ```
156
+
157
+ Data-only command definition accepted at adapter boundaries.
158
+
159
+ ---
160
+
161
+ ### WhistleAgentProjectionData
162
+
163
+ ```ts
164
+ type WhistleAgentProjectionData = z.output<typeof WhistleAgentProjectionSchema>;
165
+ ```
166
+
167
+ Decoded agent projection data as received across the wire.
168
+
169
+ ---
170
+
171
+ ### WhistlePrompt
172
+
173
+ ```ts
174
+ type WhistlePrompt = ReadonlySchemaValue<z.output<typeof WhistlePromptSchema>>;
175
+ ```
176
+
177
+ A renderer-neutral interaction prompt.
178
+
179
+ ---
180
+
181
+ ### WhistlePromptOption
182
+
183
+ ```ts
184
+ type WhistlePromptOption = NonNullable<
185
+ Extract<
186
+ WhistlePrompt,
187
+ {
188
+ type: "choice";
189
+ }
190
+ >["options"][number]
191
+ >;
192
+ ```
193
+
194
+ One selectable value in a parsed interaction prompt.
195
+
196
+ ---
197
+
198
+ ### WhistleNotice
199
+
200
+ ```ts
201
+ type WhistleNotice = ReadonlySchemaValue<z.output<typeof WhistleNoticeSchema>>;
202
+ ```
203
+
204
+ A renderer-neutral interaction notice.
205
+
206
+ ---
207
+
208
+ ### WhistleNoticeLink
209
+
210
+ ```ts
211
+ type WhistleNoticeLink = ReadonlySchemaValue<
212
+ NonNullable<
213
+ Extract<
214
+ z.output<typeof WhistleNoticeSchema>,
215
+ {
216
+ type: "info";
217
+ }
218
+ >["links"]
219
+ >[number]
220
+ >;
221
+ ```
222
+
223
+ One link included in a parsed informational notice.
224
+
225
+ ---
226
+
227
+ ### WhistlePromptAnswers
228
+
229
+ ```ts
230
+ type WhistlePromptAnswers = object;
231
+ ```
232
+
233
+ Answer types owned by the closed prompt vocabulary.
234
+
235
+ #### Properties
236
+
237
+ ##### confirmation
238
+
239
+ ```ts
240
+ confirmation: boolean;
241
+ ```
242
+
243
+ ##### text
244
+
245
+ ```ts
246
+ text: string;
247
+ ```
248
+
249
+ ##### choice
250
+
251
+ ```ts
252
+ choice: string;
253
+ ```
254
+
255
+ ---
256
+
257
+ ### WhistlePromptOf
258
+
259
+ ```ts
260
+ type WhistlePromptOf<Kind> = {
261
+ [K in Kind]: Extract<WhistlePrompt, { type: K }> & { type: K };
262
+ }[Kind];
263
+ ```
264
+
265
+ A prompt and its discriminator remain correlated through generic dispatch.
266
+
267
+ #### Type Parameters
268
+
269
+ | Type Parameter |
270
+ | -------------------------------------------------------------- |
271
+ | `Kind` _extends_ [`WhistlePrompt`](#whistleprompt)\[`"type"`\] |
272
+
273
+ ## Variables
274
+
275
+ ### WhistleAvailabilitySchema
276
+
277
+ ```ts
278
+ const WhistleAvailabilitySchema: ZodDiscriminatedUnion<
279
+ [
280
+ ZodObject<
281
+ {
282
+ status: ZodLiteral<"available">;
283
+ },
284
+ $strict
285
+ >,
286
+ ZodObject<
287
+ {
288
+ status: ZodLiteral<"unavailable">;
289
+ reason: ZodString;
290
+ },
291
+ $strict
292
+ >,
293
+ ],
294
+ "status"
295
+ >;
296
+ ```
297
+
298
+ Host-owned availability carried by every discovered agent row.
299
+
300
+ ---
301
+
302
+ ### WhistleJsonValueSchema
303
+
304
+ ```ts
305
+ const WhistleJsonValueSchema: ZodJSONSchema = json;
306
+ ```
307
+
308
+ The JSON value grammar shared by Whistle transports and App adapters.
309
+
310
+ ---
311
+
312
+ ### WhistleJsonObjectSchema
313
+
314
+ ```ts
315
+ const WhistleJsonObjectSchema: ZodRecord<ZodString, ZodJSONSchema>;
316
+ ```
317
+
318
+ One JSON object, used for action schemas and custom presentation data.
319
+
320
+ ---
321
+
322
+ ### parseJsonValue
323
+
324
+ ```ts
325
+ const parseJsonValue: typeof WhistleJsonValueSchema.parse;
326
+ ```
327
+
328
+ Parse copied JSON data at an untrusted transport boundary.
329
+
330
+ ---
331
+
332
+ ### parseJsonObject
333
+
334
+ ```ts
335
+ const parseJsonObject: typeof WhistleJsonObjectSchema.parse;
336
+ ```
337
+
338
+ Parse a copied JSON object at an untrusted transport boundary.
339
+
340
+ ---
341
+
342
+ ### WhistleFailureSchema
343
+
344
+ ```ts
345
+ const WhistleFailureSchema: ZodObject<
346
+ {
347
+ code: ZodString;
348
+ message: ZodString;
349
+ details: ZodOptional<ZodJSONSchema>;
350
+ },
351
+ $strict
352
+ >;
353
+ ```
354
+
355
+ General portable failure data for adapters that cross a transport.
356
+
357
+ ---
358
+
359
+ ### parseFailure
360
+
361
+ ```ts
362
+ const parseFailure: typeof WhistleFailureSchema.parse;
363
+ ```
364
+
365
+ Parse failure data without carrying an Error or stack across the wire.
366
+
367
+ ---
368
+
369
+ ### WhistleActionSchemaSchema
370
+
371
+ ```ts
372
+ const WhistleActionSchemaSchema: ZodRecord<ZodString, ZodJSONSchema> =
373
+ WhistleJsonObjectSchema;
374
+ ```
375
+
376
+ The JSON object shape used by Whistle action schemas.
377
+
378
+ ---
379
+
380
+ ### WhistleActionPresentationSchema
381
+
382
+ ```ts
383
+ const WhistleActionPresentationSchema: ZodUnion<
384
+ readonly [
385
+ ZodObject<
386
+ {
387
+ type: ZodLiteral<"action">;
388
+ },
389
+ $strict
390
+ >,
391
+ ZodObject<
392
+ {
393
+ type: ZodLiteral<"custom">;
394
+ data: ZodRecord<ZodString, ZodJSONSchema>;
395
+ },
396
+ $strict
397
+ >,
398
+ ZodObject<
399
+ {
400
+ type: ZodLiteral<"choice">;
401
+ options: ZodArray<
402
+ ZodObject<
403
+ {
404
+ value: ZodJSONSchema;
405
+ label: ZodString;
406
+ description: ZodOptional<ZodString>;
407
+ },
408
+ $strip
409
+ >
410
+ >;
411
+ },
412
+ $strict
413
+ >,
414
+ ZodObject<
415
+ {
416
+ type: ZodLiteral<"form">;
417
+ submitLabel: ZodOptional<ZodString>;
418
+ },
419
+ $strict
420
+ >,
421
+ ZodObject<
422
+ {
423
+ type: ZodLiteral<"confirmation">;
424
+ message: ZodString;
425
+ confirmLabel: ZodOptional<ZodString>;
426
+ cancelLabel: ZodOptional<ZodString>;
427
+ },
428
+ $strict
429
+ >,
430
+ ]
431
+ >;
432
+ ```
433
+
434
+ Validate renderer-neutral presentation data attached to an action.
435
+
436
+ ---
437
+
438
+ ### WhistleActionDataSchema
439
+
440
+ ```ts
441
+ const WhistleActionDataSchema: ZodObject<{
442
+ inputSchema: ZodOptional<ZodRecord<ZodString, ZodJSONSchema>>;
443
+ outputSchema: ZodOptional<ZodRecord<ZodString, ZodJSONSchema>>;
444
+ presentation: ZodOptional<ZodUnion<readonly [ZodObject<{
445
+ type: ZodLiteral<"action">;
446
+ }, $strict>, ZodObject<{
447
+ type: ZodLiteral<"custom">;
448
+ data: ZodRecord<ZodString, ZodJSONSchema>;
449
+ }, $strict>, ZodObject<{
450
+ type: ZodLiteral<"choice">;
451
+ options: ZodArray<ZodObject<{
452
+ value: ZodJSONSchema;
453
+ label: ZodString;
454
+ description: ZodOptional<...>;
455
+ }, $strip>>;
456
+ }, $strict>, ZodObject<{
457
+ type: ZodLiteral<"form">;
458
+ submitLabel: ZodOptional<ZodString>;
459
+ }, $strict>, ZodObject<{
460
+ type: ZodLiteral<"confirmation">;
461
+ message: ZodString;
462
+ confirmLabel: ZodOptional<ZodString>;
463
+ cancelLabel: ZodOptional<ZodString>;
464
+ }, $strict>]>>;
465
+ }, $strict>;
466
+ ```
467
+
468
+ Validate the serializable action contract carried by a command.
469
+
470
+ ---
471
+
472
+ ### WhistleSlashArgumentsSchema
473
+
474
+ ```ts
475
+ const WhistleSlashArgumentsSchema: ZodObject<
476
+ {
477
+ hint: ZodPipe<ZodString, ZodString>;
478
+ words: ZodOptional<
479
+ ZodArray<
480
+ ZodObject<
481
+ {
482
+ word: ZodString;
483
+ description: ZodOptional<ZodPipe<ZodString, ZodString>>;
484
+ arguments: ZodRecord<ZodString, ZodJSONSchema>;
485
+ },
486
+ $strict
487
+ >
488
+ >
489
+ >;
490
+ text: ZodOptional<
491
+ ZodObject<
492
+ {
493
+ field: ZodPipe<ZodString, ZodString>;
494
+ arguments: ZodRecord<ZodString, ZodJSONSchema>;
495
+ requestIdField: ZodOptional<ZodPipe<ZodString, ZodString>>;
496
+ },
497
+ $strict
498
+ >
499
+ >;
500
+ },
501
+ $strict
502
+ >;
503
+ ```
504
+
505
+ Validate aliases and argument mapping metadata for slash commands.
506
+
507
+ ---
508
+
509
+ ### WhistleCommandProjectionsSchema
510
+
511
+ ```ts
512
+ const WhistleCommandProjectionsSchema: ZodObject<{
513
+ bindings: ZodOptional<ZodObject<{
514
+ order: ZodOptional<ZodNumber>;
515
+ values: ZodArray<ZodString>;
516
+ }, $strict>>;
517
+ agent: ZodOptional<ZodObject<{
518
+ keybind: ZodOptional<ZodString>;
519
+ order: ZodOptional<ZodNumber>;
520
+ }, $strict>>;
521
+ help: ZodOptional<ZodObject<{
522
+ order: ZodOptional<ZodNumber>;
523
+ }, $strict>>;
524
+ menu: ZodOptional<ZodObject<{
525
+ order: ZodOptional<ZodNumber>;
526
+ }, $strict>>;
527
+ palette: ZodOptional<ZodObject<{
528
+ order: ZodOptional<ZodNumber>;
529
+ }, $strict>>;
530
+ slash: ZodOptional<ZodObject<{
531
+ aliases: ZodArray<ZodString>;
532
+ order: ZodOptional<ZodNumber>;
533
+ arguments: ZodOptional<ZodObject<{
534
+ hint: ZodPipe<ZodString, ZodString>;
535
+ words: ZodOptional<ZodArray<ZodObject<..., ...>>>;
536
+ text: ZodOptional<ZodObject<{
537
+ field: ...;
538
+ arguments: ...;
539
+ requestIdField: ...;
540
+ }, $strict>>;
541
+ }, $strict>>;
542
+ }, $strict>>;
543
+ }, $strict>;
544
+ ```
545
+
546
+ Validate explicit membership and ordering across Whistle surfaces.
547
+
548
+ ---
549
+
550
+ ### WhistleCommandDefinitionSchema
551
+
552
+ ```ts
553
+ const WhistleCommandDefinitionSchema: ZodObject<{
554
+ id: ZodString;
555
+ title: ZodString;
556
+ category: ZodString;
557
+ description: ZodOptional<ZodString>;
558
+ projections: ZodOptional<ZodObject<{
559
+ bindings: ZodOptional<ZodObject<{
560
+ order: ZodOptional<ZodNumber>;
561
+ values: ZodArray<ZodString>;
562
+ }, $strict>>;
563
+ agent: ZodOptional<ZodObject<{
564
+ keybind: ZodOptional<ZodString>;
565
+ order: ZodOptional<ZodNumber>;
566
+ }, $strict>>;
567
+ help: ZodOptional<ZodObject<{
568
+ order: ZodOptional<ZodNumber>;
569
+ }, $strict>>;
570
+ menu: ZodOptional<ZodObject<{
571
+ order: ZodOptional<ZodNumber>;
572
+ }, $strict>>;
573
+ palette: ZodOptional<ZodObject<{
574
+ order: ZodOptional<ZodNumber>;
575
+ }, $strict>>;
576
+ slash: ZodOptional<ZodObject<{
577
+ aliases: ZodArray<ZodString>;
578
+ order: ZodOptional<ZodNumber>;
579
+ arguments: ZodOptional<ZodObject<{
580
+ hint: ...;
581
+ words: ...;
582
+ text: ...;
583
+ }, $strict>>;
584
+ }, $strict>>;
585
+ }, $strict>>;
586
+ action: ZodOptional<ZodObject<{
587
+ inputSchema: ZodOptional<ZodRecord<ZodString, ZodJSONSchema>>;
588
+ outputSchema: ZodOptional<ZodRecord<ZodString, ZodJSONSchema>>;
589
+ presentation: ZodOptional<ZodUnion<readonly [ZodObject<{
590
+ type: ZodLiteral<...>;
591
+ }, $strict>, ZodObject<{
592
+ type: ZodLiteral<...>;
593
+ data: ZodRecord<..., ...>;
594
+ }, $strict>, ZodObject<{
595
+ type: ZodLiteral<...>;
596
+ options: ZodArray<...>;
597
+ }, $strict>, ZodObject<{
598
+ type: ZodLiteral<...>;
599
+ submitLabel: ZodOptional<...>;
600
+ }, $strict>, ZodObject<{
601
+ type: ZodLiteral<...>;
602
+ message: ZodString;
603
+ confirmLabel: ZodOptional<...>;
604
+ cancelLabel: ZodOptional<...>;
605
+ }, $strict>]>>;
606
+ }, $strict>>;
607
+ availability: ZodOptional<ZodDiscriminatedUnion<[ZodObject<{
608
+ status: ZodLiteral<"available">;
609
+ }, $strict>, ZodObject<{
610
+ status: ZodLiteral<"unavailable">;
611
+ reason: ZodString;
612
+ }, $strict>], "status">>;
613
+ }, $strict>;
614
+ ```
615
+
616
+ Validate data-only command definitions supplied by an adapter.
617
+
618
+ ---
619
+
620
+ ### parseAction
621
+
622
+ ```ts
623
+ const parseAction: typeof WhistleActionDataSchema.parse;
624
+ ```
625
+
626
+ Parse action metadata once before an adapter constructs a Whistle command.
627
+
628
+ ---
629
+
630
+ ### parseProjections
631
+
632
+ ```ts
633
+ const parseProjections: typeof WhistleCommandProjectionsSchema.parse;
634
+ ```
635
+
636
+ Parse the Whistle-owned projection metadata supplied by an App.
637
+
638
+ ---
639
+
640
+ ### parseAvailability
641
+
642
+ ```ts
643
+ const parseAvailability: typeof availabilitySchema.parse;
644
+ ```
645
+
646
+ Parse an availability fact while preserving its reason.
647
+
648
+ ---
649
+
650
+ ### parseCommandDefinition
651
+
652
+ ```ts
653
+ const parseCommandDefinition: typeof WhistleCommandDefinitionSchema.parse;
654
+ ```
655
+
656
+ Parse one data-only command definition before an adapter creates a command.
657
+
658
+ ---
659
+
660
+ ### WhistleAgentProjectionSchema
661
+
662
+ ```ts
663
+ const WhistleAgentProjectionSchema: ZodObject<
664
+ {
665
+ commandId: ZodString;
666
+ sourceId: ZodString;
667
+ scope: ZodOptional<ZodString>;
668
+ title: ZodString;
669
+ category: ZodString;
670
+ description: ZodOptional<ZodString>;
671
+ order: ZodNumber;
672
+ availability: ZodDiscriminatedUnion<
673
+ [
674
+ ZodObject<
675
+ {
676
+ status: ZodLiteral<"available">;
677
+ },
678
+ $strict
679
+ >,
680
+ ZodObject<
681
+ {
682
+ status: ZodLiteral<"unavailable">;
683
+ reason: ZodString;
684
+ },
685
+ $strict
686
+ >,
687
+ ],
688
+ "status"
689
+ >;
690
+ action: ZodOptional<
691
+ ZodObject<
692
+ {
693
+ inputSchema: ZodOptional<ZodRecord<ZodString, ZodJSONSchema>>;
694
+ outputSchema: ZodOptional<ZodRecord<ZodString, ZodJSONSchema>>;
695
+ },
696
+ $strict
697
+ >
698
+ >;
699
+ keybind: ZodOptional<ZodString>;
700
+ },
701
+ $strict
702
+ >;
703
+ ```
704
+
705
+ One neutral agent row emitted by Whistle's `snapshot.agent` projection.
706
+
707
+ ---
708
+
709
+ ### WhistleAgentProjectionsSchema
710
+
711
+ ```ts
712
+ const WhistleAgentProjectionsSchema: ZodArray<
713
+ ZodObject<
714
+ {
715
+ commandId: ZodString;
716
+ sourceId: ZodString;
717
+ scope: ZodOptional<ZodString>;
718
+ title: ZodString;
719
+ category: ZodString;
720
+ description: ZodOptional<ZodString>;
721
+ order: ZodNumber;
722
+ availability: ZodDiscriminatedUnion<
723
+ [
724
+ ZodObject<
725
+ {
726
+ status: ZodLiteral<"available">;
727
+ },
728
+ $strict
729
+ >,
730
+ ZodObject<
731
+ {
732
+ status: ZodLiteral<"unavailable">;
733
+ reason: ZodString;
734
+ },
735
+ $strict
736
+ >,
737
+ ],
738
+ "status"
739
+ >;
740
+ action: ZodOptional<
741
+ ZodObject<
742
+ {
743
+ inputSchema: ZodOptional<ZodRecord<ZodString, ZodJSONSchema>>;
744
+ outputSchema: ZodOptional<ZodRecord<ZodString, ZodJSONSchema>>;
745
+ },
746
+ $strict
747
+ >
748
+ >;
749
+ keybind: ZodOptional<ZodString>;
750
+ },
751
+ $strict
752
+ >
753
+ >;
754
+ ```
755
+
756
+ A neutral Whistle agent projection collection.
757
+
758
+ ---
759
+
760
+ ### parse
761
+
762
+ ```ts
763
+ const parse: typeof WhistleAgentProjectionsSchema.parse;
764
+ ```
765
+
766
+ Decode an untrusted agent projection collection at the wire boundary.
767
+
768
+ ---
769
+
770
+ ### interactionTextLimit
771
+
772
+ ```ts
773
+ const interactionTextLimit: 8192 = 8192;
774
+ ```
775
+
776
+ Longest prompt answer or message an interaction carries.
777
+
778
+ ---
779
+
780
+ ### WhistlePromptSchema
781
+
782
+ ```ts
783
+ const WhistlePromptSchema: ZodDiscriminatedUnion<
784
+ [
785
+ ZodObject<
786
+ {
787
+ type: ZodLiteral<"choice">;
788
+ message: ZodPipe<ZodString, ZodString>;
789
+ collapsedGroup: ZodOptional<ZodPipe<ZodString, ZodString>>;
790
+ options: ZodArray<
791
+ ZodObject<
792
+ {
793
+ value: ZodPipe<ZodString, ZodString>;
794
+ label: ZodPipe<ZodString, ZodString>;
795
+ description: ZodOptional<ZodPipe<ZodString, ZodString>>;
796
+ group: ZodOptional<ZodPipe<ZodString, ZodString>>;
797
+ },
798
+ $strict
799
+ >
800
+ >;
801
+ },
802
+ $strict
803
+ >,
804
+ ZodObject<
805
+ {
806
+ type: ZodLiteral<"text">;
807
+ message: ZodPipe<ZodString, ZodString>;
808
+ placeholder: ZodOptional<ZodPipe<ZodString, ZodString>>;
809
+ secret: ZodOptional<ZodBoolean>;
810
+ },
811
+ $strict
812
+ >,
813
+ ZodObject<
814
+ {
815
+ type: ZodLiteral<"confirmation">;
816
+ message: ZodPipe<ZodString, ZodString>;
817
+ confirmLabel: ZodOptional<ZodPipe<ZodString, ZodString>>;
818
+ cancelLabel: ZodOptional<ZodPipe<ZodString, ZodString>>;
819
+ },
820
+ $strict
821
+ >,
822
+ ],
823
+ "type"
824
+ >;
825
+ ```
826
+
827
+ Validate renderer-neutral interaction prompts received from a host.
828
+
829
+ ---
830
+
831
+ ### WhistleNoticeSchema
832
+
833
+ ```ts
834
+ const WhistleNoticeSchema: ZodDiscriminatedUnion<
835
+ [
836
+ ZodObject<
837
+ {
838
+ type: ZodLiteral<"info">;
839
+ message: ZodPipe<ZodString, ZodString>;
840
+ links: ZodOptional<
841
+ ZodArray<
842
+ ZodObject<
843
+ {
844
+ url: ZodURL;
845
+ label: ZodOptional<ZodPipe<ZodString, ZodString>>;
846
+ },
847
+ $strict
848
+ >
849
+ >
850
+ >;
851
+ },
852
+ $strict
853
+ >,
854
+ ZodObject<
855
+ {
856
+ type: ZodLiteral<"progress">;
857
+ message: ZodPipe<ZodString, ZodString>;
858
+ },
859
+ $strict
860
+ >,
861
+ ZodObject<
862
+ {
863
+ type: ZodLiteral<"handoff">;
864
+ url: ZodURL;
865
+ code: ZodOptional<ZodPipe<ZodString, ZodString>>;
866
+ message: ZodOptional<ZodPipe<ZodString, ZodString>>;
867
+ },
868
+ $strict
869
+ >,
870
+ ZodObject<
871
+ {
872
+ type: ZodLiteral<"success">;
873
+ message: ZodPipe<ZodString, ZodString>;
874
+ },
875
+ $strict
876
+ >,
877
+ ],
878
+ "type"
879
+ >;
880
+ ```
881
+
882
+ Validate interaction notices received from a host.
883
+
884
+ ---
885
+
886
+ ### parsePrompt
887
+
888
+ ```ts
889
+ const parsePrompt: typeof WhistlePromptSchema.parse;
890
+ ```
891
+
892
+ Parse one interaction prompt at the boundary where a client renders it.
893
+
894
+ ---
895
+
896
+ ### parseNotice
897
+
898
+ ```ts
899
+ const parseNotice: typeof WhistleNoticeSchema.parse;
900
+ ```
901
+
902
+ Parse one interaction notice at the boundary where a client renders it.
903
+
904
+ ## Functions
905
+
906
+ ### createPromptAnswerParser()
907
+
908
+ ```ts
909
+ function createPromptAnswerParser<Kind>(
910
+ prompt,
911
+ ): (value) => WhistlePromptAnswers[Kind];
912
+ ```
913
+
914
+ Capture a prompt's parsed answer contract before handing it to a renderer.
915
+
916
+ #### Type Parameters
917
+
918
+ | Type Parameter |
919
+ | ----------------------------------------------------------- |
920
+ | `Kind` _extends_ `"text"` \| `"choice"` \| `"confirmation"` |
921
+
922
+ #### Parameters
923
+
924
+ | Parameter | Type |
925
+ | --------- | ----------------------------------------------- |
926
+ | `prompt` | [`WhistlePromptOf`](#whistlepromptof)\<`Kind`\> |
927
+
928
+ #### Returns
929
+
930
+ (`value`) => [`WhistlePromptAnswers`](#whistlepromptanswers)\[`Kind`\]
931
+
932
+ ---
933
+
934
+ ### parsePromptAnswer()
935
+
936
+ ```ts
937
+ function parsePromptAnswer<Kind>(prompt, value): WhistlePromptAnswers[Kind];
938
+ ```
939
+
940
+ Parse the answer a human gave to one prompt before the command sees it.
941
+
942
+ #### Type Parameters
943
+
944
+ | Type Parameter |
945
+ | ----------------------------------------------------------- |
946
+ | `Kind` _extends_ `"text"` \| `"choice"` \| `"confirmation"` |
947
+
948
+ #### Parameters
949
+
950
+ | Parameter | Type |
951
+ | --------- | ----------------------------------------------- |
952
+ | `prompt` | [`WhistlePromptOf`](#whistlepromptof)\<`Kind`\> |
953
+ | `value` | `string` \| `boolean` |
954
+
955
+ #### Returns
956
+
957
+ [`WhistlePromptAnswers`](#whistlepromptanswers)\[`Kind`\]
958
+
959
+ ---
960
+
961
+ ### createPromptAnswerDecoder()
962
+
963
+ ```ts
964
+ function createPromptAnswerDecoder<Kind>(prompt): (value) =>
965
+ | Readonly<{
966
+ kind: "accepted";
967
+ value: WhistlePromptAnswers[Kind];
968
+ }>
969
+ | Readonly<{
970
+ kind: "invalid";
971
+ cause: ZodError;
972
+ }>;
973
+ ```
974
+
975
+ Capture a typed answer decoder; invalid input stays an explicit outcome.
976
+
977
+ #### Type Parameters
978
+
979
+ | Type Parameter |
980
+ | ----------------------------------------------------------- |
981
+ | `Kind` _extends_ `"text"` \| `"choice"` \| `"confirmation"` |
982
+
983
+ #### Parameters
984
+
985
+ | Parameter | Type |
986
+ | --------- | ----------------------------------------------- |
987
+ | `prompt` | [`WhistlePromptOf`](#whistlepromptof)\<`Kind`\> |
988
+
989
+ #### Returns
990
+
991
+ (`value`) => \| `Readonly`\<\{ `kind`: `"accepted"`; `value`:
992
+ [`WhistlePromptAnswers`](#whistlepromptanswers)\[`Kind`\]; \}\> \|
993
+ `Readonly`\<\{ `kind`: `"invalid"`; `cause`: `ZodError`; \}\>
994
+
995
+ ---
996
+
997
+ ### decodePromptAnswer()
998
+
999
+ ```ts
1000
+ function decodePromptAnswer<Kind>(
1001
+ prompt,
1002
+ value,
1003
+ ):
1004
+ | Readonly<{
1005
+ kind: "invalid";
1006
+ cause: ZodError;
1007
+ }>
1008
+ | Readonly<{
1009
+ kind: "accepted";
1010
+ value: WhistlePromptAnswers[Kind];
1011
+ }>;
1012
+ ```
1013
+
1014
+ Decode a human answer without throwing so renderers can handle invalid input.
1015
+
1016
+ #### Type Parameters
1017
+
1018
+ | Type Parameter |
1019
+ | ----------------------------------------------------------- |
1020
+ | `Kind` _extends_ `"text"` \| `"choice"` \| `"confirmation"` |
1021
+
1022
+ #### Parameters
1023
+
1024
+ | Parameter | Type |
1025
+ | --------- | ----------------------------------------------- |
1026
+ | `prompt` | [`WhistlePromptOf`](#whistlepromptof)\<`Kind`\> |
1027
+ | `value` | `string` \| `boolean` |
1028
+
1029
+ #### Returns
1030
+
1031
+ \| `Readonly`\<\{ `kind`: `"invalid"`; `cause`: `ZodError`; \}\> \|
1032
+ `Readonly`\<\{ `kind`: `"accepted"`; `value`:
1033
+ [`WhistlePromptAnswers`](#whistlepromptanswers)\[`Kind`\]; \}\>