@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.
- package/LICENSE +21 -0
- package/README.md +373 -2
- package/dist/catalog.d.ts +459 -0
- package/dist/catalog.js +147 -0
- package/dist/html.d.ts +14 -0
- package/dist/html.js +11 -0
- package/dist/index.d.ts +253 -0
- package/dist/index.js +694 -0
- package/dist/interaction.d.ts +59 -0
- package/dist/interaction.js +131 -0
- package/dist/keymap.d.ts +34 -0
- package/dist/keymap.js +36 -0
- package/dist/wire.d.ts +380 -0
- package/dist/wire.js +299 -0
- package/docs/api/README.md +17 -0
- package/docs/api/catalog.md +498 -0
- package/docs/api/html.md +45 -0
- package/docs/api/index.md +675 -0
- package/docs/api/interaction.md +124 -0
- package/docs/api/wire.md +1033 -0
- package/package.json +87 -3
|
@@ -0,0 +1,498 @@
|
|
|
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) / catalog
|
|
8
|
+
|
|
9
|
+
# catalog
|
|
10
|
+
|
|
11
|
+
## Type Aliases
|
|
12
|
+
|
|
13
|
+
### WhistleCatalogInvoke
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
type WhistleCatalogInvoke = (
|
|
17
|
+
commandId,
|
|
18
|
+
args,
|
|
19
|
+
signal,
|
|
20
|
+
) => Promise<WhistleJsonValue>;
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Call one advertised command at its backend; resolves to a raw step.
|
|
24
|
+
|
|
25
|
+
#### Parameters
|
|
26
|
+
|
|
27
|
+
| Parameter | Type |
|
|
28
|
+
| ----------- | ------------------------------------------------ |
|
|
29
|
+
| `commandId` | `string` |
|
|
30
|
+
| `args` | [`WhistleJsonObject`](wire.md#whistlejsonobject) |
|
|
31
|
+
| `signal` | `AbortSignal` |
|
|
32
|
+
|
|
33
|
+
#### Returns
|
|
34
|
+
|
|
35
|
+
`Promise`\<[`WhistleJsonValue`](wire.md#whistlejsonvalue)\>
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
### WhistleCatalogV1
|
|
40
|
+
|
|
41
|
+
```ts
|
|
42
|
+
type WhistleCatalogV1 = ReadonlySchemaValue<
|
|
43
|
+
z.output<typeof WhistleCatalogSchema>
|
|
44
|
+
>;
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
An advertised command catalog decoded by the maintained catalog schema.
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
### WhistleCatalogStepV1
|
|
52
|
+
|
|
53
|
+
```ts
|
|
54
|
+
type WhistleCatalogStepV1 = ReadonlySchemaValue<
|
|
55
|
+
z.output<typeof WhistleCatalogStepSchema>
|
|
56
|
+
>;
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
A decoded catalog response step derived from its maintained schema.
|
|
60
|
+
|
|
61
|
+
## Variables
|
|
62
|
+
|
|
63
|
+
### whistleCatalogProtocol
|
|
64
|
+
|
|
65
|
+
```ts
|
|
66
|
+
const whistleCatalogProtocol: "whistle.catalog/v1" = "whistle.catalog/v1";
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
The one catalog protocol this Whistle understands.
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
### WhistleCatalogSchema
|
|
74
|
+
|
|
75
|
+
```ts
|
|
76
|
+
const WhistleCatalogSchema: ZodPipe<ZodObject<{
|
|
77
|
+
protocol: ZodLiteral<"whistle.catalog/v1">;
|
|
78
|
+
commands: ZodArray<ZodObject<{
|
|
79
|
+
id: ZodString;
|
|
80
|
+
title: ZodString;
|
|
81
|
+
category: ZodString;
|
|
82
|
+
description: ZodOptional<ZodString>;
|
|
83
|
+
projections: ZodOptional<ZodObject<{
|
|
84
|
+
bindings: ZodOptional<ZodObject<..., ...>>;
|
|
85
|
+
agent: ZodOptional<ZodObject<..., ...>>;
|
|
86
|
+
help: ZodOptional<ZodObject<..., ...>>;
|
|
87
|
+
menu: ZodOptional<ZodObject<..., ...>>;
|
|
88
|
+
palette: ZodOptional<ZodObject<..., ...>>;
|
|
89
|
+
slash: ZodOptional<ZodObject<..., ...>>;
|
|
90
|
+
}, $strict>>;
|
|
91
|
+
action: ZodOptional<ZodObject<{
|
|
92
|
+
inputSchema: ZodOptional<ZodRecord<..., ...>>;
|
|
93
|
+
outputSchema: ZodOptional<ZodRecord<..., ...>>;
|
|
94
|
+
presentation: ZodOptional<ZodUnion<...>>;
|
|
95
|
+
}, $strict>>;
|
|
96
|
+
availability: ZodOptional<ZodDiscriminatedUnion<[ZodObject<{
|
|
97
|
+
status: ...;
|
|
98
|
+
}, $strict>, ZodObject<{
|
|
99
|
+
status: ...;
|
|
100
|
+
reason: ...;
|
|
101
|
+
}, $strict>], "status">>;
|
|
102
|
+
}, $strict>>;
|
|
103
|
+
}, $strict>, ZodTransform<Readonly<{
|
|
104
|
+
protocol: "whistle.catalog/v1";
|
|
105
|
+
commands: readonly object[];
|
|
106
|
+
}>, {
|
|
107
|
+
protocol: "whistle.catalog/v1";
|
|
108
|
+
commands: object[];
|
|
109
|
+
}>>;
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Validate one complete Whistle catalog and its unique command ids.
|
|
113
|
+
|
|
114
|
+
---
|
|
115
|
+
|
|
116
|
+
### parseCatalog
|
|
117
|
+
|
|
118
|
+
```ts
|
|
119
|
+
const parseCatalog: typeof WhistleCatalogSchema.parse;
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
Parse an advertised catalog at the client boundary.
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
### WhistleCatalogStepSchema
|
|
127
|
+
|
|
128
|
+
```ts
|
|
129
|
+
const WhistleCatalogStepSchema: ZodPipe<ZodDiscriminatedUnion<[ZodObject<{
|
|
130
|
+
type: ZodLiteral<"done">;
|
|
131
|
+
notice: ZodOptional<ZodDiscriminatedUnion<[ZodObject<{
|
|
132
|
+
type: ZodLiteral<...>;
|
|
133
|
+
message: ZodPipe<..., ...>;
|
|
134
|
+
links: ZodOptional<...>;
|
|
135
|
+
}, $strict>, ZodObject<{
|
|
136
|
+
type: ZodLiteral<...>;
|
|
137
|
+
message: ZodPipe<..., ...>;
|
|
138
|
+
}, $strict>, ZodObject<{
|
|
139
|
+
type: ZodLiteral<...>;
|
|
140
|
+
url: ZodURL;
|
|
141
|
+
code: ZodOptional<...>;
|
|
142
|
+
message: ZodOptional<...>;
|
|
143
|
+
}, $strict>, ZodObject<{
|
|
144
|
+
type: ZodLiteral<...>;
|
|
145
|
+
message: ZodPipe<..., ...>;
|
|
146
|
+
}, $strict>], "type">>;
|
|
147
|
+
result: ZodOptional<ZodJSONSchema>;
|
|
148
|
+
}, $strict>, ZodObject<{
|
|
149
|
+
type: ZodLiteral<"prompt">;
|
|
150
|
+
prompt: ZodDiscriminatedUnion<[ZodObject<{
|
|
151
|
+
type: ZodLiteral<"choice">;
|
|
152
|
+
message: ZodPipe<ZodString, ZodString>;
|
|
153
|
+
collapsedGroup: ZodOptional<ZodPipe<..., ...>>;
|
|
154
|
+
options: ZodArray<ZodObject<..., ...>>;
|
|
155
|
+
}, $strict>, ZodObject<{
|
|
156
|
+
type: ZodLiteral<"text">;
|
|
157
|
+
message: ZodPipe<ZodString, ZodString>;
|
|
158
|
+
placeholder: ZodOptional<ZodPipe<..., ...>>;
|
|
159
|
+
secret: ZodOptional<ZodBoolean>;
|
|
160
|
+
}, $strict>, ZodObject<{
|
|
161
|
+
type: ZodLiteral<"confirmation">;
|
|
162
|
+
message: ZodPipe<ZodString, ZodString>;
|
|
163
|
+
confirmLabel: ZodOptional<ZodPipe<..., ...>>;
|
|
164
|
+
cancelLabel: ZodOptional<ZodPipe<..., ...>>;
|
|
165
|
+
}, $strict>], "type">;
|
|
166
|
+
notice: ZodOptional<ZodDiscriminatedUnion<[ZodObject<{
|
|
167
|
+
type: ZodLiteral<...>;
|
|
168
|
+
message: ZodPipe<..., ...>;
|
|
169
|
+
links: ZodOptional<...>;
|
|
170
|
+
}, $strict>, ZodObject<{
|
|
171
|
+
type: ZodLiteral<...>;
|
|
172
|
+
message: ZodPipe<..., ...>;
|
|
173
|
+
}, $strict>, ZodObject<{
|
|
174
|
+
type: ZodLiteral<...>;
|
|
175
|
+
url: ZodURL;
|
|
176
|
+
code: ZodOptional<...>;
|
|
177
|
+
message: ZodOptional<...>;
|
|
178
|
+
}, $strict>, ZodObject<{
|
|
179
|
+
type: ZodLiteral<...>;
|
|
180
|
+
message: ZodPipe<..., ...>;
|
|
181
|
+
}, $strict>], "type">>;
|
|
182
|
+
next: ZodObject<{
|
|
183
|
+
arguments: ZodRecord<ZodString, ZodJSONSchema>;
|
|
184
|
+
answer: ZodString;
|
|
185
|
+
}, $strict>;
|
|
186
|
+
}, $strict>], "type">, ZodTransform<
|
|
187
|
+
| Readonly<{
|
|
188
|
+
type: "done";
|
|
189
|
+
notice?: | {
|
|
190
|
+
type: "info";
|
|
191
|
+
message: string;
|
|
192
|
+
links?: object[];
|
|
193
|
+
}
|
|
194
|
+
| {
|
|
195
|
+
type: "progress";
|
|
196
|
+
message: string;
|
|
197
|
+
}
|
|
198
|
+
| {
|
|
199
|
+
type: "handoff";
|
|
200
|
+
url: string;
|
|
201
|
+
code?: string;
|
|
202
|
+
message?: string;
|
|
203
|
+
}
|
|
204
|
+
| {
|
|
205
|
+
type: "success";
|
|
206
|
+
message: string;
|
|
207
|
+
};
|
|
208
|
+
result?: JSONType;
|
|
209
|
+
}>
|
|
210
|
+
| Readonly<{
|
|
211
|
+
type: "prompt";
|
|
212
|
+
prompt: | {
|
|
213
|
+
type: "choice";
|
|
214
|
+
message: string;
|
|
215
|
+
collapsedGroup?: string;
|
|
216
|
+
options: object[];
|
|
217
|
+
}
|
|
218
|
+
| {
|
|
219
|
+
type: "text";
|
|
220
|
+
message: string;
|
|
221
|
+
placeholder?: string;
|
|
222
|
+
secret?: boolean;
|
|
223
|
+
}
|
|
224
|
+
| {
|
|
225
|
+
type: "confirmation";
|
|
226
|
+
message: string;
|
|
227
|
+
confirmLabel?: string;
|
|
228
|
+
cancelLabel?: string;
|
|
229
|
+
};
|
|
230
|
+
notice?: | {
|
|
231
|
+
type: "info";
|
|
232
|
+
message: string;
|
|
233
|
+
links?: object[];
|
|
234
|
+
}
|
|
235
|
+
| {
|
|
236
|
+
type: "progress";
|
|
237
|
+
message: string;
|
|
238
|
+
}
|
|
239
|
+
| {
|
|
240
|
+
type: "handoff";
|
|
241
|
+
url: string;
|
|
242
|
+
code?: string;
|
|
243
|
+
message?: string;
|
|
244
|
+
}
|
|
245
|
+
| {
|
|
246
|
+
type: "success";
|
|
247
|
+
message: string;
|
|
248
|
+
};
|
|
249
|
+
next: {
|
|
250
|
+
arguments: Record<string, JSONType>;
|
|
251
|
+
answer: string;
|
|
252
|
+
};
|
|
253
|
+
}>,
|
|
254
|
+
| {
|
|
255
|
+
type: "done";
|
|
256
|
+
notice?: | {
|
|
257
|
+
type: "info";
|
|
258
|
+
message: string;
|
|
259
|
+
links?: object[];
|
|
260
|
+
}
|
|
261
|
+
| {
|
|
262
|
+
type: "progress";
|
|
263
|
+
message: string;
|
|
264
|
+
}
|
|
265
|
+
| {
|
|
266
|
+
type: "handoff";
|
|
267
|
+
url: string;
|
|
268
|
+
code?: string;
|
|
269
|
+
message?: string;
|
|
270
|
+
}
|
|
271
|
+
| {
|
|
272
|
+
type: "success";
|
|
273
|
+
message: string;
|
|
274
|
+
};
|
|
275
|
+
result?: JSONType;
|
|
276
|
+
}
|
|
277
|
+
| {
|
|
278
|
+
type: "prompt";
|
|
279
|
+
prompt: | {
|
|
280
|
+
type: "choice";
|
|
281
|
+
message: string;
|
|
282
|
+
collapsedGroup?: string;
|
|
283
|
+
options: object[];
|
|
284
|
+
}
|
|
285
|
+
| {
|
|
286
|
+
type: "text";
|
|
287
|
+
message: string;
|
|
288
|
+
placeholder?: string;
|
|
289
|
+
secret?: boolean;
|
|
290
|
+
}
|
|
291
|
+
| {
|
|
292
|
+
type: "confirmation";
|
|
293
|
+
message: string;
|
|
294
|
+
confirmLabel?: string;
|
|
295
|
+
cancelLabel?: string;
|
|
296
|
+
};
|
|
297
|
+
notice?: | {
|
|
298
|
+
type: "info";
|
|
299
|
+
message: string;
|
|
300
|
+
links?: object[];
|
|
301
|
+
}
|
|
302
|
+
| {
|
|
303
|
+
type: "progress";
|
|
304
|
+
message: string;
|
|
305
|
+
}
|
|
306
|
+
| {
|
|
307
|
+
type: "handoff";
|
|
308
|
+
url: string;
|
|
309
|
+
code?: string;
|
|
310
|
+
message?: string;
|
|
311
|
+
}
|
|
312
|
+
| {
|
|
313
|
+
type: "success";
|
|
314
|
+
message: string;
|
|
315
|
+
};
|
|
316
|
+
next: {
|
|
317
|
+
arguments: Record<string, JSONType>;
|
|
318
|
+
answer: string;
|
|
319
|
+
};
|
|
320
|
+
}>>;
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
Validate one response step before it reaches an interaction renderer.
|
|
324
|
+
|
|
325
|
+
---
|
|
326
|
+
|
|
327
|
+
### parseCatalogStep
|
|
328
|
+
|
|
329
|
+
```ts
|
|
330
|
+
const parseCatalogStep: typeof WhistleCatalogStepSchema.parse;
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
Parse one backend reply before any of it reaches a renderer.
|
|
334
|
+
|
|
335
|
+
## Functions
|
|
336
|
+
|
|
337
|
+
### catalogCommands()
|
|
338
|
+
|
|
339
|
+
```ts
|
|
340
|
+
function catalogCommands(catalog, invoke): readonly Readonly<{
|
|
341
|
+
id: string;
|
|
342
|
+
title: string;
|
|
343
|
+
category: string;
|
|
344
|
+
description?: string;
|
|
345
|
+
projections?: {
|
|
346
|
+
bindings?: {
|
|
347
|
+
order?: number;
|
|
348
|
+
values: readonly string[];
|
|
349
|
+
};
|
|
350
|
+
agent?: {
|
|
351
|
+
keybind?: string;
|
|
352
|
+
order?: number;
|
|
353
|
+
};
|
|
354
|
+
help?: {
|
|
355
|
+
order?: number;
|
|
356
|
+
};
|
|
357
|
+
menu?: {
|
|
358
|
+
order?: number;
|
|
359
|
+
};
|
|
360
|
+
palette?: {
|
|
361
|
+
order?: number;
|
|
362
|
+
};
|
|
363
|
+
slash?: {
|
|
364
|
+
aliases: readonly string[];
|
|
365
|
+
order?: number;
|
|
366
|
+
arguments?: {
|
|
367
|
+
hint: string;
|
|
368
|
+
words?: readonly ...[];
|
|
369
|
+
text?: {
|
|
370
|
+
field: ...;
|
|
371
|
+
arguments: ...;
|
|
372
|
+
requestIdField?: ...;
|
|
373
|
+
};
|
|
374
|
+
};
|
|
375
|
+
};
|
|
376
|
+
};
|
|
377
|
+
action?: {
|
|
378
|
+
inputSchema?: {
|
|
379
|
+
[key: string]:
|
|
380
|
+
| string
|
|
381
|
+
| number
|
|
382
|
+
| boolean
|
|
383
|
+
| readonly string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | ... 4 more ... | null)[] | { ...; } | null)[] | { ...; } | null)[] | { ...; } | ...[]
|
|
384
|
+
| {
|
|
385
|
+
[key: string]: string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | ... 4 more ... | null)[] | { ...; } | null)[] | { ...; } | null)[] | { ...; } | ...;
|
|
386
|
+
}
|
|
387
|
+
| null;
|
|
388
|
+
};
|
|
389
|
+
outputSchema?: {
|
|
390
|
+
[key: string]:
|
|
391
|
+
| string
|
|
392
|
+
| number
|
|
393
|
+
| boolean
|
|
394
|
+
| readonly string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | ... 4 more ... | null)[] | { ...; } | null)[] | { ...; } | null)[] | { ...; } | ...[]
|
|
395
|
+
| {
|
|
396
|
+
[key: string]: string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | ... 4 more ... | null)[] | { ...; } | null)[] | { ...; } | null)[] | { ...; } | ...;
|
|
397
|
+
}
|
|
398
|
+
| null;
|
|
399
|
+
};
|
|
400
|
+
presentation?: | {
|
|
401
|
+
type: "action";
|
|
402
|
+
}
|
|
403
|
+
| {
|
|
404
|
+
type: "custom";
|
|
405
|
+
data: {
|
|
406
|
+
[key: string]:
|
|
407
|
+
| string
|
|
408
|
+
| number
|
|
409
|
+
| boolean
|
|
410
|
+
| readonly string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | ... 4 more ... | null)[] | { ...; } | null)[] | { ...; } | null)[] | { ...; } | ...[]
|
|
411
|
+
| {
|
|
412
|
+
[key: string]: string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | ... 4 more ... | null)[] | { ...; } | null)[] | { ...; } | null)[] | { ...; } | ...;
|
|
413
|
+
}
|
|
414
|
+
| null;
|
|
415
|
+
};
|
|
416
|
+
}
|
|
417
|
+
| {
|
|
418
|
+
type: "choice";
|
|
419
|
+
options: readonly object[];
|
|
420
|
+
}
|
|
421
|
+
| {
|
|
422
|
+
type: "form";
|
|
423
|
+
submitLabel?: string;
|
|
424
|
+
}
|
|
425
|
+
| {
|
|
426
|
+
type: "confirmation";
|
|
427
|
+
message: string;
|
|
428
|
+
confirmLabel?: string;
|
|
429
|
+
cancelLabel?: string;
|
|
430
|
+
};
|
|
431
|
+
};
|
|
432
|
+
availability?: () => WhistleAvailability;
|
|
433
|
+
handler: (input) => unknown;
|
|
434
|
+
}>[];
|
|
435
|
+
```
|
|
436
|
+
|
|
437
|
+
Turn an advertised catalog into Whistle commands. Each handler runs the
|
|
438
|
+
backend's step conversation through the caller's interaction; an Agent, which
|
|
439
|
+
has no interaction, can run only commands that finish in one step.
|
|
440
|
+
|
|
441
|
+
#### Parameters
|
|
442
|
+
|
|
443
|
+
| Parameter | Type |
|
|
444
|
+
| ------------------ | -------------------------------------------------------------------------- |
|
|
445
|
+
| `catalog` | \{ `protocol`: `"whistle.catalog/v1"`; `commands`: readonly `object`[]; \} |
|
|
446
|
+
| `catalog.protocol` | `"whistle.catalog/v1"` |
|
|
447
|
+
| `catalog.commands` | readonly `object`[] |
|
|
448
|
+
| `invoke` | [`WhistleCatalogInvoke`](#whistlecataloginvoke) |
|
|
449
|
+
|
|
450
|
+
#### Returns
|
|
451
|
+
|
|
452
|
+
readonly `Readonly`\<\{ `id`: `string`; `title`: `string`; `category`: `string`;
|
|
453
|
+
`description?`: `string`; `projections?`: \{ `bindings?`: \{ `order?`: `number`;
|
|
454
|
+
`values`: readonly `string`[]; \}; `agent?`: \{ `keybind?`: `string`; `order?`:
|
|
455
|
+
`number`; \}; `help?`: \{ `order?`: `number`; \}; `menu?`: \{ `order?`:
|
|
456
|
+
`number`; \}; `palette?`: \{ `order?`: `number`; \}; `slash?`: \{ `aliases`:
|
|
457
|
+
readonly `string`[]; `order?`: `number`; `arguments?`: \{ `hint`: `string`;
|
|
458
|
+
`words?`: readonly ...[]; `text?`: \{ `field`: ...; `arguments`: ...;
|
|
459
|
+
`requestIdField?`: ...; \}; \}; \}; \}; `action?`: \{ `inputSchema?`: \{
|
|
460
|
+
\[`key`: `string`\]: \| `string` \| `number` \| `boolean` \| readonly string \|
|
|
461
|
+
number \| boolean \| readonly (string \| number \| boolean \| readonly (string
|
|
462
|
+
\| number \| boolean \| readonly (string \| number \| boolean \| readonly
|
|
463
|
+
(string \| number \| boolean \| readonly (string \| number \| boolean \|
|
|
464
|
+
readonly (string \| ... 4 more ... \| null)\[\] \| \{ ...; \} \| null)\[\] \| \{
|
|
465
|
+
...; \} \| null)\[\] \| \{ ...; \} \| ...[] \| \{ \[`key`: `string`\]: string \|
|
|
466
|
+
number \| boolean \| readonly (string \| number \| boolean \| readonly (string
|
|
467
|
+
\| number \| boolean \| readonly (string \| number \| boolean \| readonly
|
|
468
|
+
(string \| number \| boolean \| readonly (string \| number \| boolean \|
|
|
469
|
+
readonly (string \| ... 4 more ... \| null)\[\] \| \{ ...; \} \| null)\[\] \| \{
|
|
470
|
+
...; \} \| null)\[\] \| \{ ...; \} \| ...; \} \| `null`; \}; `outputSchema?`: \{
|
|
471
|
+
\[`key`: `string`\]: \| `string` \| `number` \| `boolean` \| readonly string \|
|
|
472
|
+
number \| boolean \| readonly (string \| number \| boolean \| readonly (string
|
|
473
|
+
\| number \| boolean \| readonly (string \| number \| boolean \| readonly
|
|
474
|
+
(string \| number \| boolean \| readonly (string \| number \| boolean \|
|
|
475
|
+
readonly (string \| ... 4 more ... \| null)\[\] \| \{ ...; \} \| null)\[\] \| \{
|
|
476
|
+
...; \} \| null)\[\] \| \{ ...; \} \| ...[] \| \{ \[`key`: `string`\]: string \|
|
|
477
|
+
number \| boolean \| readonly (string \| number \| boolean \| readonly (string
|
|
478
|
+
\| number \| boolean \| readonly (string \| number \| boolean \| readonly
|
|
479
|
+
(string \| number \| boolean \| readonly (string \| number \| boolean \|
|
|
480
|
+
readonly (string \| ... 4 more ... \| null)\[\] \| \{ ...; \} \| null)\[\] \| \{
|
|
481
|
+
...; \} \| null)\[\] \| \{ ...; \} \| ...; \} \| `null`; \}; `presentation?`: \|
|
|
482
|
+
\{ `type`: `"action"`; \} \| \{ `type`: `"custom"`; `data`: \{ \[`key`:
|
|
483
|
+
`string`\]: \| `string` \| `number` \| `boolean` \| readonly string \| number \|
|
|
484
|
+
boolean \| readonly (string \| number \| boolean \| readonly (string \| number
|
|
485
|
+
\| boolean \| readonly (string \| number \| boolean \| readonly (string \|
|
|
486
|
+
number \| boolean \| readonly (string \| number \| boolean \| readonly (string
|
|
487
|
+
\| ... 4 more ... \| null)\[\] \| \{ ...; \} \| null)\[\] \| \{ ...; \} \|
|
|
488
|
+
null)\[\] \| \{ ...; \} \| ...[] \| \{ \[`key`: `string`\]: string \| number \|
|
|
489
|
+
boolean \| readonly (string \| number \| boolean \| readonly (string \| number
|
|
490
|
+
\| boolean \| readonly (string \| number \| boolean \| readonly (string \|
|
|
491
|
+
number \| boolean \| readonly (string \| number \| boolean \| readonly (string
|
|
492
|
+
\| ... 4 more ... \| null)\[\] \| \{ ...; \} \| null)\[\] \| \{ ...; \} \|
|
|
493
|
+
null)\[\] \| \{ ...; \} \| ...; \} \| `null`; \}; \} \| \{ `type`: `"choice"`;
|
|
494
|
+
`options`: readonly `object`[]; \} \| \{ `type`: `"form"`; `submitLabel?`:
|
|
495
|
+
`string`; \} \| \{ `type`: `"confirmation"`; `message`: `string`;
|
|
496
|
+
`confirmLabel?`: `string`; `cancelLabel?`: `string`; \}; \}; `availability?`: ()
|
|
497
|
+
=> [`WhistleAvailability`](wire.md#whistleavailability); `handler`: (`input`) =>
|
|
498
|
+
`unknown`; \}\>[]
|
package/docs/api/html.md
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
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) / html
|
|
8
|
+
|
|
9
|
+
# html
|
|
10
|
+
|
|
11
|
+
## Type Aliases
|
|
12
|
+
|
|
13
|
+
### HtmlWhistleBinding
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
type HtmlWhistleBinding = Readonly<{
|
|
17
|
+
keymap: ReturnType<typeof createDefaultHtmlKeymap>;
|
|
18
|
+
dispose: () => void;
|
|
19
|
+
}>;
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Maintained document keymap plus disposable Whistle command projection.
|
|
23
|
+
|
|
24
|
+
## Functions
|
|
25
|
+
|
|
26
|
+
### bindHtmlKeymap()
|
|
27
|
+
|
|
28
|
+
```ts
|
|
29
|
+
function bindHtmlKeymap(root, whistle, origin): HtmlWhistleBinding;
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Bind Whistle commands to the maintained OpenTUI HTML keymap. The root owns the
|
|
33
|
+
host's document lifetime; dispose removes the command projection only.
|
|
34
|
+
|
|
35
|
+
#### Parameters
|
|
36
|
+
|
|
37
|
+
| Parameter | Type |
|
|
38
|
+
| --------- | --------------------------------------------------------------------------------------------------- |
|
|
39
|
+
| `root` | `HTMLElement` |
|
|
40
|
+
| `whistle` | `Pick`\<[`WhistleRuntime`](index.md#whistleruntime), `"snapshot"` \| `"subscribe"` \| `"execute"`\> |
|
|
41
|
+
| `origin` | [`WhistleExecutionOrigin`](index.md#whistleexecutionorigin) |
|
|
42
|
+
|
|
43
|
+
#### Returns
|
|
44
|
+
|
|
45
|
+
[`HtmlWhistleBinding`](#htmlwhistlebinding)
|