@yaks/host 0.0.0-stage → 0.2.36

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.
Files changed (69) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +306 -2
  3. package/_dist/anatomy.d.ts +35 -0
  4. package/_dist/anatomy.d.ts.map +1 -0
  5. package/_dist/assembly.d.ts +94 -0
  6. package/_dist/assembly.d.ts.map +1 -0
  7. package/_dist/config.d.ts +150 -0
  8. package/_dist/config.d.ts.map +1 -0
  9. package/_dist/documents.d.ts +9 -0
  10. package/_dist/documents.d.ts.map +1 -0
  11. package/_dist/facets.d.ts +164 -0
  12. package/_dist/facets.d.ts.map +1 -0
  13. package/_dist/keepers.d.ts +15 -0
  14. package/_dist/keepers.d.ts.map +1 -0
  15. package/_dist/keywords.d.ts +3 -0
  16. package/_dist/keywords.d.ts.map +1 -0
  17. package/_dist/lending.d.ts +34 -0
  18. package/_dist/lending.d.ts.map +1 -0
  19. package/_dist/mod.d.ts +260 -0
  20. package/_dist/mod.d.ts.map +1 -0
  21. package/_dist/payments.d.ts +501 -0
  22. package/_dist/payments.d.ts.map +1 -0
  23. package/_dist/roles.d.ts +10 -0
  24. package/_dist/roles.d.ts.map +1 -0
  25. package/_dist/senders.d.ts +180 -0
  26. package/_dist/senders.d.ts.map +1 -0
  27. package/_dist/words.d.ts +27 -0
  28. package/_dist/words.d.ts.map +1 -0
  29. package/anatomy.js +432 -0
  30. package/anatomy.js.map +1 -0
  31. package/anatomy.ts +439 -0
  32. package/assembly.js +737 -0
  33. package/assembly.js.map +1 -0
  34. package/assembly.ts +930 -0
  35. package/config.js +149 -0
  36. package/config.js.map +1 -0
  37. package/config.ts +287 -0
  38. package/deno.json +1 -0
  39. package/documents.js +80 -0
  40. package/documents.js.map +1 -0
  41. package/documents.ts +105 -0
  42. package/facets.js +2 -0
  43. package/facets.js.map +1 -0
  44. package/facets.ts +236 -0
  45. package/keepers.js +7 -0
  46. package/keepers.js.map +1 -0
  47. package/keepers.ts +17 -0
  48. package/keywords.js +24 -0
  49. package/keywords.js.map +1 -0
  50. package/keywords.ts +25 -0
  51. package/lending.js +46 -0
  52. package/lending.js.map +1 -0
  53. package/lending.ts +77 -0
  54. package/mod.js +5 -0
  55. package/mod.js.map +1 -0
  56. package/mod.ts +356 -0
  57. package/package.json +79 -4
  58. package/payments.js +66 -0
  59. package/payments.js.map +1 -0
  60. package/payments.ts +665 -0
  61. package/roles.js +22 -0
  62. package/roles.js.map +1 -0
  63. package/roles.ts +18 -0
  64. package/senders.js +58 -0
  65. package/senders.js.map +1 -0
  66. package/senders.ts +272 -0
  67. package/words.js +134 -0
  68. package/words.js.map +1 -0
  69. package/words.ts +210 -0
