@hearthscale/app 0.3.0 → 0.4.0-rc.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.
Files changed (2) hide show
  1. package/dist/index.d.ts +481 -246
  2. package/package.json +2 -2
package/dist/index.d.ts CHANGED
@@ -1,228 +1,3 @@
1
- /**
2
- * What a Server asks Hearthscale's api about models and what it answers:
3
- * the models that suit one computer, best first for each kind, with the
4
- * exact files of each. The Server keeps the last answer on disk.
5
- */
6
-
7
- /** A model's licence: its name, and whether it is open for commercial use. */
8
- interface OfferedLicense {
9
- name: string;
10
- commercial: boolean;
11
- }
12
-
13
- /**
14
- * Control: the first-party half of the inference contract — everything the
15
- * OpenAI shape cannot express. Served by the Server (`hearthd`) beside the
16
- * generation routes.
17
- */
18
-
19
- /** Resolved publisher identity, independent of the model architecture.
20
- * `GET /v1/publishers/{owner}/picture` answers the picture of the Hub
21
- * user or organisation `repository` names first: its bytes as
22
- * `image/png`, `image/jpeg`, `image/webp`, `image/gif` or
23
- * `image/svg+xml`, with `cache-control: max-age=86400`. A 404
24
- * `invalid_request` says no picture is known for the owner, and a 400
25
- * `invalid_request` refuses a name that is not one Hub path segment of
26
- * ASCII letters, digits, `-`, `_` and `.`. */
27
- interface ModelIdentity {
28
- publisher: string;
29
- /** The Hub repository whose publisher supplies the artwork; null for other sources. */
30
- repository: string | null;
31
- }
32
- /** What a transcription model's card and file state about it. A list is empty,
33
- * and a field null, where neither says. */
34
- interface SpeechFacts {
35
- /** The languages it hears, by their short codes. */
36
- languages: string[];
37
- /** The percent of words, or of characters in a language written without
38
- * spaces, its publisher measured wrong on a public test set, by language. */
39
- errors: Record<string, number>;
40
- /** How long 30 s of speech took on a graphics device, as its publisher measured
41
- * it on the reference computer most like its Server. */
42
- seconds: number | null;
43
- /** The same on the processor. */
44
- processorSeconds: number | null;
45
- /** It writes English from another language. */
46
- translates: boolean | null;
47
- /** It tells the language by itself. */
48
- detects: boolean | null;
49
- }
50
- /** A job kind a model runs: the JSON Schema (draft-07) of its input, every
51
- * object of it closed. A property of `"format": "asset"`, alone or as the
52
- * items of an array, names a file by its asset id on the app's side,
53
- * `contentMediaType` saying what it takes, and its `description` the
54
- * limits the model sets on it; it reaches the Server as a `RenderUpload`
55
- * in the same place. A property of `"format": "model"` names another
56
- * model of the same Server by its card id; it reaches the Server as that
57
- * model's id. A property's `default` is what the model's saved settings
58
- * give a job that leaves it out. */
59
- interface JobSpec {
60
- input: Record<string, unknown>;
61
- }
62
- /** The plan of a load or a media job against the memory as it stands, in
63
- * MiB. A loaded model's process holds the graphics and system memory, and
64
- * may fill the growth beside them as it keeps conversations ready; a
65
- * job's process holds them at most while it runs. */
66
- interface MemoryPlan {
67
- graphicsMib: number;
68
- systemMib: number;
69
- growthMib: number;
70
- /** The graphics and system memory together, written as the words write
71
- * an amount of memory. */
72
- takes: string;
73
- /** The context a language model's load takes, shorter than its settings
74
- * ask where the memory free now holds no more; absent for a media job. */
75
- contextTokens?: number;
76
- /** Whether the broker takes the load or the job now: it starts at once,
77
- * or once the busy models and jobs it waits for finish. It is the check
78
- * a load or a job meets as it starts, on the memory free now, and the
79
- * catalogue says it changed when it does. */
80
- ready: boolean;
81
- /** The plan in words, or why the load cannot start now: the limit that
82
- * stops it, the system memory free or what Windows can still commit,
83
- * and what the person closes or changes. */
84
- words: string;
85
- }
86
- interface DownloadProgressBytes {
87
- receivedBytes: number;
88
- totalBytes: number;
89
- }
90
- /** The order of a Discover search; trending first where `sort` names
91
- * none. */
92
- type HubSort = 'trending' | 'downloads' | 'likes' | 'updated';
93
- /** One Hugging Face repository as Discover lists it: who published it, the
94
- * model it quantises, how it is used, and what its header states of its
95
- * size, its architecture and its window. */
96
- interface HubRepository {
97
- identity: ModelIdentity;
98
- formats: string[];
99
- tasks: string[];
100
- repo: string;
101
- author: string;
102
- /** The repository the weights were quantised from, where the card
103
- * names one. */
104
- baseModel: string | null;
105
- downloads: number;
106
- likes: number;
107
- /** A gated repository's files are read only with the Hugging Face token
108
- * the Server holds. */
109
- gated: boolean;
110
- updatedAt: string | null;
111
- pipeline: string | null;
112
- architecture: string | null;
113
- params: number | null;
114
- contextLength: number | null;
115
- vision: boolean;
116
- tools: boolean;
117
- reasoning: boolean;
118
- /** What a speech model's card states about it. */
119
- speech: SpeechFacts | null;
120
- }
121
- /** A file that can fill a companion role: where it is, how big it is, and
122
- * whether its checksum is published. */
123
- interface CompanionOption {
124
- repo: string;
125
- path: string;
126
- sizeBytes: number;
127
- verifiable: boolean;
128
- installed?: {
129
- modelId: string;
130
- path: string;
131
- source: {
132
- type: string;
133
- repo: string;
134
- revision: string;
135
- };
136
- sha256: string;
137
- sizeBytes: number;
138
- };
139
- containsVision?: boolean;
140
- /** The licence the recommendations state for a usual part of a family. */
141
- license?: OfferedLicense;
142
- }
143
- /** A companion role of a candidate and the files that fill it. */
144
- interface CompanionRole {
145
- role: string;
146
- label: string;
147
- options: CompanionOption[];
148
- /** A gated base or encoder repository whose files this caller cannot read. */
149
- gated?: string;
150
- }
151
- /** One file of a repository a pull can name: the whole shard set where it
152
- * is a numbered shard, with the weights' projector beside it where the
153
- * repository holds one. */
154
- interface HubCandidate {
155
- /** The model id the pull makes, with the projector a lone one picks. */
156
- id: string;
157
- /** The name the pulled model goes by where no other model of the
158
- * library shares it, as `CatalogModel.label` names it. */
159
- name: string;
160
- path: string;
161
- quantization: string;
162
- /** Every byte the pull writes for this file, its set and its projector. */
163
- sizeBytes: number;
164
- engine: string;
165
- /** Whether every byte of it publishes a checksum; a pull refuses the
166
- * rest by name rather than downloading them unverified. */
167
- verifiable: boolean;
168
- /** The files the repository supplies beside the weights. */
169
- components: {
170
- role: string;
171
- label: string;
172
- path: string;
173
- }[];
174
- /** Companion roles whose files the pull selects from compatible installed
175
- * components, the model's family or the encoder's own releases. */
176
- requires: CompanionRole[];
177
- /** The companion roles the model loads where a pull names a file for
178
- * them: `llm_vision`, the vision
179
- * part of a language model encoder, for a family that reads reference
180
- * pictures through it. */
181
- offers: CompanionRole[];
182
- /** Whether the repository holds vision projectors beside the file. */
183
- projector: boolean;
184
- /** The projectors to choose from where there is more than one, each
185
- * with the model id a pull with it makes. */
186
- projectorOptions: {
187
- path: string;
188
- id: string;
189
- sizeBytes: number;
190
- verifiable: boolean;
191
- }[];
192
- /** The task the model serves, as `CatalogRole` names it. */
193
- role: string;
194
- format: string;
195
- /** For an adapter: model ids from a Server, card ids from the platform. */
196
- fits?: string[];
197
- /** Why the file cannot be pulled, in the Server's words. */
198
- reason?: string;
199
- }
200
- /** `GET /control/discover?task=&q=&sort=` answers the repositories of one
201
- * task that `q` matches, or with no `q` the whole set, at most 30, as
202
- * `HubRepository[]`; and `GET /control/discover/{owner}/{repo}` one
203
- * repository as `HubListing`: the files a runtime of the Server runs, how
204
- * many files it publishes in all, so a repository whose listing yields
205
- * no candidate is one no runtime there runs, and every file a pull of
206
- * another repository's model can name as a companion. Both read Hugging
207
- * Face on a person's act and on nothing else, and with no token, so they
208
- * reach the public repositories alone; the Server's own window reads the
209
- * same answers from `/local/discover`, with the token the person stored. */
210
- interface HubListing {
211
- repo: string;
212
- model: HubRepository;
213
- files: number;
214
- /** The path of the file a press takes, where one can be taken. */
215
- fileToTake: string | null;
216
- candidates: HubCandidate[];
217
- companions: CompanionOption[];
218
- capabilities: {
219
- vision: boolean;
220
- tools: boolean;
221
- reasoning: boolean;
222
- tasks: string[];
223
- };
224
- }
225
-
226
1
  /**
227
2
  * The platform half of the contract, generated from the Rust types of
228
3
  * the `contract` crate by `npm run contract` in `apps/platform/scripts`.
@@ -268,6 +43,12 @@ type Entry = {
268
43
  type: 'session.filing';
269
44
  } | {
270
45
  model?: string | null;
46
+ reasoning?: Reasoning | null;
47
+ /**
48
+ * The id of the index's place the agent's `file_search` reads in; with
49
+ * none it reads every place the app may read.
50
+ */
51
+ place?: string | null;
271
52
  type: 'session.settings';
