@moss-js/moss 1.8.0

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.txt ADDED
@@ -0,0 +1,168 @@
1
+ Copyright (c) 2025 InferEdge Inc.
2
+ Required Notice: Copyright InferEdge Inc. (https://inferedge.dev)
3
+ Licensor Line of Business: InferEdge MOSS Runtime (https://inferedge.dev)
4
+
5
+ # PolyForm Shield License 1.0.0
6
+
7
+ <https://polyformproject.org/licenses/shield/1.0.0>
8
+
9
+ ## Acceptance
10
+
11
+ In order to get any license under these terms, you must agree
12
+ to them as both strict obligations and conditions to all
13
+ your licenses.
14
+
15
+ ## Copyright License
16
+
17
+ The licensor grants you a copyright license for the
18
+ software to do everything you might do with the software
19
+ that would otherwise infringe the licensor's copyright
20
+ in it for any permitted purpose. However, you may
21
+ only distribute the software according to [Distribution
22
+ License](#distribution-license) and make changes or new works
23
+ based on the software according to [Changes and New Works
24
+ License](#changes-and-new-works-license).
25
+
26
+ ## Distribution License
27
+
28
+ The licensor grants you an additional copyright license
29
+ to distribute copies of the software. Your license
30
+ to distribute covers distributing the software with
31
+ changes and new works permitted by [Changes and New Works
32
+ License](#changes-and-new-works-license).
33
+
34
+ ## Notices
35
+
36
+ You must ensure that anyone who gets a copy of any part of
37
+ the software from you also gets a copy of these terms or the
38
+ URL for them above, as well as copies of any plain-text lines
39
+ beginning with `Required Notice:` that the licensor provided
40
+ with the software. For example:
41
+
42
+ > Required Notice: Copyright Yoyodyne, Inc. (http://example.com)
43
+
44
+ ## Changes and New Works License
45
+
46
+ The licensor grants you an additional copyright license to
47
+ make changes and new works based on the software for any
48
+ permitted purpose.
49
+
50
+ ## Patent License
51
+
52
+ The licensor grants you a patent license for the software that
53
+ covers patent claims the licensor can license, or becomes able
54
+ to license, that you would infringe by using the software.
55
+
56
+ ## Noncompete
57
+
58
+ Any purpose is a permitted purpose, except for providing any
59
+ product that competes with the software or any product the
60
+ licensor or any of its affiliates provides using the software.
61
+
62
+ ## Competition
63
+
64
+ Goods and services compete even when they provide functionality
65
+ through different kinds of interfaces or for different technical
66
+ platforms. Applications can compete with services, libraries
67
+ with plugins, frameworks with development tools, and so on,
68
+ even if they're written in different programming languages
69
+ or for different computer architectures. Goods and services
70
+ compete even when provided free of charge. If you market a
71
+ product as a practical substitute for the software or another
72
+ product, it definitely competes.
73
+
74
+ ## New Products
75
+
76
+ If you are using the software to provide a product that does
77
+ not compete, but the licensor or any of its affiliates brings
78
+ your product into competition by providing a new version of
79
+ the software or another product using the software, you may
80
+ continue using versions of the software available under these
81
+ terms beforehand to provide your competing product, but not
82
+ any later versions.
83
+
84
+ ## Discontinued Products
85
+
86
+ You may begin using the software to compete with a product
87
+ or service that the licensor or any of its affiliates has
88
+ stopped providing, unless the licensor includes a plain-text
89
+ line beginning with `Licensor Line of Business:` with the
90
+ software that mentions that line of business. For example:
91
+
92
+ > Licensor Line of Business: YoyodyneCMS Content Management
93
+ System (http://example.com/cms)
94
+
95
+ ## Sales of Business
96
+
97
+ If the licensor or any of its affiliates sells a line of
98
+ business developing the software or using the software
99
+ to provide a product, the buyer can also enforce
100
+ [Noncompete](#noncompete) for that product.
101
+
102
+ ## Fair Use
103
+
104
+ You may have "fair use" rights for the software under the
105
+ law. These terms do not limit them.
106
+
107
+ ## No Other Rights
108
+
109
+ These terms do not allow you to sublicense or transfer any of
110
+ your licenses to anyone else, or prevent the licensor from
111
+ granting licenses to anyone else. These terms do not imply
112
+ any other licenses.
113
+
114
+ ## Patent Defense
115
+
116
+ If you make any written claim that the software infringes or
117
+ contributes to infringement of any patent, your patent license
118
+ for the software granted under these terms ends immediately. If
119
+ your company makes such a claim, your patent license ends
120
+ immediately for work on behalf of your company.
121
+
122
+ ## Violations
123
+
124
+ The first time you are notified in writing that you have
125
+ violated any of these terms, or done anything with the software
126
+ not covered by your licenses, your licenses can nonetheless
127
+ continue if you come into full compliance with these terms,
128
+ and take practical steps to correct past violations, within
129
+ 32 days of receiving notice. Otherwise, all your licenses
130
+ end immediately.
131
+
132
+ ## No Liability
133
+
134
+ ***As far as the law allows, the software comes as is, without
135
+ any warranty or condition, and the licensor will not be liable
136
+ to you for any damages arising out of these terms or the use
137
+ or nature of the software, under any kind of legal claim.***
138
+
139
+ ## Definitions
140
+
141
+ The **licensor** is the individual or entity offering these
142
+ terms, and the **software** is the software the licensor makes
143
+ available under these terms.
144
+
145
+ A **product** can be a good or service, or a combination
146
+ of them.
147
+
148
+ **You** refers to the individual or entity agreeing to these
149
+ terms.
150
+
151
+ **Your company** is any legal entity, sole proprietorship,
152
+ or other kind of organization that you work for, plus all
153
+ its affiliates.
154
+
155
+ **Affiliates** means the other organizations than an
156
+ organization has control over, is under the control of, or is
157
+ under common control with.
158
+
159
+ **Control** means ownership of substantially all the assets of
160
+ an entity, or the power to direct its management and policies
161
+ by vote, contract, or otherwise. Control can be direct or
162
+ indirect.
163
+
164
+ **Your licenses** are all the licenses granted to you for the
165
+ software under these terms.
166
+
167
+ **Use** means anything you do with the software requiring one
168
+ of your licenses.
package/README.md ADDED
@@ -0,0 +1,258 @@
1
+ # Moss client library for JavaScript
2
+
3
+
4
+ `@moss-js/moss` enables **private, on-device semantic search** in your web, mobile, and edge applications - without cloud dependencies.
5
+
6
+ Built for developers who want **instant, memory-efficient, privacy-first AI features** inside their apps.
7
+
8
+ ## ✨ Features
9
+
10
+ - ⚡ **On-Device Vector Search** - Sub-millisecond retrieval with zero network latency
11
+ - 🔍 **Semantic Search & Hybrid Search** - Beyond keyword matching
12
+ - 📦 **Multi-Index Support** - Manage multiple isolated search spaces
13
+ - 🛠️ **Tiny SDK** - Optimized for edge deployments
14
+ - 🛡️ **Privacy-First by Design** - No server-side cloud calls required to perform searches
15
+
16
+ ## 📦 Installation
17
+
18
+ ```bash
19
+ npm install @moss-js/moss
20
+ ```
21
+
22
+ ## 🚀 Quick Start
23
+
24
+ ```typescript
25
+ import { MossClient, DocumentInfo } from "@moss-js/moss";
26
+
27
+ async function main() {
28
+ // Initialize search client with project credentials
29
+ const mossClient = new MossClient(
30
+ "your-project-id",
31
+ "your-project-key"
32
+ );
33
+
34
+ // Prepare documents to index
35
+ const documents: DocumentInfo[] = [
36
+ {
37
+ id: "doc1",
38
+ text: "How do I track my order? You can track your order by logging into your account.",
39
+ },
40
+ {
41
+ id: "doc2",
42
+ text: "What is your return policy? We offer a 30-day return policy for most items.",
43
+ },
44
+ {
45
+ id: "doc3",
46
+ text: "How can I change my shipping address? Contact our customer service team.",
47
+ },
48
+ // Add more documents here
49
+ // .
50
+ // .
51
+ // .
52
+ ];
53
+
54
+ try {
55
+ // Create an index with documents and model
56
+ const indexName = "faqs";
57
+ const created = await mossClient.createIndex(
58
+ indexName,
59
+ documents
60
+ ); // Defaults to the service's `moss-minilm` model when omitted
61
+ console.log("Index created:", created);
62
+
63
+ // Load the index before searching
64
+ await mossClient.loadIndex(indexName);
65
+
66
+ // Search the index
67
+ const result = await mossClient.query(indexName, "How do I return a damaged product?", {
68
+ topK: 3,
69
+ });
70
+
71
+ // Display results
72
+ console.log(`Query: ${result.query}`);
73
+ result.docs.forEach((match) => {
74
+ console.log(`Score: ${match.score.toFixed(4)}`);
75
+ console.log(`ID: ${match.id}`);
76
+ console.log(`Text: ${match.text}`);
77
+ console.log("---");
78
+ });
79
+ } finally {
80
+ // Release the client's underlying resources once you're done with it
81
+ await mossClient.close();
82
+ }
83
+ }
84
+
85
+ main().catch(console.error);
86
+ ```
87
+
88
+ To use a host-managed stable id for MAD billing while retaining Moss's own
89
+ device UUID for correlation:
90
+
91
+ ```typescript
92
+ const mossClient = new MossClient("project", "key", {
93
+ identity: { deviceId: "host-installation-id", userId: "optional-user-id" },
94
+ });
95
+ ```
96
+
97
+ `deviceId` is billable. `userId` is optional and non-billable. Telemetry also
98
+ includes Moss's file-backed UUID as `mossDeviceId`; without a host id, both
99
+ device fields contain that Moss UUID.
100
+
101
+ ## Resource cleanup
102
+
103
+ `MossClient` and sessions returned by `client.session(...)` hold native resources that must be released explicitly. Call `close()` on each one when you are done with it, in a `finally` block or equivalent. `close()` is idempotent, so it is safe to call more than once.
104
+
105
+ `client.close()` also closes every live session created from that client. Closing a session individually first is fine; `close()` is idempotent on both.
106
+
107
+ On Node 24 and later, both `MossClient` and sessions implement `Symbol.asyncDispose`, so you can use `await using` instead of a manual `try/finally`:
108
+
109
+ ```typescript
110
+ await using mossClient = new MossClient("your-project-id", "your-project-key");
111
+ // mossClient.close() is called automatically when it goes out of scope
112
+ ```
113
+
114
+ ## 🔥 Example Use Cases
115
+
116
+ - Smart knowledge base search
117
+ - Realtime Voice AI agents
118
+ - Personal note-taking search
119
+ - Private in-app AI features (recommendations, retrieval)
120
+ - Local semantic search in edge devices, AR/VR, mobile apps
121
+
122
+ ## 🧠 Providing custom embeddings
123
+
124
+ Already using your own embedding model? Supply vectors directly when managing indexes:
125
+
126
+ ```typescript
127
+ const documents = [
128
+ {
129
+ id: "doc-1",
130
+ text: "Attach a caller-provided embedding",
131
+ embedding: myEmbeddingModel("doc-1"),
132
+ },
133
+ {
134
+ id: "doc-2",
135
+ text: "Fallback to the built-in model when the field is omitted.",
136
+ },
137
+ ];
138
+
139
+ await mossClient.createIndex("custom-embeddings", documents);
140
+
141
+ await mossClient.loadIndex("custom-embeddings");
142
+
143
+ const results = await mossClient.query("custom-embeddings", "", {
144
+ embedding: myEmbeddingModel("query"),
145
+ topK: 10,
146
+ });
147
+ ```
148
+
149
+ Leaving `modelId` undefined defaults to `moss-minilm`. You can still pass `{ modelId: "moss-mediumlm" }` or another supported identifier if you want the service to generate embeddings for documents without the optional `embedding` field.
150
+
151
+ ### Foundation model identity
152
+
153
+ Moss generates local query embeddings for a foundation-model index only when
154
+ the service supplies the exact immutable model artifact identity used to build
155
+ that index. This prevents a query from being embedded with different model
156
+ bytes than the stored document vectors.
157
+
158
+ Fresh local sessions using `moss-minilm`, `moss-mediumlm`, or `moss-litelm`
159
+ bind that model's official current artifact automatically before model warmup.
160
+ Caller-supplied artifact identities are validated and kept, while custom models
161
+ are never auto-bound. `saveToDisk` records the exact model id, artifact version,
162
+ and manifest SHA-256, so the same session can be restored and queried with raw
163
+ text:
164
+
165
+ ```typescript
166
+ const first = await mossClient.session("memory");
167
+ await first.addDocs([{ id: "refund", text: "Customer requested a refund" }]);
168
+ await first.saveToDisk(cachePath);
169
+ await first.close();
170
+
171
+ const restored = await mossClient.session("memory");
172
+ await restored.loadFromDisk(cachePath);
173
+ const results = await restored.query("refund");
174
+ ```
175
+
176
+ Session caches created by older SDKs without an artifact version and manifest
177
+ SHA-256 load as `custom` sessions through the legacy fail-closed path. Their raw
178
+ text queries require an explicit caller-generated embedding. Rebuild those
179
+ caches from their source documents with the current SDK, then save them again
180
+ so the automatically bound foundation identity is persisted.
181
+
182
+ Older indexes without that identity still load and remain queryable, but the
183
+ query must include a caller-generated vector of the correct dimension:
184
+
185
+ ```typescript
186
+ const results = await mossClient.query("legacy-index", "search text", {
187
+ embedding: myEmbeddingModel("search text"),
188
+ topK: 10,
189
+ });
190
+ ```
191
+
192
+ If the vector is omitted, the query fails closed with an error stating that an
193
+ explicit query embedding is required. Moss does not silently fall back to an
194
+ unverified local model or send the query to the cloud.
195
+
196
+ ## Multi-index search
197
+
198
+ Search several loaded indexes in one call and get the global top-k back, with
199
+ each result tagged by its source `indexName`. All indexes must be loaded
200
+ locally and share the same embedding model.
201
+
202
+ ```typescript
203
+ const { loaded, failed } = await mossClient.loadIndexes(["products", "reviews"]);
204
+ if (loaded.length === 0) {
205
+ throw new Error(`No indexes loaded: ${JSON.stringify(failed)}`);
206
+ }
207
+
208
+ const results = await mossClient.queryMultiIndex(
209
+ loaded,
210
+ "noise cancelling headphones",
211
+ { topK: 5, alpha: 0.5 },
212
+ );
213
+ for (const doc of results.docs) {
214
+ console.log(`[${doc.indexName}] ${doc.id}: ${doc.text} (score: ${doc.score.toFixed(3)})`);
215
+ }
216
+
217
+ await mossClient.unloadIndexes(loaded);
218
+ ```
219
+
220
+ `alpha` works exactly as in `query` (default 0.8): `1.0` is embedding-only,
221
+ `0.0` is keyword-only, and anything in between blends both with Reciprocal
222
+ Rank Fusion. Keyword scoring runs each index's own BM25 and merges each index's
223
+ raw hits before fusion; because BM25 statistics stay per-corpus, cross-index
224
+ keyword ranking is approximate. `topK` (default 10) caps the merged result, not
225
+ each index, and `filter` applies to every index. `loadIndexes` is best-effort:
226
+ names that fail are reported in `failed` without rolling back the ones that
227
+ loaded.
228
+
229
+ ## Metadata filtering
230
+
231
+ You can pass a metadata filter in `query` options after loading an index locally:
232
+
233
+ ```typescript
234
+ const results = await mossClient.query("my-docs", "running shoes", {
235
+ topK: 5,
236
+ alpha: 0.6,
237
+ filter: {
238
+ $and: [
239
+ { field: "category", condition: { $eq: "shoes" } },
240
+ { field: "price", condition: { $lt: "100" } },
241
+ ],
242
+ },
243
+ });
244
+ ```
245
+
246
+ For a complete runnable example, see `javascript/user-facing-sdk/samples/metadata-filtering.ts`.
247
+
248
+ ## 📄 License
249
+
250
+ This package is licensed under the [PolyForm Shield License 1.0.0](./LICENSE.txt).
251
+
252
+ - ✅ Free for testing, evaluation, internal use, and modifications.
253
+ - ❌ Not permitted for production or competing commercial use.
254
+ - 📩 For commercial licenses, contact: <contact@inferedge.dev>
255
+
256
+ ## 📬 Contact
257
+
258
+ For support, commercial licensing, or partnership inquiries, contact us: [contact@inferedge.dev](mailto:contact@inferedge.dev)
@@ -0,0 +1 @@
1
+ const _0x310639=_0xc99c;(function(_0x2c71b3,_0x32fbcb){const _0x525940=_0xc99c,_0x36d657=_0x2c71b3();while(!![]){try{const _0x288ade=-parseInt(_0x525940(0x111))/0x1*(-parseInt(_0x525940(0x130))/0x2)+-parseInt(_0x525940(0x11c))/0x3+-parseInt(_0x525940(0x14f))/0x4*(-parseInt(_0x525940(0x146))/0x5)+-parseInt(_0x525940(0x174))/0x6+parseInt(_0x525940(0x153))/0x7+parseInt(_0x525940(0x15a))/0x8+-parseInt(_0x525940(0x105))/0x9;if(_0x288ade===_0x32fbcb)break;else _0x36d657['push'](_0x36d657['shift']());}catch(_0x5ab3d6){_0x36d657['push'](_0x36d657['shift']());}}}(_0x5ac6,0x82534));import{JobStatus as _0x3d66c2}from'@moss-js/moss-core';import*as _0x4323ad from'@moss-js/moss-core';import*as _0x145da4 from'@moss-js/moss-core';var p=_0x145da4,le=p['MODEL_DOWNLOAD_URL'],ce=p[_0x310639(0xcc)],me=p[_0x310639(0xd1)],O=p[_0x310639(0x11e)],he=typeof process<'u'&&process[_0x310639(0x173)]['MOSS_INDEX_URL']||p[_0x310639(0xe7)],E=typeof process<'u'?process[_0x310639(0x173)]:{},I=class{constructor(_0x47df0e,_0x3fc338){const _0x12d412=_0x310639;this[_0x12d412(0xd8)]=_0x47df0e,this['projectKey']=_0x3fc338,this['authUrl']=E[_0x12d412(0xda)]??O;}[_0x310639(0xd8)];[_0x310639(0x131)];[_0x310639(0x13e)];async[_0x310639(0x118)](){const _0x1a4b6d=_0x310639;let _0x2d3787=await fetch(this[_0x1a4b6d(0x13e)],{'method':'POST','headers':{'Content-Type':'application/json'},'body':JSON[_0x1a4b6d(0xf9)]({'projectId':this[_0x1a4b6d(0xd8)],'projectKey':this[_0x1a4b6d(0x131)]}),'signal':AbortSignal[_0x1a4b6d(0x180)](0x7530)});if(_0x2d3787[_0x1a4b6d(0x141)]===0x191){let _0x1e15ae=await _0x2d3787['text']();throw new Error(_0x1a4b6d(0x16d)+_0x1e15ae);}if(!_0x2d3787['ok']){let _0x5e8bc4=await _0x2d3787['text']();throw new Error(_0x1a4b6d(0x138)+_0x2d3787[_0x1a4b6d(0x141)]+':\x20'+_0x5e8bc4);}let _0x7d8167=await _0x2d3787[_0x1a4b6d(0xf2)]();return{'token':_0x7d8167[_0x1a4b6d(0xfd)],'expiresIn':_0x7d8167[_0x1a4b6d(0x17e)]};}async[_0x310639(0x181)](){const _0x4537ee=_0x310639;let {token:_0x937e6c}=await this['getAuthToken']();return _0x4537ee(0x134)+_0x937e6c;}},f=class{constructor(_0x524cbc){const _0x1aa186=_0x310639;this[_0x1aa186(0x14b)]=_0x524cbc;}[_0x310639(0x14b)];['cache']=null;[_0x310639(0x13d)]=null;async[_0x310639(0x118)](){const _0x2a3964=_0x310639;if(this[_0x2a3964(0x166)]&&this[_0x2a3964(0x166)]['expiresAt']>Date['now']())return{'token':this[_0x2a3964(0x166)][_0x2a3964(0xfd)],'expiresIn':this[_0x2a3964(0x166)]['expiresIn']};if(this[_0x2a3964(0x13d)])return this[_0x2a3964(0x13d)];this[_0x2a3964(0x13d)]=this[_0x2a3964(0x17c)]();try{return await this[_0x2a3964(0x13d)];}finally{this[_0x2a3964(0x13d)]=null;}}async['getAuthHeader'](){const _0x33ea40=_0x310639;let {token:_0x2b77cd}=await this[_0x33ea40(0x118)]();return _0x33ea40(0x134)+_0x2b77cd;}async['fetchAndCache'](){const _0x43adee=_0x310639;let {token:_0x28d0a7,expiresIn:_0x2cfc9c}=await this[_0x43adee(0x14b)][_0x43adee(0x118)](),_0xf34ec=Date[_0x43adee(0x15f)]()+(_0x2cfc9c-0x3c)*0x3e8;return this[_0x43adee(0x166)]={'token':_0x28d0a7,'expiresIn':_0x2cfc9c,'expiresAt':_0xf34ec},{'token':_0x28d0a7,'expiresIn':_0x2cfc9c};}};import{randomUUID as _0x45dc8a}from'node:crypto';import{existsSync as _0x3074b4,mkdirSync as _0x5f097b,readFileSync as _0xfad778,writeFileSync as _0x417842}from'node:fs';import{homedir as _0x35574e}from'node:os';import{join as _0x1c1cc0,resolve as _0x5261e2}from'node:path';var ee=_0x310639(0xeb),te='.moss',b=0x100,q=/[\p{Cc}\p{Cf}\p{Cs}\uFFFD]/u,L=_0x310639(0xec);function ne(_0x10e0be){const _0x12a8a0=_0x310639;return _0x10e0be['length']>0x0&&_0x10e0be[_0x12a8a0(0x112)]()===_0x10e0be&&!q['test'](_0x10e0be)&&new TextEncoder()[_0x12a8a0(0xc7)](_0x10e0be)[_0x12a8a0(0x17f)]<=b;}function re(_0x328b25){const _0x358584=_0x310639;try{let _0x4e5456=_0x5261e2(_0x328b25),_0x1b16fc=_0x1c1cc0(_0x4e5456,ee);if(_0x3074b4(_0x1b16fc)){let _0x242257=_0xfad778(_0x1b16fc,_0x358584(0x156))['trim']();if(ne(_0x242257))return _0x242257;}_0x5f097b(_0x4e5456,{'recursive':!0x0});let _0x5ee1ab=_0x45dc8a();return _0x417842(_0x1b16fc,_0x5ee1ab,'utf8'),_0x5ee1ab;}catch{return _0x45dc8a();}}function se(_0x5d6e22=process[_0x310639(0x173)]){const _0x23c238=_0x310639;let _0x26414b=_0x5d6e22[_0x23c238(0x17d)]?.[_0x23c238(0x112)]()||_0x5d6e22[_0x23c238(0x148)]?.['trim']()||_0x35574e();return _0x1c1cc0(_0x26414b,te);}function k(_0x25148a,_0x40e772){const _0x2b51d9=_0x310639;if(_0x25148a!==void 0x0){if(typeof _0x25148a!='string'||_0x25148a[_0x2b51d9(0x137)]===0x0)throw new TypeError(_0x2b51d9(0x109)+_0x40e772+_0x2b51d9(0x117));if(_0x25148a['trim']()!==_0x25148a)throw new TypeError('MossClient\x20options.identity.'+_0x40e772+_0x2b51d9(0x149));if(q[_0x2b51d9(0xd7)](_0x25148a))throw new TypeError('MossClient\x20options.identity.'+_0x40e772+'\x20contains\x20an\x20unsupported\x20character');if(new TextEncoder()['encode'](_0x25148a)[_0x2b51d9(0x17f)]>b)throw new TypeError(_0x2b51d9(0x109)+_0x40e772+_0x2b51d9(0xdf)+b+'\x20UTF-8\x20bytes');return _0x25148a;}}function F(_0x389d30){const _0x3c68b9=_0x310639;if(_0x389d30!==void 0x0){if(_0x389d30===null||typeof _0x389d30!='object'||Array[_0x3c68b9(0x179)](_0x389d30))throw new TypeError(_0x3c68b9(0x145));return Object[_0x3c68b9(0x161)]({'deviceId':k(_0x389d30[_0x3c68b9(0x10f)],_0x3c68b9(0x10f)),'userId':k(_0x389d30['userId'],_0x3c68b9(0xca))});}}function M(_0xabd57c){const _0x13d516=_0x310639;return _0xabd57c?.['deviceId']!==void 0x0||_0xabd57c?.[_0x13d516(0xca)]!==void 0x0;}function j(_0x23197a){const _0x5256ab=_0x310639;if(typeof _0x23197a['setIdentity']!=_0x5256ab(0xf7))throw new Error(L);}function oe(_0x3f2945,_0x2e169a,_0x3f2b4f=process[_0x310639(0x173)]){const _0xe0ed5e=_0x310639;if(_0x3f2945['id'])return _0x3f2945['id'];let _0x4de7d0=_0x2e169a?.[_0xe0ed5e(0x112)]()?_0x2e169a:se(_0x3f2b4f);return _0x3f2945['id']=re(_0x4de7d0),_0x3f2945['id'];}function ie(_0x252057,_0x2bb7fb){const _0x4a2b78=_0x310639;if(typeof _0x252057[_0x4a2b78(0x178)]!=_0x4a2b78(0xf7))return!0x0;try{return _0x252057[_0x4a2b78(0x178)](_0x2bb7fb),!0x0;}catch{return!0x1;}}function v(_0x4b1b10,_0x2cf131,_0x5edca5,_0x4d0fdd=process['env']){const _0x912a12=_0x310639;let _0x4d5aa7=oe(_0x4b1b10,_0x5edca5,_0x4d0fdd);return{'deviceId':_0x2cf131?.[_0x912a12(0x10f)]??_0x4d5aa7,'hostDeviceId':_0x2cf131?.[_0x912a12(0x10f)],'mossDeviceId':_0x4d5aa7,'userId':_0x2cf131?.[_0x912a12(0xca)],'callerSupplied':M(_0x2cf131)};}function P(_0x3fe071,_0xbef8e9){const _0x15c05a=_0x310639;if(typeof _0x3fe071[_0x15c05a(0x17b)]!='function'){if(_0xbef8e9[_0x15c05a(0xe0)])throw new Error(L);return ie(_0x3fe071,_0xbef8e9[_0x15c05a(0x10f)]);}if(!_0xbef8e9[_0x15c05a(0xe0)])try{return _0x3fe071['setIdentity'](null,null,_0xbef8e9[_0x15c05a(0xde)]),!0x0;}catch{return!0x1;}return _0x3fe071[_0x15c05a(0x17b)](_0xbef8e9[_0x15c05a(0xd0)]??null,_0xbef8e9[_0x15c05a(0xca)]??null,_0xbef8e9['mossDeviceId']),!0x0;}function _0xc99c(_0x419c90,_0xef20d9){_0x419c90=_0x419c90-0xc3;const _0x5ac6ba=_0x5ac6();let _0xc99c98=_0x5ac6ba[_0x419c90];return _0xc99c98;}function N(_0x3261f1,_0xef460b,_0x27e018,_0x3d229e,_0xc9b572=process[_0x310639(0x173)]){const _0x294a71=_0x310639;_0xef460b[_0x294a71(0x170)]||(_0xef460b['applied']=P(_0x3261f1,v(_0xef460b,_0x27e018,_0x3d229e,_0xc9b572)));}var ae=0x1;function y(_0x16c0e7){const _0x58a586=_0x310639;let _0x378cdf=_0x16c0e7[_0x58a586(0x124)];if(typeof _0x378cdf!=_0x58a586(0xf7))throw J();let _0x76d7eb=_0x378cdf['call'](_0x16c0e7);if(!Number[_0x58a586(0x186)](_0x76d7eb)||_0x76d7eb<ae)throw J();}function J(){const _0x175017=_0x310639;return new Error(_0x175017(0x172));}var ve=0x708*0x3e8;function A(_0x5996ac){const _0x343264=_0x310639;return _0x5996ac instanceof Error?_0x5996ac[_0x343264(0xf5)]:String(_0x5996ac);}function de(_0x301d55){const _0x3a7aad=_0x310639;if(_0x301d55===null||typeof _0x301d55!=_0x3a7aad(0xf3))return'received\x20'+String(_0x301d55);if(Array[_0x3a7aad(0x179)](_0x301d55))return _0x3a7aad(0x136);let _0x31c9f1=_0x301d55;return typeof _0x31c9f1[_0x3a7aad(0x16a)]!=_0x3a7aad(0x13a)||_0x31c9f1[_0x3a7aad(0x16a)][_0x3a7aad(0x137)]===0x0?_0x3a7aad(0x16b)+String(_0x31c9f1[_0x3a7aad(0x16a)])+')':typeof _0x31c9f1[_0x3a7aad(0x141)]!='string'||_0x31c9f1['status']['length']===0x0?_0x3a7aad(0x133)+String(_0x31c9f1[_0x3a7aad(0x141)])+')':typeof _0x31c9f1[_0x3a7aad(0x100)]!='number'||!Number['isFinite'](_0x31c9f1['progress'])?'received\x20a\x20progress\x20event\x20with\x20a\x20non-finite\x20progress\x20value\x20('+String(_0x31c9f1[_0x3a7aad(0x100)])+')':_0x31c9f1[_0x3a7aad(0xd3)]!==void 0x0&&_0x31c9f1[_0x3a7aad(0xd3)]!==null&&typeof _0x31c9f1[_0x3a7aad(0xd3)]!=_0x3a7aad(0x13a)?_0x3a7aad(0x115)+String(_0x31c9f1[_0x3a7aad(0xd3)])+')':null;}var x=class{[_0x310639(0x101)];[_0x310639(0xef)];[_0x310639(0xc5)];[_0x310639(0xc6)]={'applied':!0x1};['deviceIdCachePath'];['configuredIdentity'];['projectId'];['authNotifyFn'];constructor(_0xdb781e,_0x15d847,_0x231cbf){const _0x41ff0b=_0x310639;this[_0x41ff0b(0xfb)]=F(_0x231cbf?.[_0x41ff0b(0x110)]),this[_0x41ff0b(0x160)]=_0x231cbf?.[_0x41ff0b(0x177)],this[_0x41ff0b(0xd8)]=_0xdb781e;let _0x40062a=typeof _0x15d847==_0x41ff0b(0x13a)?new I(_0xdb781e,_0x15d847):_0x15d847;this[_0x41ff0b(0x101)]=new f(_0x40062a);let _0x48e383=_0x4323ad,_0x32a733=_0x48e383['ManageClient']??_0x48e383[_0x41ff0b(0x165)]?.['ManageClient'],_0x52b544=_0x48e383[_0x41ff0b(0x15d)]??_0x48e383[_0x41ff0b(0x165)]?.[_0x41ff0b(0x15d)];if(!_0x32a733||!_0x52b544)throw new Error('moss-core\x20runtime\x20is\x20missing\x20ManageClient/IndexManager\x20exports');if(typeof _0x15d847=='string')this[_0x41ff0b(0xef)]=new _0x32a733(_0xdb781e,_0x15d847),this[_0x41ff0b(0xc5)]=new _0x52b544(_0xdb781e,_0x15d847);else{let _0x51cc78=_0x48e383['resolveAuthRequest']??_0x48e383['default']?.[_0x41ff0b(0x12b)],_0x37c9de=_0x48e383[_0x41ff0b(0xd6)]??_0x48e383[_0x41ff0b(0x165)]?.[_0x41ff0b(0xd6)];if(!_0x51cc78||!_0x37c9de)throw new Error(_0x41ff0b(0x102));let _0x2942ed=this[_0x41ff0b(0x101)],_0x26c3b1=(_0x2b869e,_0x4a40df)=>{const _0x8609=_0x41ff0b;try{_0x37c9de(_0x2b869e,_0x4a40df);}catch(_0x18c46e){console['warn'](_0x8609(0x168)+_0x2b869e+'\x20could\x20not\x20be\x20settled:\x20'+A(_0x18c46e));}},_0x1926b5=(_0x4bda70,_0x89e129)=>{const _0x208bb7=_0x41ff0b;try{_0x51cc78(_0x4bda70,_0x89e129);}catch(_0x3e6be6){_0x26c3b1(_0x4bda70,_0x208bb7(0x119)+A(_0x3e6be6));}},_0x3da6b7=!0x1,_0x5620fe=(_0x55e3fb,_0x2e88ab)=>{const _0x3ccc2e=_0x41ff0b;if(_0x55e3fb||!Number[_0x3ccc2e(0x186)](_0x2e88ab)||_0x2e88ab<0x0){_0x3da6b7||(_0x3da6b7=!0x0,console[_0x3ccc2e(0x16f)]('[moss]\x20Ignoring\x20an\x20auth\x20request\x20with\x20no\x20usable\x20request\x20id;\x20custom\x20authentication\x20may\x20be\x20unavailable\x20for\x20this\x20client.\x20Cause:\x20'+(_0x55e3fb?_0x55e3fb[_0x3ccc2e(0xf5)]:'received\x20'+String(_0x2e88ab))));return;}_0x2942ed[_0x3ccc2e(0x181)]()[_0x3ccc2e(0x107)](_0x48fba0=>{const _0x31f65c=_0x3ccc2e;let _0x470199=_0x48fba0[_0x31f65c(0x144)](_0x31f65c(0x134))?_0x48fba0[_0x31f65c(0x16e)](0x7):_0x48fba0;_0x1926b5(_0x2e88ab,_0x470199);},_0x39ce54=>_0x26c3b1(_0x2e88ab,A(_0x39ce54)));};this[_0x41ff0b(0xce)]=_0x5620fe;let _0x54d5a6=_0x32a733,_0x5d9c9f=_0x52b544;if(!_0x54d5a6[_0x41ff0b(0x128)]||!_0x5d9c9f['withAuthenticator'])throw new Error(_0x41ff0b(0xe4));this[_0x41ff0b(0xef)]=_0x54d5a6[_0x41ff0b(0x128)](_0xdb781e,_0x5620fe),this['indexManager']=_0x5d9c9f[_0x41ff0b(0x128)](_0xdb781e,_0x5620fe);}M(this[_0x41ff0b(0xfb)])&&j(this['indexManager']);}async[_0x310639(0x135)](){const _0x2e2969=_0x310639;let _0x12d7db=this[_0x2e2969(0xc5)][_0x2e2969(0x135)];if(typeof _0x12d7db!='function')throw new Error(_0x2e2969(0x10e));await _0x12d7db[_0x2e2969(0x11d)](this[_0x2e2969(0xc5)]);}async[_0x310639(0x118)](){const _0x7637df=_0x310639;return this[_0x7637df(0x101)][_0x7637df(0x118)]();}[_0x310639(0x159)](_0x3851f7){if(!_0x3851f7)return;let _0xfb2250=!0x1;return(_0x372424,_0x544a26)=>{const _0x2be256=_0xc99c;let _0x1d4eed=_0x372424?_0x372424[_0x2be256(0xf5)]:de(_0x544a26);if(_0x1d4eed!==null){_0xfb2250||(_0xfb2250=!0x0,console[_0x2be256(0x16f)](_0x2be256(0xc9)+_0x1d4eed));return;}_0x3851f7(_0x544a26);};}[_0x310639(0x157)](_0x230a07){const _0x496626=_0x310639;let _0x3b65a0=_0x230a07['trim']()[_0x496626(0x122)]()[_0x496626(0x176)](/\s+/g,'_'),_0x43be5d=_0x3b65a0['replace'](/_/g,'');if(_0x3b65a0===_0x496626(0x114)||_0x43be5d===_0x496626(0x140))return _0x3d66c2[_0x496626(0x152)];if(_0x3b65a0===_0x496626(0xf1))return _0x3d66c2['Uploading'];if(_0x3b65a0===_0x496626(0x188))return _0x3d66c2[_0x496626(0xf4)];if(_0x3b65a0==='completed')return _0x3d66c2[_0x496626(0x113)];if(_0x3b65a0==='failed')return _0x3d66c2['Failed'];throw new Error(_0x496626(0xfa)+_0x230a07+_0x496626(0x126));}async[_0x310639(0xd2)](_0x20c3ac,_0x58e7fc,_0x592c8e,_0x309c04){const _0x249812=_0x310639;if(!_0x58e7fc['length'])throw new Error(_0x249812(0xe3));return await this['manageClient']['createIndex'](_0x20c3ac,_0x58e7fc,_0x592c8e,this[_0x249812(0x159)](_0x309c04?.[_0x249812(0xe9)]));}async[_0x310639(0x11a)](_0x426401){const _0x5ca9cc=_0x310639;if(_0x426401 instanceof Uint8Array)return Array[_0x5ca9cc(0xdc)](_0x426401);if(_0x426401 instanceof ArrayBuffer)return Array[_0x5ca9cc(0xdc)](new Uint8Array(_0x426401));if(typeof _0x426401[_0x5ca9cc(0x10b)]=='function'){let _0x236b63=await _0x426401[_0x5ca9cc(0x10b)]();return Array[_0x5ca9cc(0xdc)](new Uint8Array(_0x236b63));}throw new Error(_0x5ca9cc(0xfe));}async[_0x310639(0x10a)](_0x394d3f,_0x184bce,_0x836772){const _0x3555b4=_0x310639;if(_0x184bce[_0x3555b4(0x137)]===0x0)throw new Error(_0x3555b4(0x108));let _0x1852f6=_0x836772?.['modelId']??_0x3555b4(0xcb),_0x189a76=await Promise[_0x3555b4(0xf6)](_0x184bce[_0x3555b4(0x150)](async _0x5c9b25=>({'name':_0x5c9b25[_0x3555b4(0x16c)],'contentType':_0x5c9b25[_0x3555b4(0xd5)],'path':_0x5c9b25[_0x3555b4(0x11b)]??void 0x0,'data':_0x5c9b25[_0x3555b4(0x17a)]!=null?await this[_0x3555b4(0x11a)](_0x5c9b25[_0x3555b4(0x17a)]):void 0x0})));return await this['manageClient']['createIndexFromFiles'](_0x394d3f,_0x189a76,_0x1852f6,this[_0x3555b4(0x159)](_0x836772?.[_0x3555b4(0xe9)]),_0x836772?.[_0x3555b4(0xcf)]??null);}async['addDocs'](_0x3b4cce,_0x4cf916,_0xc1eca5){const _0xaccc3e=_0x310639;if(Array[_0xaccc3e(0x179)](_0x4cf916)&&_0x4cf916[_0xaccc3e(0x137)]===0x0)throw new Error(_0xaccc3e(0xdd));return await this['manageClient'][_0xaccc3e(0x164)](_0x3b4cce,_0x4cf916,_0xc1eca5??null,this[_0xaccc3e(0x159)](_0xc1eca5?.[_0xaccc3e(0xe9)]));}async[_0x310639(0x14d)](_0x4ec181,_0x42384d,_0x7568a9){const _0x5904d1=_0x310639;if(Array[_0x5904d1(0x179)](_0x42384d)&&_0x42384d['length']===0x0)throw new Error(_0x5904d1(0xd4));return await this['manageClient'][_0x5904d1(0x14d)](_0x4ec181,_0x42384d,this['wrapProgress'](_0x7568a9?.[_0x5904d1(0xe9)]));}async[_0x310639(0xe2)](_0x5dbc7a){const _0x1da798=_0x310639;let _0x135d80=await this[_0x1da798(0xef)][_0x1da798(0xe2)](_0x5dbc7a);return{..._0x135d80,'status':this[_0x1da798(0x157)](_0x135d80[_0x1da798(0x141)]),'currentPhase':_0x135d80[_0x1da798(0xd3)]??null,'error':_0x135d80[_0x1da798(0xc3)]??null};}async[_0x310639(0x185)](_0x42c868){const _0x92076e=_0x310639;return this[_0x92076e(0xef)][_0x92076e(0x185)](_0x42c868);}async['listIndexes'](){const _0x16e4c8=_0x310639;return this[_0x16e4c8(0xef)]['listIndexes']();}async[_0x310639(0x175)](_0x227d3e){const _0x2b58de=_0x310639;return this[_0x2b58de(0xef)]['deleteIndex'](_0x227d3e);}async[_0x310639(0xc8)](_0xb8931e,_0x19ca2e){const _0x1d5bf6=_0x310639;return this[_0x1d5bf6(0xef)][_0x1d5bf6(0xc8)](_0xb8931e,_0x19ca2e??null);}async[_0x310639(0x158)](_0x59cf5f,_0x5a44a3){const _0x327c85=_0x310639;this[_0x327c85(0x10d)](_0x5a44a3?.['cachePath']);let _0xfd32a2=await this[_0x327c85(0xc5)][_0x327c85(0x158)](_0x59cf5f,_0x5a44a3??null);return _0xfd32a2[_0x327c85(0x182)]['id']!==_0x327c85(0x154)&&await this['indexManager']['loadQueryModel'](_0x59cf5f),_0xfd32a2[_0x327c85(0x16c)];}async[_0x310639(0x15c)](_0x5e05f1,_0x11c619){const _0xc6729e=_0x310639;let _0x47894a=this[_0xc6729e(0x12f)]();return this[_0xc6729e(0x10d)](_0x11c619?.[_0xc6729e(0x177)]),_0x47894a[_0xc6729e(0x15c)](_0x5e05f1,_0x11c619??null);}async[_0x310639(0xd9)](_0x364421){const _0x46af63=_0x310639;return this[_0x46af63(0xc5)][_0x46af63(0xd9)](_0x364421);}async[_0x310639(0x120)](_0x1a06b1){const _0x4d8741=_0x310639;return this[_0x4d8741(0x12f)]()[_0x4d8741(0x120)](_0x1a06b1);}[_0x310639(0x12f)](){const _0x5c1552=_0x310639;let _0x328eff=this[_0x5c1552(0xc5)];if(typeof _0x328eff[_0x5c1552(0x155)]!='function'||typeof _0x328eff['queryMultiIndexText']!=_0x5c1552(0xf7)||typeof _0x328eff['loadIndexes']!='function'||typeof _0x328eff['unloadIndexes']!=_0x5c1552(0xf7))throw new Error(_0x5c1552(0x167));return{'queryMultiIndex':_0x328eff[_0x5c1552(0x155)][_0x5c1552(0x15b)](_0x328eff),'queryMultiIndexText':_0x328eff[_0x5c1552(0x12c)][_0x5c1552(0x15b)](_0x328eff),'loadIndexes':_0x328eff['loadIndexes'][_0x5c1552(0x15b)](_0x328eff),'unloadIndexes':_0x328eff[_0x5c1552(0x120)]['bind'](_0x328eff)};}[_0x310639(0x10d)](_0x1684b5){const _0x479814=_0x310639;N(this['indexManager'],this[_0x479814(0xc6)],this[_0x479814(0xfb)],this['deviceIdCachePath']??_0x1684b5);}[_0x310639(0xcd)](){const _0x4cf6d0=_0x310639;return v(this[_0x4cf6d0(0xc6)],this['configuredIdentity'],this[_0x4cf6d0(0x160)]);}[_0x310639(0x171)](){const _0x5c3441=_0x310639;return this[_0x5c3441(0xce)]!==void 0x0;}async[_0x310639(0xe1)](_0x482722,_0x356da0,_0x3ae24c){const _0x1efd05=_0x310639;if(!this[_0x1efd05(0xce)])throw new Error(_0x1efd05(0x14a));let _0x46e109=_0x4323ad,_0x46a6c1=_0x46e109[_0x1efd05(0x139)]??_0x46e109[_0x1efd05(0x165)]?.[_0x1efd05(0x139)];if(!_0x46a6c1||typeof _0x46a6c1['withAuthenticator']!=_0x1efd05(0xf7))throw new Error(_0x1efd05(0x162));return _0x3ae24c&&y(_0x46a6c1),_0x46a6c1[_0x1efd05(0x128)](_0x482722,_0x356da0,this[_0x1efd05(0xd8)],this[_0x1efd05(0xce)],null,null,_0x3ae24c?.[_0x1efd05(0x12e)]??null,_0x3ae24c?.[_0x1efd05(0xff)]??null);}async['query'](_0x3db233,_0x1ff752,_0x2f06c1){const _0x24f871=_0x310639;if(!await this[_0x24f871(0xc5)][_0x24f871(0xf8)](_0x3db233))throw new Error(_0x24f871(0x142)+_0x3db233+'\x22\x20is\x20not\x20loaded.\x20Call\x20loadIndex(\x22'+_0x3db233+_0x24f871(0xee));let _0x58d2d6=_0x2f06c1?.[_0x24f871(0xc4)]??0x5,_0x2c3f3c=_0x2f06c1?.[_0x24f871(0x151)]??0.8;return _0x2f06c1?.[_0x24f871(0xfc)]?this[_0x24f871(0xc5)][_0x24f871(0x14c)](_0x3db233,_0x1ff752,_0x2f06c1[_0x24f871(0xfc)],_0x58d2d6,_0x2c3f3c,_0x2f06c1?.[_0x24f871(0xe6)]):this[_0x24f871(0xc5)][_0x24f871(0x127)](_0x3db233,_0x1ff752,_0x58d2d6,_0x2c3f3c,_0x2f06c1?.[_0x24f871(0xe6)]);}async[_0x310639(0x155)](_0xb2446f,_0xbcd82b,_0x152f14){const _0x54007d=_0x310639;if(_0xb2446f[_0x54007d(0x137)]===0x0)throw new Error(_0x54007d(0xdb));let _0x1fe07c=this['requireMultiIndexCore'](),_0x4336c7=_0x152f14?.[_0x54007d(0xc4)]??0xa,_0x42ee40=_0x152f14?.[_0x54007d(0x151)]??0.8;if(_0x152f14?.[_0x54007d(0xfc)])return _0x1fe07c[_0x54007d(0x155)](_0xb2446f,_0xbcd82b,_0x152f14[_0x54007d(0xfc)],_0x4336c7,_0x42ee40,_0x152f14?.[_0x54007d(0xe6)]);try{return await _0x1fe07c[_0x54007d(0x12c)](_0xb2446f,_0xbcd82b,_0x4336c7,_0x42ee40,_0x152f14?.[_0x54007d(0xe6)]);}catch(_0x3c0c87){throw _0x3c0c87 instanceof Error&&_0x3c0c87[_0x54007d(0xf5)][_0x54007d(0x129)](_0x54007d(0xe5))?new Error(_0x3c0c87['message']+_0x54007d(0x123),{'cause':_0x3c0c87}):_0x3c0c87 instanceof Error&&_0x3c0c87[_0x54007d(0xf5)][_0x54007d(0x129)](_0x54007d(0xed))?new Error('One\x20or\x20more\x20indexes\x20use\x20custom\x20embeddings.\x20Provide\x20a\x20query\x20vector\x20via\x20options.embedding,\x20or\x20use\x20alpha\x200\x20for\x20keyword-only\x20search.',{'cause':_0x3c0c87}):_0x3c0c87;}}};function _0x5ac6(){const _0x2f13f2=['token','Unsupported\x20data\x20type\x20for\x20file\x20upload','manifestSha256','progress','authenticator','moss-core\x20runtime\x20is\x20missing\x20resolveAuthRequest/rejectAuthRequest\x20exports.\x20Ensure\x20you\x20are\x20using\x20a\x20moss-core\x20build\x20that\x20supports\x20custom\x20authenticators.','addDocumentsText','clear','11389680MXXVZm','updated','then','createIndexFromFiles\x20requires\x20at\x20least\x20one\x20file','MossClient\x20options.identity.','createIndexFromFiles','arrayBuffer','asyncDispose','applyIdentityToManager','@moss-js/moss-core\x20>=\x200.20.0\x20is\x20required\x20for\x20MossClient.close()','deviceId','identity','1jPWKjS','trim','Completed','pending_upload','received\x20a\x20progress\x20event\x20with\x20a\x20non-string\x20currentPhase\x20(','Documents\x20missing\x20.embedding\x20for\x20custom\x20model:\x20','\x20must\x20be\x20a\x20non-empty\x20string','getAuthToken','moss-core\x20rejected\x20the\x20auth\x20token:\x20','toByteArray','path','1188729OhDsHi','call','CLOUD_API_AUTH_URL','add','unloadIndexes','This\x20session\x20uses\x20custom\x20embeddings.\x20Provide\x20a\x20query\x20embedding\x20via\x20QueryOptions.embedding.','toLowerCase','\x20Provide\x20a\x20query\x20vector\x20via\x20options.embedding,\x20or\x20use\x20alpha\x200\x20for\x20keyword-only\x20search.','modelArtifactContractVersion','_create','\x27\x20returned\x20by\x20moss-core','queryText','withAuthenticator','includes','modelId','resolveAuthRequest','queryMultiIndexText','delete','version','requireMultiIndexCore','678698ULlwWT','projectKey','_warmModel','received\x20a\x20progress\x20event\x20with\x20a\x20missing\x20or\x20empty\x20status\x20(','Bearer\x20','close','received\x20an\x20array\x20where\x20a\x20JobProgress\x20object\x20was\x20expected','length','HTTP\x20','SessionIndex','string','join','docCount','inflight','authUrl','added','pendingupload','status','Index\x20\x22','deref','startsWith','MossClient\x20options.identity\x20must\x20be\x20an\x20object','25fmhmJG','upsert','USERPROFILE','\x20must\x20not\x20have\x20leading\x20or\x20trailing\x20whitespace','createAuthenticatedSessionInner\x20requires\x20a\x20custom\x20IAuthenticator\x20client','inner','query','deleteDocs','loadModel','283652tkMAGG','map','alpha','PendingUpload','7423227tIrisY','custom','queryMultiIndex','utf8','normalizeJobStatus','loadIndex','wrapProgress','6610720IyLKCO','bind','loadIndexes','IndexManager','_fromInner','now','deviceIdCachePath','freeze','moss-core\x20runtime\x20SessionIndex\x20is\x20missing\x20the\x20withAuthenticator\x20factory.\x20Upgrade\x20@moss-js/moss-core\x20to\x20a\x20build\x20that\x20supports\x20custom\x20authenticators\x20for\x20sessions.','create','addDocs','default','cache','The\x20installed\x20@moss-js/moss-core\x20does\x20not\x20support\x20multi-index\x20operations\x20(queryMultiIndex,\x20loadIndexes,\x20unloadIndexes).\x20Upgrade\x20@moss-js/moss-core.','[moss]\x20Auth\x20request\x20','MossClient\x20is\x20closed','jobId','received\x20a\x20progress\x20event\x20with\x20a\x20missing\x20or\x20empty\x20jobId\x20(','name','Authentication\x20failed\x20(HTTP\x20401):\x20','slice','warn','applied','hasCustomAuthenticator','The\x20installed\x20@moss-js/moss-core\x20runtime\x20does\x20not\x20support\x20exact\x20model\x20artifact\x20identities.\x20Upgrade\x20moss-core\x20before\x20creating\x20this\x20session.','env','2310840Jzxriu','deleteIndex','replace','cachePath','setDeviceId','isArray','data','setIdentity','fetchAndCache','HOME','expiresIn','byteLength','timeout','getAuthHeader','model','listIndexes','loadFromDisk','getIndex','isSafeInteger','\x27\x20is\x20closed','building','error','topK','indexManager','deviceIdState','encode','getDocs','[moss]\x20Dropping\x20a\x20malformed\x20job\x20progress\x20event;\x20progress\x20reporting\x20may\x20be\x20incomplete\x20for\x20this\x20operation.\x20Cause:\x20','userId','moss-minilm','SDK_VERSION_NUMBER','resolveIdentityForSession','authNotifyFn','parseOptions','hostDeviceId','CLOUD_API_IDENTITY_URL','createIndex','currentPhase','deleteDocs\x20requires\x20at\x20least\x20one\x20document\x20ID','contentType','rejectAuthRequest','test','projectId','unloadIndex','MOSS_AUTH_URL','queryMultiIndex\x20requires\x20at\x20least\x20one\x20index\x20name','from','addDocs\x20requires\x20at\x20least\x20one\x20document','mossDeviceId','\x20must\x20be\x20at\x20most\x20','callerSupplied','createAuthenticatedSessionInner','getJobStatus','createIndex\x20requires\x20at\x20least\x20one\x20document','moss-core\x20runtime\x20ManageClient/IndexManager\x20is\x20missing\x20withAuthenticator\x20factory.\x20Ensure\x20you\x20are\x20using\x20a\x20moss-core\x20build\x20that\x20supports\x20custom\x20authenticators.','no\x20exact\x20artifact\x20identity','filter','CLOUD_API_INDEX_URL','@moss-js/moss-core\x20>=\x200.20.0\x20is\x20required\x20for\x20SessionIndex.close()','onProgress','.\x20All\x20documents\x20must\x20have\x20.embedding\x20set\x20when\x20using\x20modelId=\x27custom\x27.','.moss-device-id','The\x20installed\x20@moss-js/moss-core\x20does\x20not\x20support\x20MossClient\x20identity.\x20Install\x20the\x20exact\x20@moss-js/moss-core\x20version\x20required\x20by\x20@moss-js/moss.','requires\x20explicit\x20query\x20embeddings','\x22)\x20or\x20loadIndexes([...])\x20before\x20querying;\x20queries\x20run\x20locally\x20and\x20there\x20is\x20no\x20cloud\x20query\x20fallback.','manageClient','saveToDisk','uploading','json','object','Building','message','all','function','hasIndex','stringify','Unsupported\x20job\x20status\x20\x27','configuredIdentity','embedding'];_0x5ac6=function(){return _0x2f13f2;};return _0x5ac6();}import{SessionIndex as _0x2c922d}from'@moss-js/moss-core';var h=class r{#e;#r;#s;#o=!0x1;#i;constructor(_0x18622e,_0x295f09,_0x1d20c4){this.#s=_0x18622e,this.#r=_0x295f09,this.#e=_0x1d20c4;}static async[_0x310639(0x125)](_0x1c94a4,_0x183055,_0x17285c,_0x361db4,_0x3d5dab,_0x4deaf6,_0xf425e8){const _0x3df0bc=_0x310639;let _0xca9954=_0x2c922d;_0xf425e8&&y(_0xca9954);let _0x2515e9=await _0xca9954[_0x3df0bc(0x163)](_0x1c94a4,_0x183055,_0x17285c,_0x361db4,_0x3d5dab??null,_0xf425e8?.[_0x3df0bc(0x12e)]??null,_0xf425e8?.['manifestSha256']??null);return r['_fromInner'](_0x1c94a4,_0x183055,_0x2515e9,_0x4deaf6);}static[_0x310639(0x15e)](_0x383c73,_0x52bf2e,_0x1a796d,_0x7b29f1){return _0x7b29f1&&P(_0x1a796d,_0x7b29f1),new r(_0x383c73,_0x52bf2e,_0x1a796d);}get[_0x310639(0x16c)](){return this.#s;}get[_0x310639(0x13c)](){const _0x1a8091=_0x310639;return this.#n(),this.#e[_0x1a8091(0x13c)];}get[_0x310639(0x12a)](){return this.#r;}async[_0x310639(0x164)](_0x5ba041,_0x3d7f65){const _0x1189c6=_0x310639;this.#n();let _0x200028=_0x3d7f65?{'upsert':_0x3d7f65[_0x1189c6(0x147)]??!0x0}:void 0x0;if(this.#r===_0x1189c6(0x154)){let _0x2fe1f5=r.#a(_0x5ba041),_0x7c0a5e=_0x5ba041[_0x1189c6(0x150)](_0x2cde9a=>{const _0x308c91=_0x1189c6;let _0x4c7a16={..._0x2cde9a};return delete _0x4c7a16[_0x308c91(0xfc)],_0x4c7a16;}),_0x37ed0b=this.#e['addDocuments'](_0x7c0a5e,_0x2fe1f5,_0x200028);return{'added':_0x37ed0b[_0x1189c6(0x13f)],'updated':_0x37ed0b[_0x1189c6(0x106)]};}let _0xd97bdf=this.#e[_0x1189c6(0x103)](_0x5ba041,_0x200028);return{'added':_0xd97bdf['added'],'updated':_0xd97bdf[_0x1189c6(0x106)]};}async[_0x310639(0x14d)](_0x317854){return this.#n(),this.#e['deleteDocuments'](_0x317854);}async[_0x310639(0xc8)](_0x28ce78){return this.#n(),this.#e['getDocuments'](_0x28ce78??null);}async[_0x310639(0x14c)](_0x2e829b,_0x3eb3ca){const _0x5a5061=_0x310639;this.#n();let _0x15c972=_0x3eb3ca?.[_0x5a5061(0xc4)]??0x5,_0xaf66ba=_0x3eb3ca?.[_0x5a5061(0x151)]??0.8,_0x1686f0=_0x3eb3ca?.[_0x5a5061(0xe6)]??null,_0x2d878a=_0x3eb3ca?.[_0x5a5061(0xfc)];if(_0x2d878a==null){if(this.#r===_0x5a5061(0x154))throw new Error(_0x5a5061(0x121));return this.#e[_0x5a5061(0x127)](_0x2e829b,_0x15c972,_0xaf66ba,_0x1686f0);}return this.#e[_0x5a5061(0x14c)](_0x2e829b,_0x15c972,Array[_0x5a5061(0xdc)](_0x2d878a),_0xaf66ba,_0x1686f0);}async[_0x310639(0x158)](_0x42acaf,_0x1af35d){const _0x57c35d=_0x310639;return this.#n(),this.#e[_0x57c35d(0x158)](_0x42acaf,_0x1af35d??null);}async['pushIndex'](){return this.#n(),this.#e['pushIndex']();}async[_0x310639(0xf0)](_0x5d6c32){this.#n(),this.#e['saveToDisk'](_0x5d6c32);}async[_0x310639(0x184)](_0x2a3d37){return this.#n(),this.#e['loadFromDisk'](_0x2a3d37);}#n(){const _0x547c1a=_0x310639;if(this.#o)throw new Error('SessionIndex\x20\x27'+this.#s+_0x547c1a(0x187));}[_0x310639(0x135)](){return this.#i??=this.#t(),this.#i;}async #t(){const _0x1e2595=_0x310639;this.#o=!0x0;let _0x41accf=this.#e[_0x1e2595(0x135)];if(typeof _0x41accf!=_0x1e2595(0xf7))throw new Error(_0x1e2595(0xe8));await _0x41accf[_0x1e2595(0x11d)](this.#e);}async[Symbol['asyncDispose']](){const _0x24e8b2=_0x310639;return this[_0x24e8b2(0x135)]();}async[_0x310639(0x132)](){const _0x2e4aea=_0x310639;this.#n(),this.#r!=='custom'&&this.#e[_0x2e4aea(0x14e)]();}static#a(_0x2fff69){const _0xb5acda=_0x310639;let _0x216629=_0x2fff69['filter'](_0x58c0b1=>!_0x58c0b1[_0xb5acda(0xfc)]||_0x58c0b1[_0xb5acda(0xfc)][_0xb5acda(0x137)]===0x0)[_0xb5acda(0x150)](_0x4f1bd7=>_0x4f1bd7['id']);if(_0x216629['length']>0x0)throw new Error(_0xb5acda(0x116)+_0x216629[_0xb5acda(0x13b)](',\x20')+_0xb5acda(0xea));return _0x2fff69['map'](_0x48d65b=>Array[_0xb5acda(0xdc)](_0x48d65b[_0xb5acda(0xfc)]??[]));}},B=_0x310639(0xcb),S=class{#e;#r;#s;#o=!0x1;#i;#n=new Set();constructor(_0x166d0e,_0x42c519,_0x445436){const _0x35181f=_0x310639;this.#e=new x(_0x166d0e,_0x42c519,_0x445436),this.#r=_0x166d0e,this.#s=typeof _0x42c519==_0x35181f(0x13a)?_0x42c519:null;}async[_0x310639(0x118)](){const _0x5c2755=_0x310639;return this.#t(),this.#e[_0x5c2755(0x118)]();}async[_0x310639(0xd2)](_0x5b61a4,_0x129496,_0x1ac73c){const _0x53acd6=_0x310639;this.#t();let _0xd99223;return _0x1ac73c?.[_0x53acd6(0x12a)]!==void 0x0?_0xd99223=_0x1ac73c[_0x53acd6(0x12a)]:_0xd99223=_0x129496['some'](_0x44ca4e=>Array[_0x53acd6(0x179)](_0x44ca4e[_0x53acd6(0xfc)])&&_0x44ca4e['embedding'][_0x53acd6(0x137)]>0x0)?_0x53acd6(0x154):B,this.#e[_0x53acd6(0xd2)](_0x5b61a4,_0x129496,_0xd99223,_0x1ac73c);}async[_0x310639(0x10a)](_0x10c758,_0x5af78f,_0x41f0ef){const _0x5581e0=_0x310639;return this.#t(),this.#e[_0x5581e0(0x10a)](_0x10c758,_0x5af78f,_0x41f0ef);}async['getIndex'](_0x46a224){const _0x209e8a=_0x310639;return this.#t(),this.#e[_0x209e8a(0x185)](_0x46a224);}async[_0x310639(0x183)](){return this.#t(),this.#e['listIndexes']();}async[_0x310639(0x175)](_0x3bea95){const _0xab3f47=_0x310639;return this.#t(),this.#e[_0xab3f47(0x175)](_0x3bea95);}async[_0x310639(0x164)](_0x422cce,_0xc4b14b,_0x3b306b){const _0x53c823=_0x310639;return this.#t(),this.#e[_0x53c823(0x164)](_0x422cce,_0xc4b14b,_0x3b306b);}async[_0x310639(0x14d)](_0xb5b6b3,_0x2a4ea9,_0x268ac6){return this.#t(),this.#e['deleteDocs'](_0xb5b6b3,_0x2a4ea9,_0x268ac6);}async[_0x310639(0xe2)](_0x4ab7a8){const _0x3fdb46=_0x310639;return this.#t(),this.#e[_0x3fdb46(0xe2)](_0x4ab7a8);}async[_0x310639(0xc8)](_0x23f2f0,_0x58427a){const _0xd6f08e=_0x310639;return this.#t(),this.#e[_0xd6f08e(0xc8)](_0x23f2f0,_0x58427a);}async[_0x310639(0x158)](_0x1aff41,_0x43b1bb){const _0x481ecd=_0x310639;return this.#t(),this.#e[_0x481ecd(0x158)](_0x1aff41,_0x43b1bb);}async[_0x310639(0x15c)](_0x356f56,_0x590a68){const _0x9fa35b=_0x310639;return this.#t(),this.#e[_0x9fa35b(0x15c)](_0x356f56,_0x590a68);}async[_0x310639(0xd9)](_0x372ca1){const _0x2e0a82=_0x310639;return this.#t(),this.#e[_0x2e0a82(0xd9)](_0x372ca1);}async['unloadIndexes'](_0x4df792){const _0x2e092d=_0x310639;return this.#t(),this.#e[_0x2e092d(0x120)](_0x4df792);}async[_0x310639(0x14c)](_0x44ee7c,_0x3516b7,_0x26a59a){const _0x33bdf2=_0x310639;return this.#t(),this.#e[_0x33bdf2(0x14c)](_0x44ee7c,_0x3516b7,_0x26a59a);}async[_0x310639(0x155)](_0x3b724e,_0x3376e6,_0x126de6){const _0x33b21a=_0x310639;return this.#t(),this.#e[_0x33b21a(0x155)](_0x3b724e,_0x3376e6,_0x126de6);}async['session'](_0x4bdb29,_0x4dd7cb=B,_0x2adad5){const _0x384ee0=_0x310639;this.#t();let _0x501511=this.#e[_0x384ee0(0xcd)](),_0x36425c;if(this.#s!==null)_0x36425c=await h[_0x384ee0(0x125)](_0x4bdb29,_0x4dd7cb,this.#r,this.#s,void 0x0,_0x501511,_0x2adad5);else{let _0x5054c7=await this.#e[_0x384ee0(0xe1)](_0x4bdb29,_0x4dd7cb,_0x2adad5);_0x36425c=h['_fromInner'](_0x4bdb29,_0x4dd7cb,_0x5054c7,_0x501511);}await _0x36425c[_0x384ee0(0x132)]();for(let _0x3967db of this.#n)_0x3967db[_0x384ee0(0x143)]()||this.#n[_0x384ee0(0x12d)](_0x3967db);return this.#n[_0x384ee0(0x11f)](new WeakRef(_0x36425c)),_0x36425c;}#t(){const _0x3a8944=_0x310639;if(this.#o)throw new Error(_0x3a8944(0x169));}['close'](){return this.#i??=this.#a(),this.#i;}async #a(){const _0x57008f=_0x310639;this.#o=!0x0;let _0x2df3a0=[...this.#n][_0x57008f(0x150)](_0x4d935b=>_0x4d935b['deref']())[_0x57008f(0xe6)](_0x30b2d4=>_0x30b2d4!==void 0x0);this.#n[_0x57008f(0x104)](),await Promise[_0x57008f(0xf6)](_0x2df3a0[_0x57008f(0x150)](_0x3eec42=>_0x3eec42[_0x57008f(0x135)]())),await this.#e[_0x57008f(0x135)]();}async[Symbol[_0x310639(0x10c)]](){const _0x3382e8=_0x310639;return this[_0x3382e8(0x135)]();}};export{S as MossClient,h as SessionIndex};
package/dist/moss.d.ts ADDED
@@ -0,0 +1,794 @@
1
+ /// <reference lib="esnext.disposable" />
2
+
3
+ import { DocumentInfo } from '@moss-js/moss-core';
4
+ import { GetDocumentsOptions } from '@moss-js/moss-core';
5
+ import type { IndexInfo } from '@moss-js/moss-core';
6
+ import { JobPhase } from '@moss-js/moss-core';
7
+ import { JobStatus } from '@moss-js/moss-core';
8
+ import { JobStatusResponse } from '@moss-js/moss-core';
9
+ import { LoadSessionOptions } from '@moss-js/moss-core';
10
+ import { MutationResult } from '@moss-js/moss-core';
11
+ import { PushIndexResult } from '@moss-js/moss-core';
12
+ import { QueryOptions } from '@moss-js/moss-core';
13
+ import { QueryResultDocumentInfo } from '@moss-js/moss-core';
14
+ import { RefreshResult } from '@moss-js/moss-core';
15
+ import { SearchResult } from '@moss-js/moss-core';
16
+ import { SessionIndex as SessionIndex_2 } from '@moss-js/moss-core';
17
+
18
+ export declare interface AuthToken {
19
+ token: string;
20
+ expiresIn: number;
21
+ }
22
+
23
+ /**
24
+ * Options for creating an index from files via the parse pipeline.
25
+ */
26
+ export declare interface CreateIndexFromFilesOptions {
27
+ /**
28
+ * Embedding model to use. Defaults to "moss-minilm".
29
+ * "custom" is not supported — the parse pipeline generates embeddings server-side.
30
+ */
31
+ modelId?: "moss-minilm" | "moss-mediumlm";
32
+ /**
33
+ * Extraction controls, including OCR mode. Omit for server defaults.
34
+ */
35
+ parseOptions?: ParseOptions;
36
+ /**
37
+ * Callback invoked with progress updates (~every 2s) while the server is processing.
38
+ */
39
+ onProgress?: (progress: JobProgress) => void;
40
+ }
41
+
42
+ /**
43
+ * Options for creating an index.
44
+ */
45
+ export declare interface CreateIndexOptions {
46
+ /**
47
+ * Embedding model to use. Defaults to "moss-minilm", or "custom" if
48
+ * documents have pre-computed embeddings.
49
+ */
50
+ modelId?: string;
51
+ /**
52
+ * Callback invoked with progress updates (~every 2s) while the server is processing.
53
+ */
54
+ onProgress?: (progress: JobProgress) => void;
55
+ }
56
+
57
+ export { DocumentInfo }
58
+
59
+ export { GetDocumentsOptions }
60
+
61
+ export declare interface IAuthenticator {
62
+ getAuthToken(): Promise<AuthToken>;
63
+ getAuthHeader(): Promise<string>;
64
+ }
65
+
66
+ /**
67
+ * ISO 8601 date string format.
68
+ * @example "2025-09-26T15:04:05Z"
69
+ */
70
+ export declare type ISODate = string;
71
+
72
+ export { JobPhase }
73
+
74
+ /**
75
+ * Progress update passed to the `onProgress` callback during async operations.
76
+ */
77
+ export declare interface JobProgress {
78
+ jobId: string;
79
+ status: "pending_upload" | "uploading" | "building" | "completed" | "failed";
80
+ progress: number;
81
+ currentPhase: "queued" | "crawling" | "parsing_documents" | "parsing" | "waiting_for_parser" | "parsing_complete" | "downloading" | "deserializing" | "generating_embeddings" | "building_index" | "uploading" | "cleanup" | null;
82
+ }
83
+
84
+ export { JobStatus }
85
+
86
+ export { JobStatusResponse }
87
+
88
+ /**
89
+ * Outcome of a best-effort bulk `loadIndexes` call.
90
+ */
91
+ export declare interface LoadIndexesResult {
92
+ /**
93
+ * Names of indexes that were successfully loaded into memory.
94
+ */
95
+ loaded: string[];
96
+ /**
97
+ * Names that failed to load, mapping name to error message.
98
+ */
99
+ failed: Record<string, string>;
100
+ }
101
+
102
+ /**
103
+ * Options for loading an index with auto-refresh configuration.
104
+ * Note: SDK makes fields optional with defaults, moss-core requires them.
105
+ */
106
+ export declare interface LoadIndexOptions {
107
+ /**
108
+ * Whether to enable auto-refresh polling for this index.
109
+ * When enabled, the index will periodically check for updates from the cloud.
110
+ * @default false
111
+ */
112
+ autoRefresh?: boolean;
113
+ /**
114
+ * Polling interval in seconds. Only used when autoRefresh is true.
115
+ * @default 600 (10 minutes)
116
+ */
117
+ pollingIntervalInSeconds?: number;
118
+ /**
119
+ * Filesystem path for caching index data to disk.
120
+ * When set, downloaded indexes are persisted and reused on subsequent loads
121
+ * if the cloud data hasn't changed. Auto-refresh also persists to cache.
122
+ */
123
+ cachePath?: string;
124
+ }
125
+
126
+ export { LoadSessionOptions }
127
+
128
+ /** Exact immutable publisher identity required for local foundation models. */
129
+ export declare interface ModelArtifactIdentity {
130
+ /** Version embedded in the publisher manifest and immutable artifact URL. */
131
+ version: string;
132
+ /** Lowercase SHA-256 digest of the exact publisher manifest bytes. */
133
+ manifestSha256: string;
134
+ }
135
+
136
+ /**
137
+ * MossClient - Async-first semantic search client for vector similarity operations.
138
+ *
139
+ * All mutations (createIndex, addDocs, deleteDocs) are async operations
140
+ * that run server-side and poll until complete.
141
+ *
142
+ * @example
143
+ * ```typescript
144
+ * import { MossClient } from '@moss-js/moss';
145
+ *
146
+ * const client = new MossClient('your-project-id', 'your-project-key');
147
+ *
148
+ * // Create an index with documents (polls until complete)
149
+ * const result = await client.createIndex('docs', [
150
+ * { id: '1', text: 'Machine learning fundamentals' },
151
+ * { id: '2', text: 'Deep learning neural networks' }
152
+ * ]);
153
+ *
154
+ * // Add docs (polls until complete)
155
+ * await client.addDocs('docs', [
156
+ * { id: '3', text: 'Natural language processing' }
157
+ * ]);
158
+ *
159
+ * // Query the index
160
+ * await client.loadIndex('docs');
161
+ * const results = await client.query('docs', 'AI and neural networks');
162
+ * ```
163
+ */
164
+ export declare class MossClient {
165
+ #private;
166
+ /**
167
+ * Creates a new MossClient instance.
168
+ * @param projectId - Your project identifier.
169
+ * @param projectKey - Your project key (server-side use).
170
+ * @param options - Optional cache path and stable host identity.
171
+ */
172
+ constructor(projectId: string, projectKey: string, options?: MossClientOptions);
173
+ /**
174
+ * Creates a new MossClient instance.
175
+ * @param projectId - Your project identifier.
176
+ * @param authenticator - Custom IAuthenticator (browser/delegated auth use).
177
+ * @param options - Optional cache path and stable host identity.
178
+ */
179
+ constructor(projectId: string, authenticator: IAuthenticator, options?: MossClientOptions);
180
+ getAuthToken(): Promise<AuthToken>;
181
+ /**
182
+ * Creates a new index with the provided documents via async upload.
183
+ *
184
+ * Handles the full flow: init → upload → build → poll until complete.
185
+ * Returns when the index is ready.
186
+ *
187
+ * When all documents have pre-computed embeddings, they are serialized as raw
188
+ * float32 in the binary upload. When no documents have embeddings, the server
189
+ * generates embeddings in batches (dimension=0 flow).
190
+ *
191
+ * Mixed documents (some with embeddings, some without) are rejected.
192
+ *
193
+ * @param indexName - Name of the index to create.
194
+ * @param docs - Documents, optionally with pre-computed embeddings.
195
+ * @param options - Optional model ID and progress callback.
196
+ * @returns Promise that resolves to MutationResult when the index is ready.
197
+ * @throws {Error} If the index already exists or creation fails.
198
+ *
199
+ * @example
200
+ * ```typescript
201
+ * const result = await client.createIndex('knowledge-base', [
202
+ * { id: 'doc1', text: 'Introduction to AI' },
203
+ * { id: 'doc2', text: 'Machine learning basics' }
204
+ * ], {
205
+ * onProgress: (p) => console.log(`${p.status} ${p.progress}%`),
206
+ * });
207
+ * ```
208
+ */
209
+ createIndex(indexName: string, docs: DocumentInfo[], options?: CreateIndexOptions): Promise<MutationResult>;
210
+ /**
211
+ * Creates a new index by uploading raw files for server-side parsing and embedding.
212
+ *
213
+ * Handles the full flow: init → upload files → confirm → poll until complete.
214
+ * Returns when the index is ready.
215
+ *
216
+ * @param indexName - Name of the index to create.
217
+ * @param files - File descriptors. `name` and `contentType` are required on
218
+ * each; supply either `path` or `data`. Supported types are PDF and DOCX.
219
+ * @param options - Model ID (defaults to "moss-minilm"), extraction controls
220
+ * via `parseOptions`, and a progress callback.
221
+ * @returns Promise that resolves to MutationResult when the index is ready.
222
+ * @throws {Error} If files is empty, exceeds 20 files, or creation fails.
223
+ *
224
+ * @example
225
+ * ```typescript
226
+ * const result = await client.createIndexFromFiles('knowledge-base', [
227
+ * {
228
+ * name: 'report.pdf',
229
+ * contentType: 'application/pdf',
230
+ * path: '/docs/report.pdf',
231
+ * },
232
+ * {
233
+ * name: 'manual.docx',
234
+ * contentType:
235
+ * 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
236
+ * path: '/docs/manual.docx',
237
+ * },
238
+ * ]);
239
+ * ```
240
+ *
241
+ * @example Scanned documents with no text layer need OCR forced on.
242
+ * ```typescript
243
+ * await client.createIndexFromFiles('scans', files, {
244
+ * parseOptions: { ocrMode: 'full_ocr' },
245
+ * });
246
+ * ```
247
+ */
248
+ createIndexFromFiles(indexName: string, files: ParseFileInput[], options?: CreateIndexFromFilesOptions): Promise<MutationResult>;
249
+ /**
250
+ * Gets information about a specific index.
251
+ *
252
+ * @param indexName - Name of the index to retrieve.
253
+ * @returns Promise that resolves to IndexInfo object.
254
+ * @throws {Error} If the index does not exist.
255
+ *
256
+ * @example
257
+ * ```typescript
258
+ * const info = await client.getIndex('knowledge-base');
259
+ * console.log(`Index has ${info.docCount} documents`);
260
+ * ```
261
+ */
262
+ getIndex(indexName: string): Promise<IndexInfo>;
263
+ /**
264
+ * Lists all available indexes.
265
+ *
266
+ * @returns Promise that resolves to array of IndexInfo objects.
267
+ *
268
+ * @example
269
+ * ```typescript
270
+ * const indexes = await client.listIndexes();
271
+ * indexes.forEach(index => {
272
+ * console.log(`${index.name}: ${index.docCount} docs`);
273
+ * });
274
+ * ```
275
+ */
276
+ listIndexes(): Promise<IndexInfo[]>;
277
+ /**
278
+ * Deletes an index and all its data.
279
+ *
280
+ * @param indexName - Name of the index to delete.
281
+ * @returns Promise that resolves to true if successful.
282
+ * @throws {Error} If the index does not exist.
283
+ *
284
+ * @example
285
+ * ```typescript
286
+ * const deleted = await client.deleteIndex('old-index');
287
+ * ```
288
+ */
289
+ deleteIndex(indexName: string): Promise<boolean>;
290
+ /**
291
+ * Adds or updates documents in an index asynchronously.
292
+ *
293
+ * The index rebuild happens server-side. This method polls until
294
+ * the rebuild is complete and then returns.
295
+ *
296
+ * @param indexName - Name of the target index.
297
+ * @param docs - Documents to add or update.
298
+ * @param options - Optional configuration (upsert, onProgress callback).
299
+ * @returns Promise that resolves to MutationResult when the operation is complete.
300
+ * @throws {Error} If the index does not exist.
301
+ *
302
+ * @example
303
+ * ```typescript
304
+ * const result = await client.addDocs('knowledge-base', [
305
+ * { id: 'new-doc', text: 'New content to index' }
306
+ * ], { upsert: true });
307
+ * console.log(`Job ${result.jobId} completed`);
308
+ * ```
309
+ */
310
+ addDocs(indexName: string, docs: DocumentInfo[], options?: MutationOptions): Promise<MutationResult>;
311
+ /**
312
+ * Deletes documents from an index by their IDs asynchronously.
313
+ *
314
+ * The index rebuild happens server-side. This method polls until
315
+ * the rebuild is complete and then returns.
316
+ *
317
+ * @param indexName - Name of the target index.
318
+ * @param docIds - Array of document IDs to delete.
319
+ * @param options - Optional configuration (onProgress callback).
320
+ * @returns Promise that resolves to MutationResult when the operation is complete.
321
+ * @throws {Error} If the index does not exist.
322
+ *
323
+ * @example
324
+ * ```typescript
325
+ * const result = await client.deleteDocs('knowledge-base', ['doc1', 'doc2']);
326
+ * console.log(`Job ${result.jobId} completed`);
327
+ * ```
328
+ */
329
+ deleteDocs(indexName: string, docIds: string[], options?: MutationOptions): Promise<MutationResult>;
330
+ /**
331
+ * Gets the current status of an async job.
332
+ *
333
+ * @param jobId - The job ID returned by createIndex, addDocs, or deleteDocs.
334
+ * @returns Promise that resolves to JobStatusResponse with progress details.
335
+ *
336
+ * @example
337
+ * ```typescript
338
+ * const status = await client.getJobStatus(jobId);
339
+ * console.log(`${status.status} — ${status.progress}%`);
340
+ * ```
341
+ */
342
+ getJobStatus(jobId: string): Promise<JobStatusResponse>;
343
+ /**
344
+ * Retrieves documents from an index.
345
+ *
346
+ * @param indexName - Name of the target index.
347
+ * @param options - Optional configuration for retrieval.
348
+ * @returns Promise that resolves to array of documents.
349
+ * @throws {Error} If the index does not exist.
350
+ *
351
+ * @example
352
+ * ```typescript
353
+ * // Get all documents
354
+ * const allDocs = await client.getDocs('knowledge-base');
355
+ *
356
+ * // Get specific documents
357
+ * const specificDocs = await client.getDocs('knowledge-base', {
358
+ * docIds: ['doc1', 'doc2']
359
+ * });
360
+ * ```
361
+ */
362
+ getDocs(indexName: string, options?: GetDocumentsOptions): Promise<DocumentInfo[]>;
363
+ /**
364
+ * Downloads an index from the cloud into memory for fast local querying.
365
+ *
366
+ * **How it works:**
367
+ * 1. Fetches the index assets from the cloud
368
+ * 2. Loads the exact embedding model when the index has an immutable model
369
+ * artifact identity
370
+ * 3. Executes a local similarity match between the query embedding and the retrieved index.
371
+ *
372
+ * A foundation index without an exact artifact identity can still be loaded,
373
+ * but local queries must provide `QueryOptions.embedding`. The client will
374
+ * not generate an embedding from an unverified model artifact.
375
+ *
376
+ * **Why use this?**
377
+ * - `query()` requires a loaded index; without `loadIndex()` it rejects with a not-loaded error
378
+ * - With `loadIndex()`: Queries run entirely in-memory (~1-10ms) with no network round-trip
379
+ *
380
+ * **Reload behavior:**
381
+ * If the index is already loaded, calling `loadIndex()` again will:
382
+ * - Stop any existing auto-refresh polling
383
+ * - Download a fresh copy from the cloud
384
+ * - Replace the in-memory index
385
+ *
386
+ * **Auto-refresh (optional):**
387
+ * Enable `autoRefresh: true` to periodically poll the cloud for updates.
388
+ * When a newer version is detected, the index is automatically hot-swapped
389
+ * without interrupting queries.
390
+ *
391
+ * @param indexName - Name of the index to load.
392
+ * @param options - Optional configuration including auto-refresh settings.
393
+ * @returns Promise that resolves to the index name.
394
+ * @throws {Error} If the index does not exist in the cloud or loading fails.
395
+ *
396
+ * @example
397
+ * ```typescript
398
+ * // Simple load - enables fast local queries
399
+ * await client.loadIndex('my-index');
400
+ *
401
+ * // Now queries run locally (fast, no network calls)
402
+ * // A text-only query requires an exact immutable model artifact identity.
403
+ * const results = await client.query('my-index', 'search text');
404
+ *
405
+ * // Load with auto-refresh to keep index up-to-date
406
+ * await client.loadIndex('my-index', {
407
+ * autoRefresh: true,
408
+ * pollingIntervalInSeconds: 300, // Check cloud every 5 minutes
409
+ * });
410
+ *
411
+ * // Stop auto-refresh by reloading without the option
412
+ * await client.loadIndex('my-index');
413
+ * ```
414
+ */
415
+ loadIndex(indexName: string, options?: LoadIndexOptions): Promise<string>;
416
+ /**
417
+ * Loads several indexes into memory in one call. Best-effort: a name that
418
+ * fails (typo, deleted index, download error) is reported in `failed` and
419
+ * does not roll back the indexes that loaded. `options` apply to the whole
420
+ * batch, and each distinct embedding model is warmed once.
421
+ *
422
+ * @param indexNames - Names of the indexes to load.
423
+ * @param options - Auto-refresh and cache settings shared by the batch.
424
+ * @returns `{ loaded, failed }` where `failed` maps a name to its error.
425
+ *
426
+ * @example
427
+ * ```typescript
428
+ * const { loaded, failed } = await client.loadIndexes(['products', 'reviews']);
429
+ * ```
430
+ */
431
+ loadIndexes(indexNames: string[], options?: LoadIndexOptions): Promise<LoadIndexesResult>;
432
+ /**
433
+ * Removes a loaded index from memory and stops its auto-refresh poller.
434
+ * Subsequent `query` calls for that name fail until it is loaded again.
435
+ */
436
+ unloadIndex(indexName: string): Promise<void>;
437
+ /**
438
+ * Removes several loaded indexes from memory. Best-effort and idempotent:
439
+ * names that are not loaded are ignored.
440
+ */
441
+ unloadIndexes(indexNames: string[]): Promise<void>;
442
+ /**
443
+ * Performs a semantic similarity search against a locally loaded index.
444
+ *
445
+ * The index must have been loaded via `loadIndex()` or `loadIndexes()`;
446
+ * queries run entirely in-memory with no network round-trip. Querying an
447
+ * index that is not loaded rejects with an error naming the load call.
448
+ *
449
+ * Loaded foundation indexes require an exact model artifact identity before
450
+ * Moss can generate query embeddings locally. For an older identity-less
451
+ * index, provide a caller-generated vector through `options.embedding`.
452
+ *
453
+ * @param indexName - Name of the target index to search.
454
+ * @param query - The search query text.
455
+ * @param options - Optional query configuration including topK (default: 5) and embedding overrides.
456
+ * @returns Promise that resolves to SearchResult with matching documents.
457
+ * @throws {Error} If the index is not loaded.
458
+ *
459
+ * @example
460
+ * ```typescript
461
+ * await client.loadIndex('knowledge-base');
462
+ * const results = await client.query('knowledge-base', 'machine learning');
463
+ * results.docs.forEach(doc => {
464
+ * console.log(`${doc.id}: ${doc.text} (score: ${doc.score})`);
465
+ * });
466
+ * ```
467
+ */
468
+ query(indexName: string, query: string, options?: QueryOptions): Promise<SearchResult>;
469
+ /**
470
+ * Searches several loaded indexes in one call and returns the global top-k
471
+ * across all of them, with each result's `indexName` set to its source.
472
+ *
473
+ * All names must already be loaded (`loadIndex` / `loadIndexes`) and share
474
+ * the same embedding model; there is no cloud fallback. `options.alpha`
475
+ * works exactly as in `query` (default 0.8): `1.0` is embedding-only and
476
+ * returns raw cosine scores, `0.0` is keyword-only, and values in between
477
+ * fuse both signals with Reciprocal Rank Fusion. Keyword scoring runs each
478
+ * index's own BM25 and merges hits by score before fusion. `options.topK`
479
+ * (default 10) caps the merged result, not each index. `options.filter`
480
+ * applies uniformly to every index.
481
+ *
482
+ * @param indexNames - Names of the loaded indexes to search.
483
+ * @param query - The search query text.
484
+ * @param options - Optional topK, alpha, embedding, and filter.
485
+ * @returns SearchResult whose docs carry `indexName`.
486
+ * @throws {Error} If no names are given, a name is not loaded, or models differ.
487
+ *
488
+ * @example
489
+ * ```typescript
490
+ * await client.loadIndexes(['products', 'reviews']);
491
+ * const results = await client.queryMultiIndex(
492
+ * ['products', 'reviews'],
493
+ * 'noise cancelling headphones',
494
+ * { topK: 5, alpha: 0.5 },
495
+ * );
496
+ * results.docs.forEach(doc => console.log(doc.indexName, doc.id, doc.score));
497
+ * ```
498
+ */
499
+ queryMultiIndex(indexNames: string[], query: string, options?: QueryOptions): Promise<SearchResult>;
500
+ /**
501
+ * Create a local-first session index for real-time, in-process indexing
502
+ * and querying. The session starts empty; call `loadIndex` to pull an
503
+ * existing cloud index in, `addDocs` to populate, `query` to search,
504
+ * and `pushIndex` at session end to persist to the cloud.
505
+ *
506
+ * @param indexName Logical name for the session. Identifies the cloud
507
+ * index when `pushIndex` / `loadIndex` is called.
508
+ * @param modelId Embedding model to use. Defaults to `moss-minilm`.
509
+ * Pass `"custom"` if you'll supply embeddings yourself.
510
+ *
511
+ * Works with both a static project key and a custom `IAuthenticator`
512
+ * (the session authenticates via the same bridge as `loadIndex`).
513
+ *
514
+ * @example
515
+ * ```typescript
516
+ * const session = await client.session('chat-session-123');
517
+ * await session.addDocs([{ id: '1', text: 'Customer asked about billing' }]);
518
+ * const results = await session.query('billing question');
519
+ * await session.pushIndex();
520
+ * ```
521
+ */
522
+ session(indexName: string, modelId?: MossModel, modelArtifact?: ModelArtifactIdentity): Promise<SessionIndex>;
523
+ /**
524
+ * Release the client's native resources (the index manager's loaded
525
+ * indexes, pollers, and telemetry). Idempotent. All client methods
526
+ * reject with "MossClient is closed" afterwards. Does not stop the
527
+ * process-wide shared runtime.
528
+ *
529
+ * Also closes every live session created by this client (sessions can
530
+ * still be closed individually first; close is idempotent).
531
+ */
532
+ close(): Promise<void>;
533
+ [Symbol.asyncDispose](): Promise<void>;
534
+ }
535
+
536
+ export declare interface MossClientOptions {
537
+ /**
538
+ * Filesystem path under which Moss's stable device UUID persists
539
+ * (`<cachePath>/.moss-device-id`). It is emitted as `mossDeviceId`, and also
540
+ * as the billable `deviceId` when no host device id is configured. When
541
+ * omitted, `loadIndex` can use its `cachePath` only when it resolves the
542
+ * device ID first; a session created first uses the per-user location. Set
543
+ * this option to use one path consistently across client and session
544
+ * telemetry.
545
+ */
546
+ cachePath?: string;
547
+ /**
548
+ * Stable host identity attached to telemetry from this client and its
549
+ * sessions. `deviceId` is the billable MAD key. `userId` is optional and
550
+ * non-billable. Moss's own stable UUID is still sent as `mossDeviceId`.
551
+ */
552
+ identity?: MossIdentity;
553
+ }
554
+
555
+ /**
556
+ * Caller-managed stable identity for a MossClient lifetime. Supplied values
557
+ * must be 1-256 UTF-8 bytes with no leading or trailing whitespace, Unicode
558
+ * control or format characters, lone surrogates, or replacement characters.
559
+ */
560
+ export declare interface MossIdentity {
561
+ /** Stable device or app-installation id used for MAD billing. */
562
+ deviceId?: string;
563
+ /** Optional non-billable user grouping id. */
564
+ userId?: string;
565
+ }
566
+
567
+ /**
568
+ * Available embedding models for text-to-vector conversion.
569
+ *
570
+ * Each model offers different trade-offs between speed, accuracy, and resource usage:
571
+ *
572
+ * - **`"moss-minilm"`**: Lightweight model optimized for speed and efficiency.
573
+ * Best for applications requiring fast response times with moderate accuracy requirements.
574
+ *
575
+ * - **`"moss-mediumlm"`**: Balanced model offering higher accuracy with reasonable performance.
576
+ * Best for applications where search quality is important and moderate latency is acceptable.
577
+ *
578
+ * - **`"custom"`**: Use this when providing pre-computed embeddings from external sources.
579
+ * No embedding model is loaded. All documents must include embeddings, and all queries
580
+ * must provide embeddings via QueryOptions.embedding.
581
+ */
582
+ export declare type MossModel = "moss-minilm" | "moss-mediumlm" | "custom";
583
+
584
+ /**
585
+ * Options for async mutation operations (addDocs, deleteDocs).
586
+ * Extends moss-core MutationOptions with SDK-specific onProgress callback.
587
+ */
588
+ export declare interface MutationOptions {
589
+ /**
590
+ * Whether to update existing documents with the same ID.
591
+ * Only applies to addDocs.
592
+ * @default true
593
+ */
594
+ upsert?: boolean;
595
+ /**
596
+ * Callback invoked with progress updates (~every 2s) while the server is processing.
597
+ */
598
+ onProgress?: (progress: JobProgress) => void;
599
+ }
600
+
601
+ export { MutationResult }
602
+
603
+ /**
604
+ * Input descriptor for a single file in the parse pipeline.
605
+ *
606
+ * Either `path` (server/Node.js) or `data` (browser) must be provided.
607
+ * Supported `contentType` values are `"application/pdf"` and
608
+ * `"application/vnd.openxmlformats-officedocument.wordprocessingml.document"` (DOCX).
609
+ */
610
+ export declare interface ParseFileInput {
611
+ /**
612
+ * File identifier sent to the server. Required.
613
+ */
614
+ name: string;
615
+ /**
616
+ * MIME content type. Required. Supported values are `"application/pdf"` and
617
+ * `"application/vnd.openxmlformats-officedocument.wordprocessingml.document"` (DOCX).
618
+ */
619
+ contentType: string;
620
+ /**
621
+ * Filesystem path to the file (Node.js / server-side).
622
+ * Required when `data` is not provided.
623
+ */
624
+ path?: string;
625
+ /**
626
+ * Raw file bytes (browser / in-memory).
627
+ * Takes precedence over `path` when provided.
628
+ * Accepts `Uint8Array`, `ArrayBuffer`, `Blob`, or a browser `File` object.
629
+ */
630
+ data?: Uint8Array | ArrayBuffer | Blob | File;
631
+ }
632
+
633
+ /**
634
+ * Controls how the server extracts text from uploaded documents.
635
+ *
636
+ * Every field is optional; omitted fields use the server defaults.
637
+ */
638
+ export declare interface ParseOptions {
639
+ /**
640
+ * Slower, higher fidelity extraction. Useful for dense tables.
641
+ */
642
+ useHighResolution?: boolean;
643
+ /**
644
+ * How the document is segmented before extraction.
645
+ */
646
+ segmentationMethod?: "smart_layout_detection" | "page_by_page";
647
+ /**
648
+ * `"full_ocr"` forces OCR on every page, which is what scanned documents
649
+ * with no text layer need. `"auto_ocr"` runs it only where it looks
650
+ * necessary.
651
+ */
652
+ ocrMode?: "auto_ocr" | "full_ocr";
653
+ /**
654
+ * Merge a table split across a page break into a single segment.
655
+ */
656
+ mergeTables?: boolean;
657
+ }
658
+
659
+ export { PushIndexResult }
660
+
661
+ export { QueryOptions }
662
+
663
+ export { QueryResultDocumentInfo }
664
+
665
+ export { RefreshResult }
666
+
667
+ declare interface ResolvedTelemetryIdentity {
668
+ /** Billable MAD key: the caller's id when supplied, otherwise Moss's UUID. */
669
+ deviceId: string;
670
+ /** Caller-owned device id. Omitted when Moss's UUID remains billable. */
671
+ hostDeviceId?: string;
672
+ /** Moss's file-backed stable UUID, always retained for correlation. */
673
+ mossDeviceId: string;
674
+ userId?: string;
675
+ callerSupplied: boolean;
676
+ }
677
+
678
+ export { SearchResult }
679
+
680
+ /**
681
+ * A local in-session index for real-time indexing and querying.
682
+ *
683
+ * All operations (`addDocs`, `deleteDocs`, `query`) run entirely in
684
+ * process memory with no cloud round-trip. Call `pushIndex()` at the
685
+ * end of a session to persist the result to the cloud.
686
+ *
687
+ * @example
688
+ * ```typescript
689
+ * const session = await client.session('session-abc');
690
+ * await session.addDocs([
691
+ * { id: '1', text: 'Customer asked about billing' },
692
+ * ]);
693
+ * const results = await session.query('billing question');
694
+ * const result = await session.pushIndex();
695
+ * ```
696
+ */
697
+ export declare class SessionIndex {
698
+ #private;
699
+ /**
700
+ * @internal Construct via `MossClient.session()` — direct instantiation
701
+ * is intentionally unsupported so the auth context flows from the client.
702
+ */
703
+ constructor(name: string, modelId: MossModel, inner: SessionIndex_2);
704
+ /**
705
+ * @internal Factory used by `MossClient.session()`. Constructs the
706
+ * underlying Rust `SessionIndex` and wraps it. Async because the
707
+ * napi `SessionIndex.create` runs credential validation on a
708
+ * worker thread — `await`ing here keeps the Node main thread
709
+ * responsive while auth is in flight.
710
+ */
711
+ static _create(name: string, modelId: MossModel, projectId: string, projectKey: string, clientId?: string, identity?: ResolvedTelemetryIdentity, modelArtifact?: ModelArtifactIdentity): Promise<SessionIndex>;
712
+ /**
713
+ * @internal Wrap an already-constructed core `SessionIndex` — used for the
714
+ * custom-authenticator path, where `InternalMossClient` builds the core
715
+ * handle via the auth bridge (`SessionIndex.withAuthenticator`).
716
+ */
717
+ static _fromInner(name: string, modelId: MossModel, inner: SessionIndex_2, identity?: ResolvedTelemetryIdentity): SessionIndex;
718
+ /** The session index name. Identifies the cloud index on `pushIndex` / `loadIndex`. */
719
+ get name(): string;
720
+ /** Number of documents currently in the local session. */
721
+ get docCount(): number;
722
+ /** The embedding model this session is configured for. */
723
+ get modelId(): MossModel;
724
+ /**
725
+ * Add or update documents in the local session index.
726
+ *
727
+ * For models other than `"custom"`, embeddings are generated locally
728
+ * via the Rust core — no cloud round-trip. For `modelId="custom"`,
729
+ * each document **must** carry an `.embedding` field.
730
+ *
731
+ * @returns `{ added, updated }` counts.
732
+ */
733
+ addDocs(docs: DocumentInfo[], options?: MutationOptions): Promise<{
734
+ added: number;
735
+ updated: number;
736
+ }>;
737
+ /** Delete documents from the local session by id. Returns the number actually removed. */
738
+ deleteDocs(docIds: string[]): Promise<number>;
739
+ /** Fetch documents currently in the local session. Pass `options.docIds` to filter. */
740
+ getDocs(options?: GetDocumentsOptions): Promise<DocumentInfo[]>;
741
+ /**
742
+ * Hybrid (keyword + semantic) search over the local session index.
743
+ * Runs entirely in-memory, no cloud call.
744
+ *
745
+ * For `modelId="custom"`, an explicit `options.embedding` is required.
746
+ * For built-in models the query is embedded locally by the Rust core
747
+ * if `options.embedding` is omitted.
748
+ */
749
+ query(query: string, options?: QueryOptions): Promise<SearchResult>;
750
+ /**
751
+ * Load an existing cloud index into the session by name. With
752
+ * `options.autoRefresh = true`, the SDK polls the cloud index and
753
+ * pulls newer versions in on subsequent reads; the poller pauses
754
+ * while local un-pushed edits exist.
755
+ *
756
+ * @returns Number of documents loaded into the session.
757
+ */
758
+ loadIndex(indexName: string, options?: LoadSessionOptions): Promise<number>;
759
+ /**
760
+ * Upload the session to the cloud, creating or replacing the index
761
+ * with the same name. Documents are pushed with their locally-computed
762
+ * embeddings — no server-side re-embedding.
763
+ */
764
+ pushIndex(): Promise<PushIndexResult>;
765
+ /**
766
+ * Persist the session to `<cachePath>/<name>/` for offline reuse
767
+ * without a cloud round-trip.
768
+ */
769
+ saveToDisk(cachePath: string): Promise<void>;
770
+ /**
771
+ * Restore a session previously written by `saveToDisk`.
772
+ * @returns Number of documents loaded.
773
+ */
774
+ loadFromDisk(cachePath: string): Promise<number>;
775
+ /**
776
+ * Release the session's native resources deterministically: the
777
+ * auto-refresh poller, the in-memory index, and this session's
778
+ * reference to the shared embedding model. Safe to call more than
779
+ * once. Afterwards `name` and `modelId` stay readable (JS-side
780
+ * metadata); `docCount` and all methods throw "is closed".
781
+ *
782
+ * Also invoked by `await using` (Symbol.asyncDispose).
783
+ */
784
+ close(): Promise<void>;
785
+ [Symbol.asyncDispose](): Promise<void>;
786
+ /**
787
+ * @internal Pre-loads the bundled embedding model for built-in
788
+ * `modelId`s; no-op for `"custom"`. Called by `MossClient.session()`
789
+ * so the first `addDocs` / `query` doesn't pay cold-start latency.
790
+ */
791
+ _warmModel(): Promise<void>;
792
+ }
793
+
794
+ export { }
package/package.json ADDED
@@ -0,0 +1,72 @@
1
+ {
2
+ "name": "@moss-js/moss",
3
+ "version": "1.8.0",
4
+ "main": "dist/index.esm.js",
5
+ "module": "dist/index.esm.js",
6
+ "types": "dist/moss.d.ts",
7
+ "type": "module",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/moss.d.ts",
11
+ "node": "./dist/index.esm.js",
12
+ "default": "./dist/index.esm.js"
13
+ }
14
+ },
15
+ "scripts": {
16
+ "clean": "rimraf dist temp .log",
17
+ "build": "npm run build:types && npm run build:js && api-extractor run --local",
18
+ "build:dev": "npm run build:types && npm run build:js",
19
+ "build:watch": "tsx esbuild.watch.config.ts",
20
+ "build:types": "tsc --emitDeclarationOnly",
21
+ "build:js": "tsx esbuild.config.ts",
22
+ "test": "vitest run",
23
+ "test:watch": "vitest",
24
+ "lint": "eslint src/**/*.ts test/**/*.ts",
25
+ "run-query-sample": "tsx samples/query.ts",
26
+ "run-multi-index": "tsx samples/multiple-indexes.ts",
27
+ "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
28
+ "extract-api": "npm run build && api-extractor run --local",
29
+ "prepack": "npm run clean && npm run build",
30
+ "docs": "typedoc --options typedoc.json && mkdir -p ../../documentation/docs/public/reference/js/_media && cp LICENSE.txt ../../documentation/docs/public/reference/js/_media/LICENSE.txt"
31
+ },
32
+ "files": [
33
+ "dist/index.esm.js",
34
+ "dist/moss.d.ts",
35
+ "README.md",
36
+ "LICENSE.txt"
37
+ ],
38
+ "keywords": [
39
+ "search",
40
+ "semantic",
41
+ "embeddings",
42
+ "vector",
43
+ "inferedge"
44
+ ],
45
+ "author": "InferEdge Inc.",
46
+ "license": "SEE LICENSE IN LICENSE",
47
+ "dependencies": {
48
+ "@moss-js/moss-core": "0.24.0"
49
+ },
50
+ "devDependencies": {
51
+ "@eslint/js": "^9.39.4",
52
+ "@microsoft/api-extractor": "^7.58.9",
53
+ "@types/javascript-obfuscator": "^0.0.5",
54
+ "@types/node": "^22.20.0",
55
+ "dotenv": "^17.4.2",
56
+ "esbuild": "^0.28.1",
57
+ "esbuild-plugin-obfuscator": "^1.2.4",
58
+ "eslint": "^9.39.4",
59
+ "globals": "^16.5.0",
60
+ "prettier": "^3.9.4",
61
+ "rimraf": "^6.1.3",
62
+ "tsx": "^4.23.0",
63
+ "typedoc": "^0.28.20",
64
+ "typedoc-plugin-markdown": "^4.12.0",
65
+ "typescript": "^5.8.3",
66
+ "typescript-eslint": "^8.63.0",
67
+ "vitest": "^4.1.10"
68
+ },
69
+ "engines": {
70
+ "node": ">=20.4"
71
+ }
72
+ }