package/roles.ts ADDED
@@ -0,0 +1,18 @@
1
+ // The facets selected by each common role; a plugin's service is its own role.
2
+ import type { Config } from './config.js'
3
+ import { facetsOf, used } from './config.js'
4
+ import type { Role } from './mod.ts'
5
+ export let ROLES = {
6
+ graph: ['vocab', 'graph', 'tools'],
7
+ web: ['routes', 'ui'],
8
+ effects: ['effects'],
9
+ } as const
10
+ /** Common roles, followed by each configured plugin's service role. */
11
+ export let every = (config: Config): Role[] => [
12
+ ...Object.keys(ROLES),
13
+ ...(config.plugins ?? []).filter((p) =>
14
+ facetsOf(p)?.includes('service') ?? true
15
+ ).map(used),
16
+ ]
17
+ export let common = (role: Role): role is keyof typeof ROLES =>
18
+ Object.hasOwn(ROLES, role)
package/senders.js ADDED
@@ -0,0 +1,58 @@
1
+ /** The portable mail sender capability: a composed message and its receipt.
2
+ * Hosts own sender construction, credentials, metering and lifetime. */ /** One message, composed and ready to leave. */ /** A {@link Sender} built again from `build` at every use, so options read
3
+ * then, such as a secret set after start-up, take effect at once. Until it
4
+ * builds, it is {@link Sender.waiting} and a letter handed to it is
5
+ * {@link Unsent}.
6
+ *
7
+ * ```ts
8
+ * import { afresh } from '@yaks/host/senders'
9
+ * import { equal } from '@yaks/testing'
10
+ *
11
+ * let options: { token?: string } = {}
12
+ * let sender = afresh(() =>
13
+ * options.token
14
+ * ? { sender: { send: () => Promise.resolve({ id: options.token }) } }
15
+ * : { waiting: 'waiting for a token' }
16
+ * )
17
+ * equal(sender.waiting?.(), 'waiting for a token')
18
+ * options.token = 't'
19
+ * equal(sender.waiting?.(), undefined)
20
+ * ```
21
+ */ export let afresh = (build)=>({
22
+ send: (message)=>{
23
+ let { sender, waiting } = build();
24
+ return sender ? sender.send(message) : Promise.reject(new Unsent(waiting ?? 'waiting for a sender', 60_000));
25
+ },
26
+ waiting: ()=>build().waiting
27
+ });
28
+ /** A rejection that knows the message never left: the connection was never
29
+ * made, or the provider refused to take it yet. Sending is at most once, so
30
+ * only this rejection lets a letter be handed over again, no sooner than
31
+ * `retry.after` milliseconds; any other rejection is a bounce. */ export class Unsent extends Error {
32
+ retry;
33
+ constructor(message, after = 1000){
34
+ super(message);
35
+ this.name = 'Unsent';
36
+ this.retry = {
37
+ after
38
+ };
39
+ }
40
+ }
41
+ /** A rejection that knows the letter as written can never go: its provider
42
+ * refused an address on it, such as one at a domain that takes no mail. The
43
+ * letter bounces with this message as its reason, and that bounce is the
44
+ * letter's outcome, answered on the letter: the writer's input, not a failure
45
+ * of the sender. Any other rejection that is not {@link Unsent} is both. */ export class Undeliverable extends Error {
46
+ constructor(message){
47
+ super(message);
48
+ this.name = 'Undeliverable';
49
+ }
50
+ }
51
+ /** A request that does not carry its provider's signature: the caller is
52
+ * refused, never retried. */ export class Unsigned extends Error {
53
+ constructor(message){
54
+ super(message);
55
+ this.name = 'Unsigned';
56
+ }
57
+ }
58
+ //# sourceMappingURL=senders.js.map
package/senders.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"senders.js","sources":["./senders.ts"],"names":[],"mappings":"AAAA;sEACsE,GAEtE,8CAA8C,GA6C9C;;;;;;;;;;;;;;;;;;;CAmBC,GACD,OAAO,IAAI,SAAS,CAAC,QAA+B,CAAC;IACnD,MAAM,CAAC;MACL,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG;MAC1B,OAAO,SACH,OAAO,IAAI,CAAC,WACZ,QAAQ,MAAM,CAAC,IAAI,OAAO,WAAW,wBAAwB;IACnE;IACA,SAAS,IAAM,QAAQ,OAAO;EAChC,CAAC,EAAC;AA8EF;;;gEAGgE,GAChE,OAAO,MAAM,eAAe;EAC1B,MAAwB;EACxB,YAAY,OAAe,EAAE,QAAQ,IAAI,CAAE;IACzC,KAAK,CAAC;IACN,IAAI,CAAC,IAAI,GAAG;IACZ,IAAI,CAAC,KAAK,GAAG;MAAE;IAAM;EACvB;AACF;AAEA;;;;0EAI0E,GAC1E,OAAO,MAAM,sBAAsB;EACjC,YAAY,OAAe,CAAE;IAC3B,KAAK,CAAC;IACN,IAAI,CAAC,IAAI,GAAG;EACd;AACF;AAiDA;2BAC2B,GAC3B,OAAO,MAAM,iBAAiB;EAC5B,YAAY,OAAe,CAAE;IAC3B,KAAK,CAAC;IACN,IAAI,CAAC,IAAI,GAAG;EACd;AACF"}
package/senders.ts ADDED
@@ -0,0 +1,272 @@
1
+ /** The portable mail sender capability: a composed message and its receipt.
2
+ * Hosts own sender construction, credentials, metering and lifetime. */
3
+
4
+ /** One message, composed and ready to leave. */
5
+ export type Message = {
6
+ /** the caller's letter UUID, for asynchronous delivery receipts */
7
+ id?: string
8
+ /** the address it is from */
9
+ from: string
10
+ /** a connection the host selected for this letter */
11
+ connection?: string
12
+ /** the name it is from, as the reader's mail shows it beside the address */
13
+ name?: string
14
+ /** the address it is going to */
15
+ to: string | string[]
16
+ /** the address copied on it, who sees it and its replies */
17
+ cc?: string
18
+ /** the subject line */
19
+ subject: string
20
+ /** the body as plain text */
21
+ text: string
22
+ /** the same body as HTML */
23
+ html: string
24
+ /** the Message-ID it answers, unbracketed, when it answers one */
25
+ replyTo?: string
26
+ /** the address replies go to, when different from the sender */
27
+ replyAddress?: string
28
+ }
29
+
30
+ /** What a sender reports about a message it accepted. */
31
+ export type Receipt = {
32
+ /** the Message-ID the sender gave the letter, unbracketed, if any */
33
+ id?: string
34
+ }
35
+
36
+ /** A sender resolves when the message is away and rejects when it is not.
37
+ * The rejection's message is what lands in `bounced.reason`, unless it is
38
+ * {@link Unsent}: then the letter is tried again. */
39
+ export type Sender = {
40
+ send: (message: Message) => Promise<Receipt>
41
+ /** Why it cannot send yet, such as a credential not set; asked before each
42
+ * letter, so the letter waits instead. Absent or empty, it can send. */
43
+ waiting?: () => string | undefined
44
+ }
45
+
46
+ /** A sender, or why one cannot be built from its options yet. */
47
+ export type Built = { sender?: Sender; waiting?: string }
48
+
49
+ /** A {@link Sender} built again from `build` at every use, so options read
50
+ * then, such as a secret set after start-up, take effect at once. Until it
51
+ * builds, it is {@link Sender.waiting} and a letter handed to it is
52
+ * {@link Unsent}.
53
+ *
54
+ * ```ts
55
+ * import { afresh } from '@yaks/host/senders'
56
+ * import { equal } from '@yaks/testing'
57
+ *
58
+ * let options: { token?: string } = {}
59
+ * let sender = afresh(() =>
60
+ * options.token
61
+ * ? { sender: { send: () => Promise.resolve({ id: options.token }) } }
62
+ * : { waiting: 'waiting for a token' }
63
+ * )
64
+ * equal(sender.waiting?.(), 'waiting for a token')
65
+ * options.token = 't'
66
+ * equal(sender.waiting?.(), undefined)
67
+ * ```
68
+ */
69
+ export let afresh = (build: () => Built): Sender => ({
70
+ send: (message) => {
71
+ let { sender, waiting } = build()
72
+ return sender
73
+ ? sender.send(message)
74
+ : Promise.reject(new Unsent(waiting ?? 'waiting for a sender', 60_000))
75
+ },
76
+ waiting: () => build().waiting,
77
+ })
78
+
79
+ /** One text message, composed and ready to leave: the portable texter
80
+ * capability, which @yaks/phone sends through. */
81
+ export type Text = {
82
+ /** the number it goes to, in E.164 form */
83
+ to: string
84
+ /** the words */
85
+ text: string
86
+ /** the number it is from; absent, the texter's own */
87
+ from?: string
88
+ /** an RCS agent to send it as, with the text going as SMS from `from`
89
+ * where the phone has no RCS */
90
+ agent?: string
91
+ /** everyone else in the group text it answers, who get it too, as one
92
+ * group message: given only to a texter whose provider hears group texts */
93
+ group?: string[]
94
+ }
95
+
96
+ /** What a texter reports about a text it accepted. */
97
+ export type TextReceipt = {
98
+ /** The transport that accepted it; an opaque provider name. */
99
+ via?: string
100
+ /** the provider's id for the message, which its outcome names */
101
+ id?: string
102
+ /** the number it left from, when the texter chose it */
103
+ from?: string
104
+ }
105
+
106
+ /** A texter resolves when the text is accepted and rejects when it is not,
107
+ * as a {@link Sender} does for a letter. */
108
+ export type Texter = {
109
+ send: (text: Text) => Promise<TextReceipt>
110
+ /** Why it cannot send yet, such as a credential not set; asked before each
111
+ * text, so the text waits instead. Absent or empty, it can send. */
112
+ waiting?: () => string | undefined
113
+ }
114
+
115
+ /** One message to post in a room of a chat platform (@yaks/chat), by the
116
+ * bot of a connection: the portable chatter capability. */
117
+ export type Chat = {
118
+ /** the connection whose bot speaks it, absent for the host's own bot in a DM */
119
+ connection?: string
120
+ /** the platform's id for the room */
121
+ room: string
122
+ /** the words */
123
+ text: string
124
+ /** the platform's id for the message it answers */
125
+ reply_to?: string
126
+ /** the platform's id for the first message of the thread, where required */
127
+ thread?: string
128
+ /** the platform's id for the one account it names, which alone is
129
+ * pinged */
130
+ ping?: string
131
+ /** the buttons posted with it */
132
+ controls?: Control[]
133
+ }
134
+
135
+ /** A button posted with a chat message: its label, and the id a press of it
136
+ * names (@yaks/chat `Press`). */
137
+ export type Control = { id: string; label: string }
138
+
139
+ /** A chatter posts a message for one chat platform, resolving with the
140
+ * platform's id for it and rejecting as a {@link Texter} does. Which bot's
141
+ * credential posts it is the host's to know from the connection. */
142
+ export type Chatter = {
143
+ post: (chat: Chat) => Promise<{ id?: string }>
144
+ /** Show a room that the connection's bot is working on an answer, where
145
+ * its platform can: a show lasts `every` milliseconds (@yaks/chat
146
+ * `showing`). */
147
+ working?: {
148
+ every: number
149
+ show: (at: Pick<Chat, 'connection' | 'room'>) => Promise<void>
150
+ }
151
+ /** Why it cannot post yet; absent or empty, it can. */
152
+ waiting?: () => string | undefined
153
+ }
154
+
155
+ /** A rejection that knows the message never left: the connection was never
156
+ * made, or the provider refused to take it yet. Sending is at most once, so
157
+ * only this rejection lets a letter be handed over again, no sooner than
158
+ * `retry.after` milliseconds; any other rejection is a bounce. */
159
+ export class Unsent extends Error {
160
+ retry: { after: number }
161
+ constructor(message: string, after = 1000) {
162
+ super(message)
163
+ this.name = 'Unsent'
164
+ this.retry = { after }
165
+ }
166
+ }
167
+
168
+ /** A rejection that knows the letter as written can never go: its provider
169
+ * refused an address on it, such as one at a domain that takes no mail. The
170
+ * letter bounces with this message as its reason, and that bounce is the
171
+ * letter's outcome, answered on the letter: the writer's input, not a failure
172
+ * of the sender. Any other rejection that is not {@link Unsent} is both. */
173
+ export class Undeliverable extends Error {
174
+ constructor(message: string) {
175
+ super(message)
176
+ this.name = 'Undeliverable'
177
+ }
178
+ }
179
+
180
+ /** An original part of a delivery, retained without interpreting its bytes. */
181
+ export type MailSource = {
182
+ name: string
183
+ type: string
184
+ bytes: Uint8Array<ArrayBuffer>
185
+ }
186
+
187
+ /** An incoming letter at the portable mail boundary. Authentication is a
188
+ * provider's verdict, never inferred from a stranger's supplied headers. */
189
+ export type Incoming = {
190
+ /** the name in the message's From header, if any */
191
+ name?: string
192
+ from: string
193
+ to: string
194
+ headers: {
195
+ get(name: string): string | null
196
+ entries?(): IterableIterator<[string, string]>
197
+ }
198
+ text: string
199
+ html?: string
200
+ /** the receiving server's DKIM verdict; unset where nobody checked */
201
+ verified?: boolean
202
+ /** the receiving server's DMARC pass, aligned with the From domain: that
203
+ * domain vouches its author wrote the letter */
204
+ vouched?: boolean
205
+ attachments: MailSource[]
206
+ /** Original MIME or provider responses, before decoding or selecting fields. */
207
+ sources?: MailSource[]
208
+ }
209
+
210
+ /** A provider's signed word on a letter it carried: the receipt @yaks/mail's
211
+ * `receipted` applies, if it names one, and the tags the letter was sent
212
+ * with, which say whose letter it was. Or the letters it received, for a
213
+ * provider that takes mail in by webhook. */
214
+ export type Notice = {
215
+ receipt?: { letter: string; id: string }
216
+ tags?: Record<string, string>
217
+ /** the letters it received, one for each recipient, read in full */
218
+ letters?: Incoming[]
219
+ /** An authenticated arrival that still needs to be retrieved. */
220
+ pending?: string
221
+ }
222
+
223
+ /** Reads one request a provider posted about the letters it carried. A
224
+ * request the provider did not sign rejects as {@link Unsigned}. */
225
+ export type Notices = (request: Request) => Promise<Notice>
226
+
227
+ /** A request that does not carry its provider's signature: the caller is
228
+ * refused, never retried. */
229
+ export class Unsigned extends Error {
230
+ constructor(message: string) {
231
+ super(message)
232
+ this.name = 'Unsigned'
233
+ }
234
+ }
235
+
236
+ /** Reads one letter a runtime handed its host, in the runtime's own shape,
237
+ * as an {@link Incoming}. Only the provider knows that shape. */
238
+ export type Arrival = (message: unknown) => Promise<Incoming>
239
+
240
+ /** A DNS record a mail domain needs, and whether its provider has seen it. */
241
+ export type DomainRecord = {
242
+ /** `MX`, `TXT` or `CNAME` */
243
+ type: string
244
+ /** the name it is written at, fully qualified */
245
+ name: string
246
+ /** what it holds */
247
+ value: string
248
+ /** an MX record's priority */
249
+ priority?: number
250
+ /** whether the provider has found it in DNS as given */
251
+ arrived: boolean
252
+ }
253
+
254
+ /** A domain a provider sends and receives mail at, and the records it needs. */
255
+ export type MailDomain = { name: string; records: DomainRecord[] }
256
+
257
+ /** A provider's mail domains, each named by its domain name: the provider's
258
+ * own ids for them stay with the provider. Every verb rejects when the
259
+ * provider refuses it, its message naming no secret. */
260
+ export type MailDomains = {
261
+ /** Set a domain up for sending and receiving, or answer it as it is when
262
+ * it already is. */
263
+ setup: (name: string) => Promise<MailDomain>
264
+ /** The domain's records as they stand, or none when it is not set up. A
265
+ * read asks the provider to look again for any record not yet arrived. */
266
+ read: (name: string) => Promise<MailDomain | undefined>
267
+ /** Remove the domain; removing one not set up does nothing. */
268
+ remove: (name: string) => Promise<void>
269
+ /** Why it cannot reach the provider yet, such as a credential not set.
270
+ * Absent or empty, it can. */
271
+ waiting?: () => string | undefined
272
+ }
package/words.js ADDED
@@ -0,0 +1,134 @@
1
+ // Vocabulary assembly from already-imported facets, with no storage opened.
2
+ import { toolName } from "@yaks/graph/call";
3
+ import { tier } from "@yaks/graph/tools";
4
+ import { derived as callsDerived } from "@yaks/tools/vocab";
5
+ import { toolsIn } from "@yaks/vocab/tools";
6
+ import { loadVocab } from "@yaks/vocab/runtime";
7
+ import { fields as searched } from "@yaks/fts/fields";
8
+ import { backingsIn, derivedIn } from "@yaks/sql";
9
+ import { understood } from "./keywords.js";
10
+ import { beneath, docsOf, selected } from "./documents.js";
11
+ export let taking = async (plugins, name, load)=>(await Promise.all(plugins.filter(([, , , facets])=>facets === undefined || facets.includes(name)).map(async ([plugin, options, words, facets])=>{
12
+ let mod = await load(plugin, name);
13
+ if (!mod && name == 'vocab') selected([], words, plugin);
14
+ return [
15
+ mod,
16
+ options,
17
+ plugin,
18
+ words,
19
+ facets
20
+ ];
21
+ }))).filter((t)=>!!t[0]);
22
+ let defaults = {};
23
+ let worded = {
24
+ next: new WeakMap()
25
+ };
26
+ export let wordsOf = (vocabs, own, opts = defaults)=>{
27
+ let at = vocabs.reduce((node, [v, , plugin, names])=>{
28
+ let named = node.next.get(v);
29
+ if (!named) node.next.set(v, named = new Map());
30
+ let key = JSON.stringify([
31
+ plugin,
32
+ names && [
33
+ ...new Set(names)
34
+ ].sort()
35
+ ]);
36
+ let next = named.get(key);
37
+ if (!next) named.set(key, next = {
38
+ next: new WeakMap()
39
+ });
40
+ return next;
41
+ }, worded);
42
+ let choices = at.choices ??= new WeakMap();
43
+ let choice = choices.get(opts);
44
+ if (!choice) choices.set(opts, choice = {});
45
+ if (!own?.length) return choice.words ??= spoken(vocabs, [], opts);
46
+ let held = choice.own ??= new WeakMap();
47
+ let words = held.get(own);
48
+ if (!words) {
49
+ // Hosts often decode the same small set of graph-owned documents afresh.
50
+ // Retain equivalent compilations across interleaved graphs, bounded by
51
+ // both their count and the source text they keep.
52
+ let source = JSON.stringify(own);
53
+ let sources = choice.sources ??= {
54
+ entries: new Map(),
55
+ chars: 0
56
+ };
57
+ words = sources.entries.get(source);
58
+ if (words) {
59
+ sources.entries.delete(source);
60
+ sources.entries.set(source, words);
61
+ } else {
62
+ words = spoken(vocabs, own, opts);
63
+ if (source.length <= 256 * 1024) {
64
+ sources.entries.set(source, words);
65
+ sources.chars += source.length;
66
+ while(sources.entries.size > 16 || sources.chars > 256 * 1024){
67
+ let first = sources.entries.keys().next().value;
68
+ sources.entries.delete(first);
69
+ sources.chars -= first.length;
70
+ }
71
+ }
72
+ }
73
+ held.set(own, words);
74
+ }
75
+ return words;
76
+ };
77
+ // The words, from the `./vocab` facets already imported.
78
+ let spoken = (vocabs, own, opts)=>{
79
+ // The components a tool call is recorded in belong to the host, not to
80
+ // whichever plugin happened to declare them: what was asked of this host is
81
+ // its own record. A plugin that already declares them — a harness, whose
82
+ // transcripts are calls — keeps its own definitions, so only the components
83
+ // nobody supplied are added.
84
+ let docs = vocabs.flatMap(([v, , plugin, names])=>selected(v.docs ?? [], names, plugin).map((d)=>({
85
+ ...d,
86
+ label: plugin,
87
+ description: v.description
88
+ })));
89
+ if (opts.implicit !== false) docs = docsOf(docs);
90
+ let keywords = opts.keywords ?? (opts.implicit === false ? vocabs.flatMap(([v])=>v.keywords ?? []) : understood(vocabs.flatMap(([v])=>v.keywords ?? [])));
91
+ if (own.length) {
92
+ docs = [
93
+ ...beneath(docs, own),
94
+ ...own
95
+ ];
96
+ }
97
+ let vocab = loadVocab(docs, keywords);
98
+ let by = vocabs.map(([v, , label])=>({
99
+ facet: v,
100
+ local: vocab.in({
101
+ label
102
+ })
103
+ }));
104
+ let tools = vocab.in({
105
+ label: '@yaks/tools'
106
+ });
107
+ let derived = Object.assign({}, derivedIn(callsDerived(tools), tools, vocab), ...by.map(({ facet, local })=>facet.derived && derivedIn(facet.derived(local), local, vocab)));
108
+ return {
109
+ docs,
110
+ vocab,
111
+ derived,
112
+ backed: Object.assign({}, ...by.map(({ facet, local })=>{
113
+ if (!facet.backed) return {};
114
+ return backingsIn(facet.backed(local, derivedIn(derived, vocab, local)), local, vocab);
115
+ })),
116
+ // The generic tier lists `search` only where a property is indexed, so its
117
+ // declarations are read off the tier the graph would build. Read on asking,
118
+ // since checking every declaration costs what a graph opened to answer one
119
+ // query should not pay twice.
120
+ tools: ()=>[
121
+ ...tier({
122
+ keywords: vocab.keywords,
123
+ ...searched(vocab).length ? {
124
+ search: ()=>[]
125
+ } : {}
126
+ }).map(({ run: _, ...decl })=>decl),
127
+ ...toolsIn(docs).map((decl)=>({
128
+ ...decl,
129
+ name: decl.name ?? toolName(decl)
130
+ }))
131
+ ]
132
+ };
133
+ };
134
+ //# sourceMappingURL=words.js.map
package/words.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"words.js","sources":["./words.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAE5E,SAAS,QAAQ,gCAAqC;AACtD,SAAS,IAAI,iCAAsC;AACnD,SAAS,WAAW,YAAY,iCAAsC;AACtE,SAAS,OAAO,iCAAsC;AACtD,SAEE,SAAS,mCAG4B;AACvC,SAAS,UAAU,QAAQ,gCAAqC;AAChE,SAAwB,UAAU,EAAgB,SAAS,yBAA8B;AAGzF,SAAS,UAAU,wBAAuB;AAC1C,SAAS,OAAO,EAAE,MAAM,EAAE,QAAQ,yBAAwB;AAc1D,OAAO,IAAI,SAAS,OAClB,SACA,MACA,OAEA,CAAC,MAAM,QAAQ,GAAG,CAChB,QAAQ,MAAM,CAAC,CAAC,OAAO,OAAO,GAC5B,WAAW,aAAa,OAAO,QAAQ,CAAC,OACxC,GAAG,CAAC,OAAO,CAAC,QAAQ,SAAS,OAAO,OAAO;IAC3C,IAAI,MAAM,MAAM,KAAK,QAAQ;IAC7B,IAAI,CAAC,OAAO,QAAQ,SAAS,SAAS,EAAE,EAAE,OAAO;IACjD,OAAO;MAAC;MAAK;MAAS;MAAQ;MAAO;KAAO;EAC9C,GACD,EAAE,MAAM,CAAC,CACR,IAOG,CAAC,CAAC,CAAC,CAAC,EAAE,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