272
53
  } | {
273
54
  to: string | null;
@@ -295,6 +76,11 @@ type Entry = {
295
76
  * block named them.
296
77
  */
297
78
  shown?: string;
79
+ /**
80
+ * The context window, in tokens, the turn planned its first
81
+ * request with.
82
+ */
83
+ window?: number;
298
84
  type: 'turn.started';
299
85
  } | {
300
86
  turn: string;
@@ -314,6 +100,20 @@ type Entry = {
314
100
  model: string;
315
101
  provider: string;
316
102
  error?: string;
103
+ /**
104
+ * Milliseconds from the request to the first streamed fragment of
105
+ * the reply: text, reasoning or a call.
106
+ */
107
+ firstTokenMs?: number;
108
+ /**
109
+ * The attempts of the round thrown away before this reply, oldest
110
+ * first.
111
+ */
112
+ retries?: Retry[];
113
+ /**
114
+ * The streamed calls that named no tool, left out of `toolCalls`.
115
+ */
116
+ dropped?: number;
317
117
  type: 'agent.message';
318
118
  } | {
319
119
  callId: string;
@@ -322,9 +122,13 @@ type Entry = {
322
122
  * The call this one runs under; absent for a call of the turn.
323
123
  */
324
124
  under?: string;
125
+ /**
126
+ * The name as the model wrote it.
127
+ */
325
128
  name: string;
326
129
  /**
327
- * JSON-encoded, as the model emitted them.
130
+ * The arguments as the model wrote them: JSON-encoded, or the
131
+ * markup of a call written in the words of the reply.
328
132
  */
329
133
  arguments: string;
330
134
  context: CallContext;
@@ -333,6 +137,10 @@ type Entry = {
333
137
  * Absent for a core tool, and for a name that named no tool.
334
138
  */
335
139
  label?: CallLabel;
140
+ /**
141
+ * How the call runs, where the model wrote it out of form.
142
+ */
143
+ repaired?: Repaired;
336
144
  type: 'call.prepared';
337
145
  } | {
338
146
  callId: string;
@@ -468,6 +276,10 @@ type Entry = {
468
276
  watermark: string;
469
277
  rounds: number;
470
278
  type: 'compaction.cleared';
279
+ } | {
280
+ callId: string;
281
+ chars: number;
282
+ type: 'compaction.clipped';
471
283
  } | {
472
284
  tailStart: string;
473
285
  summary: string;
@@ -530,7 +342,7 @@ type RootKind = 'home' | 'workspace' | 'project' | 'memory' | 'skill' | 'folder'
530
342
  */
531
343
  type PermissionLevel = 'manual' | 'auto' | 'skip' | 'bypass';
532
344
  type ModelLocation = 'local' | 'lan' | 'cloud';
533
- type StopReason = ('end_turn' | 'length' | 'budget' | 'cancelled' | 'error' | 'refused' | 'app_disabled' | 'app_update' | 'interrupted') | 'no_result';
345
+ type StopReason = ('end_turn' | 'length' | 'budget' | 'cancelled' | 'error' | 'refused' | 'app_disabled' | 'app_update' | 'interrupted') | 'no_result' | 'repeated';
534
346
  /**
535
347
  * A part of a user message.
536
348
  */
@@ -592,6 +404,14 @@ type AgentPart = {
592
404
  kind: 'reasoning';
593
405
  };
594
406
  type AgentStop = 'end_turn' | 'tool_calls' | 'length' | 'cancelled' | 'error' | 'refused' | 'interrupted';
407
+ /**
408
+ * Why an attempt was sent again: its reply held no words and no call, the
409
+ * provider failed in a way that passes before any token, the request did
410
+ * not fit the runtime's window, or, and the attempt sent again carried a
411
+ * reminder, the reply announced a step and made no call, or it stated
412
+ * figures that nothing it was given holds and no program ran in the turn.
413
+ */
414
+ type RetryReason = 'empty' | 'transient' | 'overflow' | 'announced' | 'figures';
595
415
  /**
596
416
  * A transcript mark an app's manifest names for a tool.
597
417
  */
@@ -654,11 +474,16 @@ type EnvironmentKind = 'process' | 'vm';
654
474
  * manifest's order, placed in the rail or a tab: a `web` surface's own
655
475
  * page, or the web page of a view's tab. `navigate` loads an address in
656
476
  * the session's tab, opening it when the session has none, hidden for a
657
- * view's tab; `evaluate` runs a script and answers its value;
658
- * `screenshot` answers the page as an asset; `show` puts the tab in front
659
- * of the person; `close` ends it.
477
+ * view's tab; `evaluate` runs a script and answers its value; `click`
478
+ * presses the left button at a point of the page's viewport, in its CSS
479
+ * pixels; `type` types text into the element with focus; `press` presses
480
+ * a key or a combination such as `Control+a`, but none that pastes, since
481
+ * a page may not read the clipboard; `screenshot` answers the page as an
482
+ * asset; `show` puts the tab in front of the person; `close` ends it. The
483
+ * page receives `click`, `type` and `press` as the person's own input,
484
+ * which its scripts cannot tell apart from a person's.
660
485
  */
661
- type SurfaceOp = 'navigate' | 'evaluate' | 'screenshot' | 'show' | 'close';
486
+ type SurfaceOp = 'navigate' | 'evaluate' | 'click' | 'type' | 'press' | 'screenshot' | 'show' | 'close';
662
487
  /**
663
488
  * One setting's value.
664
489
  */
@@ -725,7 +550,6 @@ type NetworkEntry = string;
725
550
  */
726
551
  type ListenPort = number;
727
552
  type Lifetime = 'service';
728
- type Reasoning = 'none' | 'auto' | 'high';
729
553
  /**
730
554
  * A relative path inside the package, forward slashes, never leaving it.
731
555
  */
@@ -1259,6 +1083,11 @@ type ResourceWriteResult = {
1259
1083
  * commit with its first parent.
1260
1084
  */
1261
1085
  type VcsScope = 'working' | 'staged' | 'branch' | 'commit';
1086
+ /**
1087
+ * The parts of a search: the words of the passages and the names of the
1088
+ * files, the meanings, and the rerank model's order of the best.
1089
+ */
1090
+ type IndexLeg = 'words' | 'vectors' | 'rerank';
1262
1091
  /**
1263
1092
  * What a transcription stream tells an app's backend: the open
1264
1093
  * segment's text so far, a segment's final text with its start and end in
@@ -1400,7 +1229,8 @@ interface ToolCall {
1400
1229
  id: string;
1401
1230
  name: string;
1402
1231
  /**
1403
- * JSON-encoded arguments exactly as the model emitted them.
1232
+ * JSON-encoded arguments. A reply the log keeps holds each call as it
1233
+ * runs; its `call.prepared` keeps what the model wrote.
1404
1234
  */
1405
1235
  arguments: string;
1406
1236
  }
@@ -1411,8 +1241,20 @@ interface ToolCall {
1411
1241
  interface Usage {
1412
1242
  input: number;
1413
1243
  output: number;
1244
+ /**
1245
+ * The tokens of `output` the model spent reasoning, where the runtime
1246
+ * states them.
1247
+ */
1248
+ reasoning?: number;
1414
1249
  estimated?: true;
1415
1250
  }
1251
+ /**
1252
+ * An attempt of a round that was thrown away and sent again, and when.
1253
+ */
1254
+ interface Retry {
1255
+ reason: RetryReason;
1256
+ at: string;
1257
+ }
1416
1258
  /**
1417
1259
  * What every tool call, session write and job carries: who acts, where
1418
1260
  * the words came from, and the chain of principals the call crossed,
@@ -1445,6 +1287,20 @@ interface CallSource {
1445
1287
  id: string;
1446
1288
  name: string;
1447
1289
  }
1290
+ /**
1291
+ * A call the model wrote out of form, as it runs: the tool's name where
1292
+ * the model wrote it in another case or with `-` for `_`, and the
1293
+ * arguments read as a JSON object of the types the tool's schema names.
1294
+ * `written` marks a call written in the words of the reply.
1295
+ */
1296
+ interface Repaired {
1297
+ name: string;
1298
+ /**
1299
+ * JSON-encoded.
1300
+ */
1301
+ arguments: string;
1302
+ written?: true;
1303
+ }
1448
1304
  interface Executor {
1449
1305
  principal: PrincipalRef;
1450
1306
  instance: string;
@@ -1841,6 +1697,12 @@ interface Manifest {
1841
1697
  */
1842
1698
  version: string;
1843
1699
  api: 7;
1700
+ /**
1701
+ * The lowest Hearthscale version the package runs on. A Hearthscale
1702
+ * of a lower version refuses the package, and the Marketplace offers
1703
+ * it the newest release it meets.
1704
+ */
1705
+ hearthscale?: string;
1844
1706
  description: string;
1845
1707
  icon?: Schemed;
1846
1708
  license?: string;
@@ -1969,6 +1831,11 @@ interface ModelRequirement {
1969
1831
  */
1970
1832
  recommend?: string[];
1971
1833
  sampling?: Sampling;
1834
+ /**
1835
+ * The level the agent's turns think at; a level the person picks for
1836
+ * a conversation goes over it on a model that lists two or more
1837
+ * levels.
1838
+ */
1972
1839
  reasoning?: Reasoning;
1973
1840
  }
1974
1841
  interface Sampling {
@@ -2386,6 +2253,21 @@ interface ModelCard {
2386
2253
  * states it.
2387
2254
  */
2388
2255
  reasoning?: boolean;
2256
+ /**
2257
+ * The levels the model thinks at, least first, where its provider
2258
+ * states them.
2259
+ *
2260
+ * Items: How much a model thinks before it answers, least first: `none` is Off and
2261
+ * `max` thinks with no limit. A model that lacks a level runs at the
2262
+ * nearest one it has, the higher of two as near. The inference contract's
2263
+ * `Reasoning`: a Server's `reasoning_effort` takes the same words.
2264
+ */
2265
+ reasoningLevels?: Reasoning[];
2266
+ /**
2267
+ * The level the model thinks at when a request names none, where its
2268
+ * provider states it.
2269
+ */
2270
+ reasoningLevel?: Reasoning;
2389
2271
  /**
2390
2272
  * The job kinds the card runs, by kind word, each with the input it
2391
2273
  * takes.
@@ -2441,6 +2323,38 @@ interface ModelCard {
2441
2323
  * recommendation states one.
2442
2324
  */
2443
2325
  limitingLicense?: string;
2326
+ /**
2327
+ * How an embedding card's inputs are written, where its Server's
2328
+ * recommendation states it; a card that states none takes its texts
2329
+ * as they are.
2330
+ */
2331
+ embedding?: Embedding;
2332
+ }
2333
+ /**
2334
+ * How an embedding model's inputs are written. Each template holds
2335
+ * `{text}` where the text goes, and a document's `{title}` where the
2336
+ * document's title goes; a template ends with the model's end token where
2337
+ * its file's tokenizer adds none.
2338
+ */
2339
+ interface Embedding {
2340
+ /**
2341
+ * A search's words.
2342
+ */
2343
+ query: string;
2344
+ /**
2345
+ * A passage of a document with a title.
2346
+ */
2347
+ document: string;
2348
+ /**
2349
+ * A passage of a document with no title, where it is not `document`
2350
+ * with an empty title.
2351
+ */
2352
+ untitled?: string;
2353
+ /**
2354
+ * The length its vectors are cut to, where it is used shorter than it
2355
+ * embeds.
2356
+ */
2357
+ dimensions?: number;
2444
2358
  }
2445
2359
  /**
2446
2360
  * A Hearthscale Server this computer names, as `ctx.models.servers` and
@@ -2575,6 +2489,12 @@ interface CompletionRequest {
2575
2489
  */
2576
2490
  format?: CompletionFormat;
2577
2491
  sampling?: Sampling;
2492
+ /**
2493
+ * How much a model thinks before it answers, least first: `none` is Off and
2494
+ * `max` thinks with no limit. A model that lacks a level runs at the
2495
+ * nearest one it has, the higher of two as near. The inference contract's
2496
+ * `Reasoning`: a Server's `reasoning_effort` takes the same words.
2497
+ */
2578
2498
  reasoning?: Reasoning;
2579
2499
  /**
2580
2500
  * Asks for the same answer to the same request as far as the runtime
@@ -2608,6 +2528,10 @@ interface ChatMessage {
2608
2528
  content: ChatContent;
2609
2529
  toolCalls?: ToolCall[];
2610
2530
  toolCallId?: string;
2531
+ /**
2532
+ * The reasoning of a reply of the turn the request continues.
2533
+ */
2534
+ reasoning?: string;
2611
2535
  }
2612
2536
  /**
2613
2537
  * One tool as a model sees it.
@@ -2837,9 +2761,19 @@ interface Session {
2837
2761
  title: string;
2838
2762
  preview: string;
2839
2763
  /**
2840
- * The card the next turn uses, when a person chose one.
2764
+ * The card the next turn uses, when a person chose one.
2765
+ */
2766
+ model?: string;
2767
+ /**
2768
+ * The level the next turn thinks at, when a person chose one and the
2769
+ * model lists two or more levels.
2770
+ */
2771
+ reasoning?: Reasoning;
2772
+ /**
2773
+ * The id of the index's place the agent's `file_search` reads in, when a
2774
+ * person chose one.
2841
2775
  */
2842
- model?: string;
2776
+ place?: string;
2843
2777
  createdAt: string;
2844
2778
  updatedAt: string;
2845
2779
  status: SessionStatus;
@@ -3066,15 +3000,76 @@ interface IndexPage {
3066
3000
  }
3067
3001
  /**
3068
3002
  * One answer of a search of the shared index: the passage, the document
3069
- * it came from and its page, and how well it answers the query.
3003
+ * it came from and its page, and how well it answers the query. A
3004
+ * passage of a file in a place has the file's absolute path as its
3005
+ * source and the place's id; a file that answers by its name alone has
3006
+ * a line of its name, folder, size and date as its text.
3070
3007
  */
3071
3008
  interface IndexHit {
3009
+ /**
3010
+ * Names the passage while it is in the index.
3011
+ */
3012
+ id: string;
3072
3013
  source: string;
3073
3014
  title?: string;
3074
3015
  page?: number;
3016
+ /**
3017
+ * What a person calls the page, such as `Slide 4` or a sheet's name.
3018
+ */
3019
+ label?: string;
3020
+ /**
3021
+ * The first and the last line of the passage on its page, from 1.
3022
+ */
3023
+ start?: number;
3024
+ end?: number;
3025
+ place?: string;
3075
3026
  text: string;
3076
3027
  score: number;
3077
3028
  }
3029
+ /**
3030
+ * The body of `POST /index/search`: a search of every place the caller
3031
+ * may read, the person's reach for a window and the app's for a view.
3032
+ */
3033
+ interface IndexSearchRequest {
3034
+ query: string;
3035
+ /**
3036
+ * Ten when none is named.
3037
+ */
3038
+ limit?: number;
3039
+ legs?: IndexLegs;
3040
+ /**
3041
+ * The id of the one place to search in.
3042
+ */
3043
+ place?: string;
3044
+ /**
3045
+ * The query is a phrase a passage holds word for word; only the words
3046
+ * leg runs.
3047
+ */
3048
+ phrase?: boolean;
3049
+ }
3050
+ /**
3051
+ * The legs a search runs; a search with none named runs each.
3052
+ */
3053
+ interface IndexLegs {
3054
+ words: boolean;
3055
+ vectors: boolean;
3056
+ rerank: boolean;
3057
+ }
3058
+ /**
3059
+ * The answer of a search: its hits, best first, and each leg it could
3060
+ * not run.
3061
+ */
3062
+ interface IndexSearch {
3063
+ hits: IndexHit[];
3064
+ unavailable: IndexUnavailable[];
3065
+ }
3066
+ /**
3067
+ * A leg the search was asked to run and could not, with the reason.
3068
+ */
3069
+ interface IndexUnavailable {
3070
+ leg: IndexLeg;
3071
+ reason: string;
3072
+ }
3078
3073
  /**
3079
3074
  * One enabled app as `apps.list` lists it.
3080
3075
  */
@@ -3410,6 +3405,236 @@ interface MediaKeyPress {
3410
3405
  key: MediaKey;
3411
3406
  }
3412
3407
 
3408
+ /**
3409
+ * What a Server asks Hearthscale's api about models and what it answers:
3410
+ * the models that suit one computer, best first for each kind, with the
3411
+ * exact files of each. The Server keeps the last answer on disk.
3412
+ */
3413
+
3414
+ /** A model's licence: its name, and whether it is open for commercial use. */
3415
+ interface OfferedLicense {
3416
+ name: string;
3417
+ commercial: boolean;
3418
+ }
3419
+
3420
+ /**
3421
+ * Control: the first-party half of the inference contract — everything the
3422
+ * OpenAI shape cannot express. Served by the Server (`hearthd`) beside the
3423
+ * generation routes.
3424
+ */
3425
+
3426
+ /** How much a model thinks before it answers, least first, as a chat
3427
+ * request's `reasoning_effort` names it: `none` is Off and `max` thinks
3428
+ * with no limit. A model that lacks a level runs at the nearest one it
3429
+ * has, the higher of two as near. */
3430
+ type Reasoning = 'none' | 'low' | 'medium' | 'high' | 'max';
3431
+ /** Resolved publisher identity, independent of the model architecture.
3432
+ * `GET /v1/publishers/{owner}/picture` answers the picture of the Hub
3433
+ * user or organisation `repository` names first: its bytes as
3434
+ * `image/png`, `image/jpeg`, `image/webp`, `image/gif` or
3435
+ * `image/svg+xml`, with `cache-control: max-age=86400`. A 404
3436
+ * `invalid_request` says no picture is known for the owner, and a 400
3437
+ * `invalid_request` refuses a name that is not one Hub path segment of
3438
+ * ASCII letters, digits, `-`, `_` and `.`. */
3439
+ interface ModelIdentity {
3440
+ publisher: string;
3441
+ /** The Hub repository whose publisher supplies the artwork; null for other sources. */
3442
+ repository: string | null;
3443
+ }
3444
+ /** What a transcription model's card and file state about it. A list is empty,
3445
+ * and a field null, where neither says. */
3446
+ interface SpeechFacts {
3447
+ /** The languages it hears, by their short codes. */
3448
+ languages: string[];
3449
+ /** The percent of words, or of characters in a language written without
3450
+ * spaces, its publisher measured wrong on a public test set, by language. */
3451
+ errors: Record<string, number>;
3452
+ /** How long 30 s of speech took on a graphics device, as its publisher measured
3453
+ * it on the reference computer most like its Server. */
3454
+ seconds: number | null;
3455
+ /** The same on the processor. */
3456
+ processorSeconds: number | null;
3457
+ /** It writes English from another language. */
3458
+ translates: boolean | null;
3459
+ /** It tells the language by itself. */
3460
+ detects: boolean | null;
3461
+ }
3462
+ /** A job kind a model runs: the JSON Schema (draft-07) of its input, every
3463
+ * object of it closed. A property of `"format": "asset"`, alone or as the
3464
+ * items of an array, names a file by its asset id on the app's side,
3465
+ * `contentMediaType` saying what it takes, and its `description` the
3466
+ * limits the model sets on it; it reaches the Server as a `RenderUpload`
3467
+ * in the same place. A property of `"format": "model"` names another
3468
+ * model of the same Server by its card id; it reaches the Server as that
3469
+ * model's id. A property's `default` is what the model's saved settings
3470
+ * give a job that leaves it out. */
3471
+ interface JobSpec {
3472
+ input: Record<string, unknown>;
3473
+ }
3474
+ /** The plan of a load or a media job against the memory as it stands, in
3475
+ * MiB. A loaded model's process holds the graphics and system memory, and
3476
+ * may fill the growth beside them as it keeps conversations ready; a
3477
+ * job's process holds them at most while it runs. */
3478
+ interface MemoryPlan {
3479
+ graphicsMib: number;
3480
+ systemMib: number;
3481
+ growthMib: number;
3482
+ /** The graphics and system memory together, written as the words write
3483
+ * an amount of memory. */
3484
+ takes: string;
3485
+ /** The context a language model's load takes, shorter than its settings
3486
+ * ask where the memory free now holds no more; absent for a media job. */
3487
+ contextTokens?: number;
3488
+ /** Whether the broker takes the load or the job now: it starts at once,
3489
+ * or once the busy models and jobs it waits for finish. It is the check
3490
+ * a load or a job meets as it starts, on the memory free now, and the
3491
+ * catalogue says it changed when it does. */
3492
+ ready: boolean;
3493
+ /** The plan in words, or why the load cannot start now: the limit that
3494
+ * stops it, the system memory free or what Windows can still commit,
3495
+ * and what the person closes or changes. */
3496
+ words: string;
3497
+ }
3498
+ interface DownloadProgressBytes {
3499
+ receivedBytes: number;
3500
+ totalBytes: number;
3501
+ }
3502
+ /** The order of a Discover search; trending first where `sort` names
3503
+ * none. */
3504
+ type HubSort = 'trending' | 'downloads' | 'likes' | 'updated';
3505
+ /** One Hugging Face repository as Discover lists it: who published it, the
3506
+ * model it quantises, how it is used, and what its header states of its
3507
+ * size, its architecture and its window. */
3508
+ interface HubRepository {
3509
+ identity: ModelIdentity;
3510
+ formats: string[];
3511
+ tasks: string[];
3512
+ repo: string;
3513
+ author: string;
3514
+ /** The repository the weights were quantised from, where the card
3515
+ * names one. */
3516
+ baseModel: string | null;
3517
+ downloads: number;
3518
+ likes: number;
3519
+ /** A gated repository's files are read only with the Hugging Face token
3520
+ * the Server holds. */
3521
+ gated: boolean;
3522
+ updatedAt: string | null;
3523
+ pipeline: string | null;
3524
+ architecture: string | null;
3525
+ params: number | null;
3526
+ contextLength: number | null;
3527
+ vision: boolean;
3528
+ tools: boolean;
3529
+ reasoning: boolean;
3530
+ /** What a speech model's card states about it. */
3531
+ speech: SpeechFacts | null;
3532
+ }
3533
+ /** A file that can fill a companion role: where it is, how big it is, and
3534
+ * whether its checksum is published. */
3535
+ interface CompanionOption {
3536
+ repo: string;
3537
+ path: string;
3538
+ sizeBytes: number;
3539
+ verifiable: boolean;
3540
+ installed?: {
3541
+ modelId: string;
3542
+ path: string;
3543
+ source: {
3544
+ type: string;
3545
+ repo: string;
3546
+ revision: string;
3547
+ };
3548
+ sha256: string;
3549
+ sizeBytes: number;
3550
+ };
3551
+ containsVision?: boolean;
3552
+ /** The licence the recommendations state for a usual part of a family. */
3553
+ license?: OfferedLicense;
3554
+ }
3555
+ /** A companion role of a candidate and the files that fill it. */
3556
+ interface CompanionRole {
3557
+ role: string;
3558
+ label: string;
3559
+ options: CompanionOption[];
3560
+ /** A gated base or encoder repository whose files this caller cannot read. */
3561
+ gated?: string;
3562
+ }
3563
+ /** One file of a repository a pull can name: the whole shard set where it
3564
+ * is a numbered shard, with the weights' projector beside it where the
3565
+ * repository holds one. */
3566
+ interface HubCandidate {
3567
+ /** The model id the pull makes, with the projector a lone one picks. */
3568
+ id: string;
3569
+ /** The name the pulled model goes by where no other model of the
3570
+ * library shares it, as `CatalogModel.label` names it. */
3571
+ name: string;
3572
+ path: string;
3573
+ quantization: string;
3574
+ /** Every byte the pull writes for this file, its set and its projector. */
3575
+ sizeBytes: number;
3576
+ engine: string;
3577
+ /** Whether every byte of it publishes a checksum; a pull refuses the
3578
+ * rest by name rather than downloading them unverified. */
3579
+ verifiable: boolean;
3580
+ /** The files the repository supplies beside the weights. */
3581
+ components: {
3582
+ role: string;
3583
+ label: string;
3584
+ path: string;
3585
+ }[];
3586
+ /** Companion roles whose files the pull selects from compatible installed
3587
+ * components, the model's family or the encoder's own releases. */
3588
+ requires: CompanionRole[];
3589
+ /** The companion roles the model loads where a pull names a file for
3590
+ * them: `llm_vision`, the vision
3591
+ * part of a language model encoder, for a family that reads reference
3592
+ * pictures through it. */
3593
+ offers: CompanionRole[];
3594
+ /** Whether the repository holds vision projectors beside the file. */
3595
+ projector: boolean;
3596
+ /** The projectors to choose from where there is more than one, each
3597
+ * with the model id a pull with it makes. */
3598
+ projectorOptions: {
3599
+ path: string;
3600
+ id: string;
3601
+ sizeBytes: number;
3602
+ verifiable: boolean;
3603
+ }[];
3604
+ /** The task the model serves, as `CatalogRole` names it. */
3605
+ role: string;
3606
+ format: string;
3607
+ /** For an adapter: model ids from a Server, card ids from the platform. */
3608
+ fits?: string[];
3609
+ /** Why the file cannot be pulled, in the Server's words. */
3610
+ reason?: string;
3611
+ }
3612
+ /** `GET /control/discover?task=&q=&sort=` answers the repositories of one
3613
+ * task that `q` matches, or with no `q` the whole set, at most 30, as
3614
+ * `HubRepository[]`; and `GET /control/discover/{owner}/{repo}` one
3615
+ * repository as `HubListing`: the files a runtime of the Server runs, how
3616
+ * many files it publishes in all, so a repository whose listing yields
3617
+ * no candidate is one no runtime there runs, and every file a pull of
3618
+ * another repository's model can name as a companion. Both read Hugging
3619
+ * Face on a person's act and on nothing else, and with no token, so they
3620
+ * reach the public repositories alone; the Server's own window reads the
3621
+ * same answers from `/local/discover`, with the token the person stored. */
3622
+ interface HubListing {
3623
+ repo: string;
3624
+ model: HubRepository;
3625
+ files: number;
3626
+ /** The path of the file a press takes, where one can be taken. */
3627
+ fileToTake: string | null;
3628
+ candidates: HubCandidate[];
3629
+ companions: CompanionOption[];
3630
+ capabilities: {
3631
+ vision: boolean;
3632
+ tools: boolean;
3633
+ reasoning: boolean;
3634
+ tasks: string[];
3635
+ };
3636
+ }
3637
+
3413
3638
  /**
3414
3639
  * The view bridge: what a view, an app's UI in a sandboxed frame, and its
3415
3640
  * host say to each other beyond the MCP Apps standard the view speaks.
@@ -3644,8 +3869,8 @@ interface HostSlot {
3644
3869
  project?: string;
3645
3870
  /** On a `chat` or `composer` slot: false draws the composer with no
3646
3871
  * model picker, for an app whose models are chosen only on its page in
3647
- * Settings; the rest of the composer's footer keeps its place. Absent,
3648
- * the composer shows the picker. */
3872
+ * Settings; the thinking level and the rest of the composer's footer
3873
+ * keep their places. Absent, the composer shows the picker. */
3649
3874
  modelPicker?: boolean;
3650
3875
  /** On a `terminal` slot: the folder its shell starts in, inside a folder
3651
3876
  * the person gave the view's app. The slot's id, letters, digits, `-`
@@ -4694,6 +4919,15 @@ interface ViewExtensionMethods {
4694
4919
  };
4695
4920
  result: Empty;
4696
4921
  };
4922
+ /** A search of the device's file index: the documents the app put and
4923
+ * the files of every place the app may read now, or of the one place
4924
+ * `place` names; the hits best first, and each leg that could not run
4925
+ * with the reason. */
4926
+ 'hearthscale/index/search': {
4927
+ uses: 'index';
4928
+ params: IndexSearchRequest;
4929
+ result: IndexSearch;
4930
+ };
4697
4931
  }
4698
4932
  type ViewExtensionMethod = keyof ViewExtensionMethods;
4699
4933
  /** The notifications the host sends a view, each only to a view whose app
@@ -5341,8 +5575,8 @@ interface AppContext {
5341
5575
  reason: string;
5342
5576
  }) => void): () => void;
5343
5577
  };
5344
- /** With `index` in `uses`: the shared index, where the app finds again
5345
- * what it put and the text files of the places it watches. */
5578
+ /** With `index` in `uses`: the device's index, where the app finds
5579
+ * again what it put and the files of every place it may read. */
5346
5580
  index: {
5347
5581
  /** Puts a document in place of what was put under its source;
5348
5582
  * answers how many passages it holds. */
@@ -5350,14 +5584,15 @@ interface AppContext {
5350
5584
  /** Answers whether there was a document under the source. */
5351
5585
  remove(source: string): Promise<boolean>;
5352
5586
  /** The passages that best answer the query, best first; ten unless
5353
- * a limit is named. */
5587
+ * a limit is named. A passage of a file has the file's absolute path
5588
+ * as its source. */
5354
5589
  search(query: string, limit?: number): Promise<IndexHit[]>;
5355
- /** Indexes every text file at or under a path of a mount, under the
5356
- * source `file:<mount>/<path>`, and again whenever one changes, also
5357
- * after a restart while the app may read the path. */
5590
+ /** Asks for a folder of a mount as a place of the device's index:
5591
+ * the person sees it among the places, and every app that may read
5592
+ * it finds its files. The place stays while the app may read it. */
5358
5593
  watch(path: MountPath): Promise<void>;
5359
- /** Stops a watch and removes what it indexed; answers whether there
5360
- * was one. */
5594
+ /** Lets go of a place the app asked for; answers whether it had
5595
+ * asked. The place goes once nobody holds it. */
5361
5596
  unwatch(path: MountPath): Promise<boolean>;
5362
5597
  };
5363
5598
  /** With `notifications` in `uses`: a system notification. A press
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hearthscale/app",
3
- "version": "0.3.0",
3
+ "version": "0.4.0-rc.1",
4
4
  "description": "The types a Hearthscale app's backend and views import: the backend's exports and context, the view's host methods, extensions and slots; and the typed call of a view's requests.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -39,7 +39,7 @@
39
39
  "rollup": "^4.62.2",
40
40
  "rollup-plugin-dts": "^6.5.1",
41
41
  "typescript": "^5.6.3",
42
- "@hearthscale/contract": "0.3.0"
42
+ "@hearthscale/contract": "0.4.0-rc.1"
43
43
  },
44
44
  "scripts": {
45
45
  "build": "node scripts/build.mjs",