@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,675 @@
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) / index
8
+
9
+ # index
10
+
11
+ ## Classes
12
+
13
+ ### WhistleActionError
14
+
15
+ An owning handler's explicit failure code and optional structured details.
16
+
17
+ #### Extends
18
+
19
+ - `Error`
20
+
21
+ #### Constructors
22
+
23
+ ##### Constructor
24
+
25
+ ```ts
26
+ new WhistleActionError(
27
+ code,
28
+ message,
29
+ details?
30
+ ): WhistleActionError;
31
+ ```
32
+
33
+ ###### Parameters
34
+
35
+ | Parameter | Type | Description |
36
+ | ---------- | ---------------------------------------------- | ------------------------------------------------------ |
37
+ | `code` | `string` | Stable failure identity supplied by the handler owner. |
38
+ | `message` | `string` | - |
39
+ | `details?` | [`WhistleJsonValue`](wire.md#whistlejsonvalue) | Optional JSON context safe to return to the caller. |
40
+
41
+ ###### Returns
42
+
43
+ [`WhistleActionError`](#whistleactionerror)
44
+
45
+ ###### Overrides
46
+
47
+ ```ts
48
+ Error.constructor;
49
+ ```
50
+
51
+ #### Properties
52
+
53
+ ##### code
54
+
55
+ ```ts
56
+ readonly code: string;
57
+ ```
58
+
59
+ Stable failure identity supplied by the handler owner.
60
+
61
+ ##### details?
62
+
63
+ ```ts
64
+ readonly optional details?: WhistleJsonValue;
65
+ ```
66
+
67
+ Optional JSON context safe to return to the caller.
68
+
69
+ ---
70
+
71
+ ### WhistleClosedError
72
+
73
+ A valid contribution was attempted after the runtime closed.
74
+
75
+ #### Extends
76
+
77
+ - `Error`
78
+
79
+ #### Constructors
80
+
81
+ ##### Constructor
82
+
83
+ ```ts
84
+ new WhistleClosedError(): WhistleClosedError;
85
+ ```
86
+
87
+ Construct the provisional error for a valid post-close contribution.
88
+
89
+ ###### Returns
90
+
91
+ [`WhistleClosedError`](#whistleclosederror)
92
+
93
+ ###### Overrides
94
+
95
+ ```ts
96
+ Error.constructor;
97
+ ```
98
+
99
+ ## Type Aliases
100
+
101
+ ### WhistleExecutionOrigin
102
+
103
+ ```ts
104
+ type WhistleExecutionOrigin =
105
+ | "agent"
106
+ | "browser"
107
+ | "keyboard"
108
+ | "menu"
109
+ | "palette"
110
+ | "programmatic"
111
+ | "slash"
112
+ | "terminal";
113
+ ```
114
+
115
+ The trusted host origin entering the single execution door.
116
+
117
+ ---
118
+
119
+ ### WhistleCommandHandler
120
+
121
+ ```ts
122
+ type WhistleCommandHandler<Arguments, Result> = object["bivarianceHack"];
123
+ ```
124
+
125
+ A source-owned command's execution callback, invoked only through the execution
126
+ door.
127
+
128
+ #### Type Parameters
129
+
130
+ | Type Parameter |
131
+ | -------------- |
132
+ | `Arguments` |
133
+ | `Result` |
134
+
135
+ ---
136
+
137
+ ### WhistlePromptAnswer
138
+
139
+ ```ts
140
+ type WhistlePromptAnswer<Prompt> = WhistlePromptAnswers[Prompt["type"]];
141
+ ```
142
+
143
+ The answer type for one prompt kind.
144
+
145
+ #### Type Parameters
146
+
147
+ | Type Parameter |
148
+ | ----------------------------------------------------------- |
149
+ | `Prompt` _extends_ [`WhistlePrompt`](wire.md#whistleprompt) |
150
+
151
+ ---
152
+
153
+ ### WhistleInteraction
154
+
155
+ ```ts
156
+ type WhistleInteraction = Readonly<{
157
+ signal: AbortSignal;
158
+ prompt: <Kind>(prompt, options?) => Promise<WhistlePromptAnswers[Kind]>;
159
+ notify: (notice) => void;
160
+ }>;
161
+ ```
162
+
163
+ A human conversation attached to one execution. `prompt` rejects when the human
164
+ cancels; `signal` aborts when the whole interaction is dismissed.
165
+
166
+ ---
167
+
168
+ ### WhistleInteractionEnd
169
+
170
+ ```ts
171
+ type WhistleInteractionEnd =
172
+ | Readonly<{
173
+ status: "handled";
174
+ }>
175
+ | Readonly<{
176
+ status: "cancelled";
177
+ }>
178
+ | Readonly<{
179
+ status: "failed";
180
+ message: string;
181
+ }>;
182
+ ```
183
+
184
+ How an execution with an attached interaction ended.
185
+
186
+ ---
187
+
188
+ ### WhistleInteractionSession
189
+
190
+ ```ts
191
+ type WhistleInteractionSession = Readonly<{
192
+ interaction: WhistleInteraction;
193
+ settle: (end) => void;
194
+ }>;
195
+ ```
196
+
197
+ One interaction a presenter opened for one execution.
198
+
199
+ ---
200
+
201
+ ### WhistlePresenter
202
+
203
+ ```ts
204
+ type WhistlePresenter = (request) => WhistleInteractionSession;
205
+ ```
206
+
207
+ A mounted client that can render interactions. Whistle opens one session per
208
+ human execution that has no caller-supplied interaction.
209
+
210
+ #### Parameters
211
+
212
+ | Parameter | Type |
213
+ | --------- | ------------------------------------------------------------------------------------ |
214
+ | `request` | `Readonly`\<\{ `commandId`: `string`; `title`: `string`; `retry`: () => `void`; \}\> |
215
+
216
+ #### Returns
217
+
218
+ [`WhistleInteractionSession`](#whistleinteractionsession)
219
+
220
+ ---
221
+
222
+ ### WhistleExecutionInput
223
+
224
+ ```ts
225
+ type WhistleExecutionInput<Arguments> = Readonly<{
226
+ origin: WhistleExecutionOrigin;
227
+ arguments?: Arguments;
228
+ signal?: AbortSignal;
229
+ interaction?: WhistleInteraction;
230
+ }>;
231
+ ```
232
+
233
+ The already-typed input supplied to a command handler.
234
+
235
+ #### Type Parameters
236
+
237
+ | Type Parameter | Default type |
238
+ | -------------- | ------------ |
239
+ | `Arguments` | `unknown` |
240
+
241
+ ---
242
+
243
+ ### WhistleExecutionOutcome
244
+
245
+ ```ts
246
+ type WhistleExecutionOutcome<Result> =
247
+ | Extract<
248
+ WhistleAvailability,
249
+ {
250
+ status: "unavailable";
251
+ }
252
+ >
253
+ | Readonly<{
254
+ status: "handled";
255
+ result?: Result;
256
+ }>
257
+ | Readonly<{
258
+ status: "closed";
259
+ }>
260
+ | Readonly<{
261
+ status: "missing";
262
+ }>
263
+ | Readonly<{
264
+ status: "invalid";
265
+ }>
266
+ | Readonly<{
267
+ error: WhistleFailure;
268
+ status: "failed";
269
+ }>;
270
+ ```
271
+
272
+ The normalized result of one command execution request.
273
+
274
+ #### Type Parameters
275
+
276
+ | Type Parameter | Default type |
277
+ | -------------- | ------------ |
278
+ | `Result` | `unknown` |
279
+
280
+ ---
281
+
282
+ ### WhistleCommand
283
+
284
+ ```ts
285
+ type WhistleCommand<Arguments, Result> = Readonly<{
286
+ id: string;
287
+ title: string;
288
+ category: string;
289
+ description?: string;
290
+ projections?: WhistleCommandProjections;
291
+ action?: WhistleAction;
292
+ availability?: () => WhistleAvailability;
293
+ handler: WhistleCommandHandler<Arguments, Result>;
294
+ }>;
295
+ ```
296
+
297
+ One semantic command definition.
298
+
299
+ #### Type Parameters
300
+
301
+ | Type Parameter | Default type |
302
+ | -------------- | ------------ |
303
+ | `Arguments` | `unknown` |
304
+ | `Result` | `unknown` |
305
+
306
+ ---
307
+
308
+ ### WhistleContribution
309
+
310
+ ```ts
311
+ type WhistleContribution = Readonly<{
312
+ sourceId: string;
313
+ namespace: string;
314
+ scope?: string;
315
+ commands: readonly WhistleCommand<never>[];
316
+ }>;
317
+ ```
318
+
319
+ One contribution of source-owned commands to a namespace.
320
+
321
+ ---
322
+
323
+ ### WhistleProjectionRow
324
+
325
+ ```ts
326
+ type WhistleProjectionRow = Readonly<{
327
+ commandId: string;
328
+ sourceId: string;
329
+ scope?: string;
330
+ title: string;
331
+ category: string;
332
+ description?: string;
333
+ order: number;
334
+ action?: WhistleAction;
335
+ availability: WhistleAvailability;
336
+ }>;
337
+ ```
338
+
339
+ Shared immutable metadata carried by each projection row.
340
+
341
+ ---
342
+
343
+ ### WhistleAgentProjection
344
+
345
+ ```ts
346
+ type WhistleAgentProjection = Omit<WhistleProjectionRow, "action"> &
347
+ Readonly<{
348
+ action?: Pick<WhistleAction, "inputSchema" | "outputSchema">;
349
+ keybind?: string;
350
+ }>;
351
+ ```
352
+
353
+ Immutable agent snapshot row composed from the schema-owned action data.
354
+
355
+ ---
356
+
357
+ ### WhistleBindingProjection
358
+
359
+ ```ts
360
+ type WhistleBindingProjection = WhistleProjectionRow &
361
+ Readonly<{
362
+ binding: string;
363
+ }>;
364
+ ```
365
+
366
+ One binding value projected from a command.
367
+
368
+ ---
369
+
370
+ ### WhistlePaletteProjection
371
+
372
+ ```ts
373
+ type WhistlePaletteProjection = WhistleProjectionRow;
374
+ ```
375
+
376
+ One palette value projected from a command.
377
+
378
+ ---
379
+
380
+ ### WhistleSlashProjection
381
+
382
+ ```ts
383
+ type WhistleSlashProjection = WhistleProjectionRow &
384
+ Readonly<{
385
+ alias: string;
386
+ arguments?: WhistleSlashArguments;
387
+ }>;
388
+ ```
389
+
390
+ One slash alias projected from a command.
391
+
392
+ ---
393
+
394
+ ### WhistleHelpProjection
395
+
396
+ ```ts
397
+ type WhistleHelpProjection = WhistleProjectionRow;
398
+ ```
399
+
400
+ One help value projected from a command.
401
+
402
+ ---
403
+
404
+ ### WhistleMenuProjection
405
+
406
+ ```ts
407
+ type WhistleMenuProjection = WhistleProjectionRow;
408
+ ```
409
+
410
+ One menu value projected from a command.
411
+
412
+ ---
413
+
414
+ ### WhistleSnapshot
415
+
416
+ ```ts
417
+ type WhistleSnapshot = Readonly<{
418
+ bindings: readonly WhistleBindingProjection[];
419
+ palette: readonly WhistlePaletteProjection[];
420
+ slash: readonly WhistleSlashProjection[];
421
+ help: readonly WhistleHelpProjection[];
422
+ menu: readonly WhistleMenuProjection[];
423
+ agent: readonly WhistleAgentProjection[];
424
+ }>;
425
+ ```
426
+
427
+ The six immutable views of one semantic command graph.
428
+
429
+ ---
430
+
431
+ ### WhistleContributionLease
432
+
433
+ ```ts
434
+ type WhistleContributionLease = Readonly<{
435
+ update: (commands) => void;
436
+ dispose: () => void;
437
+ }>;
438
+ ```
439
+
440
+ An idempotent lease for one contribution generation.
441
+
442
+ ---
443
+
444
+ ### WhistleRuntime
445
+
446
+ ```ts
447
+ type WhistleRuntime = Readonly<{
448
+ contribute: (contribution) => WhistleContributionLease;
449
+ close: () => undefined;
450
+ execute: (commandId, input) => Promise<WhistleExecutionOutcome>;
451
+ snapshot: () => WhistleSnapshot;
452
+ subscribe: (listener) => () => void;
453
+ present: (presenter) => () => void;
454
+ }>;
455
+ ```
456
+
457
+ The provisional Whistle semantic runtime seam.
458
+
459
+ ---
460
+
461
+ ### WhistleKeymapAdapter
462
+
463
+ ```ts
464
+ type WhistleKeymapAdapter = Readonly<{
465
+ cleanup: () => void;
466
+ }>;
467
+ ```
468
+
469
+ Lifecycle operations for a projection into a maintained host keymap.
470
+
471
+ ---
472
+
473
+ ### WhistleKeymapBinding
474
+
475
+ ```ts
476
+ type WhistleKeymapBinding = Readonly<{
477
+ cmd: string;
478
+ key: string;
479
+ }>;
480
+ ```
481
+
482
+ One physical key string mapped to a Whistle command identifier.
483
+
484
+ ---
485
+
486
+ ### WhistleKeymapCommand
487
+
488
+ ```ts
489
+ type WhistleKeymapCommand = Readonly<{
490
+ name: string;
491
+ run: () => Promise<boolean>;
492
+ }>;
493
+ ```
494
+
495
+ Host callback that executes one semantic Whistle command.
496
+
497
+ ---
498
+
499
+ ### WhistleKeymapLayer
500
+
501
+ ```ts
502
+ type WhistleKeymapLayer = Readonly<{
503
+ bindings: readonly WhistleKeymapBinding[];
504
+ commands: readonly WhistleKeymapCommand[];
505
+ }>;
506
+ ```
507
+
508
+ Binding and command records accepted by a maintained keymap host.
509
+
510
+ ---
511
+
512
+ ### WhistleKeymapHost
513
+
514
+ ```ts
515
+ type WhistleKeymapHost = Readonly<{
516
+ registerLayer: (layer) => () => void;
517
+ }>;
518
+ ```
519
+
520
+ Minimal registration surface implemented by a maintained host keymap.
521
+
522
+ ## Functions
523
+
524
+ ### scopeSnapshot()
525
+
526
+ ```ts
527
+ function scopeSnapshot(snapshot, scope): WhistleSnapshot;
528
+ ```
529
+
530
+ The projection for one focused scope: global rows plus the focused scope's rows.
531
+ A focused slash alias or binding shadows the same global one. Agent rows follow
532
+ the same scope filter; the complete runtime remains whole.
533
+
534
+ #### Parameters
535
+
536
+ | Parameter | Type | Description |
537
+ | ---------- | ------------------------------------- | ------------------------------------------------------------ |
538
+ | `snapshot` | [`WhistleSnapshot`](#whistlesnapshot) | A complete runtime snapshot. |
539
+ | `scope` | `string` \| `null` | The focused scope, or `null` when nothing scoped is focused. |
540
+
541
+ #### Returns
542
+
543
+ [`WhistleSnapshot`](#whistlesnapshot)
544
+
545
+ A frozen snapshot of globals plus the selected scope.
546
+
547
+ ---
548
+
549
+ ### createWhistle()
550
+
551
+ ```ts
552
+ function createWhistle(): WhistleRuntime;
553
+ ```
554
+
555
+ Construct the provisional semantic runtime shell.
556
+
557
+ #### Returns
558
+
559
+ [`WhistleRuntime`](#whistleruntime)
560
+
561
+ ---
562
+
563
+ ### createWhistleKeymapAdapter()
564
+
565
+ ```ts
566
+ function createWhistleKeymapAdapter(
567
+ keymap,
568
+ whistle,
569
+ origin,
570
+ ): WhistleKeymapAdapter;
571
+ ```
572
+
573
+ Project Whistle bindings into a host-created maintained OpenTUI keymap.
574
+
575
+ #### Parameters
576
+
577
+ | Parameter | Type |
578
+ | --------- | ------------------------------------------------------------------------------------------- |
579
+ | `keymap` | [`WhistleKeymapHost`](#whistlekeymaphost) |
580
+ | `whistle` | `Pick`\<[`WhistleRuntime`](#whistleruntime), `"snapshot"` \| `"subscribe"` \| `"execute"`\> |
581
+ | `origin` | [`WhistleExecutionOrigin`](#whistleexecutionorigin) |
582
+
583
+ #### Returns
584
+
585
+ [`WhistleKeymapAdapter`](#whistlekeymapadapter)
586
+
587
+ ## References
588
+
589
+ ### WhistleAction
590
+
591
+ Re-exports [WhistleAction](wire.md#whistleaction)
592
+
593
+ ---
594
+
595
+ ### WhistleActionPresentation
596
+
597
+ Re-exports [WhistleActionPresentation](wire.md#whistleactionpresentation)
598
+
599
+ ---
600
+
601
+ ### WhistleActionSchema
602
+
603
+ Re-exports [WhistleActionSchema](wire.md#whistleactionschema)
604
+
605
+ ---
606
+
607
+ ### WhistleAvailability
608
+
609
+ Re-exports [WhistleAvailability](wire.md#whistleavailability)
610
+
611
+ ---
612
+
613
+ ### WhistleCommandProjections
614
+
615
+ Re-exports [WhistleCommandProjections](wire.md#whistlecommandprojections)
616
+
617
+ ---
618
+
619
+ ### WhistleCommandDefinition
620
+
621
+ Re-exports [WhistleCommandDefinition](wire.md#whistlecommanddefinition)
622
+
623
+ ---
624
+
625
+ ### WhistleFailure
626
+
627
+ Re-exports [WhistleFailure](wire.md#whistlefailure)
628
+
629
+ ---
630
+
631
+ ### WhistleJsonObject
632
+
633
+ Re-exports [WhistleJsonObject](wire.md#whistlejsonobject)
634
+
635
+ ---
636
+
637
+ ### WhistleJsonValue
638
+
639
+ Re-exports [WhistleJsonValue](wire.md#whistlejsonvalue)
640
+
641
+ ---
642
+
643
+ ### WhistleNotice
644
+
645
+ Re-exports [WhistleNotice](wire.md#whistlenotice)
646
+
647
+ ---
648
+
649
+ ### WhistleNoticeLink
650
+
651
+ Re-exports [WhistleNoticeLink](wire.md#whistlenoticelink)
652
+
653
+ ---
654
+
655
+ ### WhistlePrompt
656
+
657
+ Re-exports [WhistlePrompt](wire.md#whistleprompt)
658
+
659
+ ---
660
+
661
+ ### WhistlePromptOption
662
+
663
+ Re-exports [WhistlePromptOption](wire.md#whistlepromptoption)
664
+
665
+ ---
666
+
667
+ ### WhistleSlashArguments
668
+
669
+ Re-exports [WhistleSlashArguments](wire.md#whistleslasharguments)
670
+
671
+ ---
672
+
673
+ ### WhistleSlashWord
674
+
675
+ Re-exports [WhistleSlashWord](wire.md#whistleslashword)