@moss-js/moss 1.16.1 → 1.17.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/README.md +9 -61
- package/dist/index.esm.js +1 -1
- package/dist/moss.d.ts +19 -6
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -100,67 +100,15 @@ device fields contain that Moss UUID.
|
|
|
100
100
|
|
|
101
101
|
## Telemetry
|
|
102
102
|
|
|
103
|
-
The SDK
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
one JSON array per request. The buffer holds up to 10,000 events between sends,
|
|
113
|
-
and events past that are dropped. Other events are sent one per request, when
|
|
114
|
-
the operation happens.
|
|
115
|
-
|
|
116
|
-
`close()` on a client or session resolves after that last send finishes, so
|
|
117
|
-
await it before the process exits. A process that exits without closing can
|
|
118
|
-
lose up to 3 seconds of query events. Each flush waits at most 5 seconds for
|
|
119
|
-
authentication and 3 seconds per request, and drops its events when either fails.
|
|
120
|
-
|
|
121
|
-
### Fields on every event
|
|
122
|
-
|
|
123
|
-
| Field | Value |
|
|
124
|
-
|---|---|
|
|
125
|
-
| `action` | Always `"telemetry"`. |
|
|
126
|
-
| `eventType` | The event type, from the table below. |
|
|
127
|
-
| `projectId` | Your project id. |
|
|
128
|
-
| `clientId`, `sessionId` | The same random id, one per client or session object. |
|
|
129
|
-
| `sdkVersion`, `sdkPackageVersion` | Version of the native binding package. |
|
|
130
|
-
| `nativeCoreVersion` | Version of the Rust core. |
|
|
131
|
-
| `modelCacheSchemaVersion` | Layout version of the on-disk model cache. |
|
|
132
|
-
| `deviceId` | Billable device id: your `identity.deviceId`, or else the Moss device UUID. |
|
|
133
|
-
| `mossDeviceId` | The Moss device UUID stored in `.moss-device-id`. |
|
|
134
|
-
| `userId` | Only when you set one. Never billable. |
|
|
135
|
-
| `indexName` | The index, when the event concerns one index. |
|
|
136
|
-
| `modelId`, `modelArtifactVersion`, `modelManifestSha256` | The embedding model and its exact artifact, when known. |
|
|
137
|
-
|
|
138
|
-
### Event types and their extra fields
|
|
139
|
-
|
|
140
|
-
| Event | Sent when | Extra fields |
|
|
141
|
-
|---|---|---|
|
|
142
|
-
| `index.load` | An index loads | `docCount`, `autoRefresh`, `refreshIntervalSecs` (with auto refresh), `cached` (a cache path was given), `servedStale` (served from the cache while the cloud is unreachable), `modelCacheGeneration` |
|
|
143
|
-
| `index.auto_refresh` | An auto refresh poll finishes | `changed`, `modelCacheGeneration` |
|
|
144
|
-
| `index.unload` | An index unloads or the client closes | `modelCacheGeneration` |
|
|
145
|
-
| `index.query` | A single-index query runs, sent in a batch | `latencyMs`, `modelCacheGeneration` |
|
|
146
|
-
| `index.query_multi` | A multi-index query runs, sent in a batch | The `index.query` fields, plus `indexCount` and `indexNames`. `modelCacheGeneration` when every index shares one, else `modelCacheGenerationsByIndex`. |
|
|
147
|
-
| `index.usage.periodic_flush`, `index.usage.final_flush` | Every 3 seconds while there is usage, and at close | `queryCount`, `docsEmbedded`, `tokensEstimated` |
|
|
148
|
-
| `session.load` | A session loads an index from the cloud | `docCount` |
|
|
149
|
-
| `session.load_from_disk` | A session loads a local snapshot | `docCount`, plus `rebuilt` and `persisted` when a legacy snapshot is rebuilt |
|
|
150
|
-
| `session.add_docs`, `session.delete_docs` | Documents are added or deleted | `docCount` |
|
|
151
|
-
| `session.push_index` | A session pushes its index | `docCount` |
|
|
152
|
-
| `session.auto_refresh_staged` | A newer cloud version is downloaded | `updatedAt` |
|
|
153
|
-
| `session.auto_refresh` | A downloaded version is installed | `changed`, `docCount`, `updatedAt` |
|
|
154
|
-
| `session.unload` | A session is closed | None |
|
|
155
|
-
| `session.query` | A session query runs, sent in a batch | `latencyMs` |
|
|
156
|
-
| `session.usage.periodic_flush`, `session.usage.final_flush` | Every 3 seconds while there is usage, at close, and before a push | `queryCount`, `docsEmbedded`, `tokensEstimated` |
|
|
157
|
-
|
|
158
|
-
`latencyMs` on a query event is the time that query took, in milliseconds.
|
|
159
|
-
`index.query` and `index.query_multi` time the whole call, including the query
|
|
160
|
-
embedding. `session.query` times the search lookup only, without embedding, so
|
|
161
|
-
the two are not directly comparable.
|
|
162
|
-
|
|
163
|
-
No document text, query text, metadata or embedding is ever sent.
|
|
103
|
+
The SDK always sends usage telemetry to the Moss cloud, and there is no option
|
|
104
|
+
to turn it off. It sends event types, your project id, index names, query and
|
|
105
|
+
document counts, query latencies, SDK and model versions, and a device id: a
|
|
106
|
+
random UUID stored on the device, or the `identity.deviceId` you supply, plus
|
|
107
|
+
`identity.userId` when you set one. Telemetry never includes query text,
|
|
108
|
+
document text, metadata, embeddings or file paths. Document text and embeddings
|
|
109
|
+
leave the device only when you create, add to or push an index in the cloud.
|
|
110
|
+
|
|
111
|
+
See [Telemetry](https://docs.moss.dev/docs/reference/telemetry) for every field and when it is sent.
|
|
164
112
|
|
|
165
113
|
## Resource cleanup
|
|
166
114
|
|
package/dist/index.esm.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const _0x5d9690=_0x1238;(function(_0x585173,_0x3ee1e0){const _0x153c3c=_0x1238,_0x468ea7=_0x585173();while(!![]){try{const _0x52eb24=-parseInt(_0x153c3c(0x16d))/0x1+parseInt(_0x153c3c(0x15a))/0x2+parseInt(_0x153c3c(0x14e))/0x3+-parseInt(_0x153c3c(0xbe))/0x4*(parseInt(_0x153c3c(0x13d))/0x5)+-parseInt(_0x153c3c(0xd8))/0x6*(-parseInt(_0x153c3c(0xec))/0x7)+-parseInt(_0x153c3c(0xbc))/0x8*(-parseInt(_0x153c3c(0xfd))/0x9)+-parseInt(_0x153c3c(0x15b))/0xa;if(_0x52eb24===_0x3ee1e0)break;else _0x468ea7['push'](_0x468ea7['shift']());}catch(_0x556d60){_0x468ea7['push'](_0x468ea7['shift']());}}}(_0x259c,0x25bbc));import{JobStatus as _0x600eb6}from'@moss-js/moss-core';import*as _0x1f7311 from'@moss-js/moss-core';import*as _0x2e5014 from'@moss-js/moss-core';var g=_0x2e5014,le=g['MODEL_DOWNLOAD_URL'],me=g[_0x5d9690(0x112)],he=g['CLOUD_API_IDENTITY_URL'],T=g[_0x5d9690(0x105)],ge=typeof process<'u'&&process[_0x5d9690(0x109)]['MOSS_INDEX_URL']||g[_0x5d9690(0xa7)],_=typeof process<'u'?process[_0x5d9690(0x109)]:{},I=class{constructor(_0x1bd776,_0x505f62){const _0x27ff82=_0x5d9690;this[_0x27ff82(0x108)]=_0x1bd776,this[_0x27ff82(0x9f)]=_0x505f62,this[_0x27ff82(0x16a)]=_[_0x27ff82(0xcc)]??T;}['projectId'];[_0x5d9690(0x9f)];[_0x5d9690(0x16a)];async[_0x5d9690(0x104)](){const _0x3b7566=_0x5d9690;let _0x5a0b8f=await fetch(this[_0x3b7566(0x16a)],{'method':_0x3b7566(0x158),'headers':{'Content-Type':_0x3b7566(0xa3)},'body':JSON[_0x3b7566(0x164)]({'projectId':this[_0x3b7566(0x108)],'projectKey':this[_0x3b7566(0x9f)]}),'signal':AbortSignal[_0x3b7566(0x128)](0x7530)});if(_0x5a0b8f['status']===0x191){let _0x50da1f=await _0x5a0b8f[_0x3b7566(0xcb)]();throw new Error(_0x3b7566(0x170)+_0x50da1f);}if(!_0x5a0b8f['ok']){let _0x4a0455=await _0x5a0b8f['text']();throw new Error(_0x3b7566(0xd1)+_0x5a0b8f[_0x3b7566(0xd4)]+':\x20'+_0x4a0455);}let _0x21db49=await _0x5a0b8f[_0x3b7566(0xd9)]();return{'token':_0x21db49['token'],'expiresIn':_0x21db49[_0x3b7566(0x131)]};}async[_0x5d9690(0x168)](){const _0x3764aa=_0x5d9690;let {token:_0x302343}=await this[_0x3764aa(0x104)]();return _0x3764aa(0xdb)+_0x302343;}},y=class{constructor(_0x23ef13){const _0x270965=_0x5d9690;this[_0x270965(0x15c)]=_0x23ef13;}[_0x5d9690(0x15c)];[_0x5d9690(0xc3)]=null;[_0x5d9690(0x103)]=null;async[_0x5d9690(0x104)](){const _0x4ab77e=_0x5d9690;if(this[_0x4ab77e(0xc3)]&&this[_0x4ab77e(0xc3)][_0x4ab77e(0xda)]>Date[_0x4ab77e(0x15d)]())return{'token':this[_0x4ab77e(0xc3)][_0x4ab77e(0x102)],'expiresIn':this[_0x4ab77e(0xc3)]['expiresIn']};if(this[_0x4ab77e(0x103)])return this[_0x4ab77e(0x103)];this[_0x4ab77e(0x103)]=this[_0x4ab77e(0x16b)]();try{return await this['inflight'];}finally{this[_0x4ab77e(0x103)]=null;}}async[_0x5d9690(0x168)](){const _0x21d9c5=_0x5d9690;let {token:_0x1a3b76}=await this[_0x21d9c5(0x104)]();return _0x21d9c5(0xdb)+_0x1a3b76;}async[_0x5d9690(0x16b)](){const _0x43fc62=_0x5d9690;let {token:_0x46ef0f,expiresIn:_0x3abd27}=await this['inner'][_0x43fc62(0x104)](),_0x38cbce=Date[_0x43fc62(0x15d)]()+(_0x3abd27-0x3c)*0x3e8;return this[_0x43fc62(0xc3)]={'token':_0x46ef0f,'expiresIn':_0x3abd27,'expiresAt':_0x38cbce},{'token':_0x46ef0f,'expiresIn':_0x3abd27};}};import{randomUUID as _0x38c13f}from'node:crypto';import{existsSync as _0x240a9d,mkdirSync as _0x48c409,readFileSync as _0x5ec0bd,writeFileSync as _0x13bee7}from'node:fs';import{join as _0x6fc023}from'node:path';var Y=_0x5d9690(0x132),S=0x100,k=/[\p{Cc}\p{Cf}\p{Cs}\uFFFD]/u;function Z(_0x42f45b){const _0x7fd596=_0x5d9690;return _0x42f45b[_0x7fd596(0x143)]>0x0&&_0x42f45b[_0x7fd596(0x10b)]()===_0x42f45b&&!k[_0x7fd596(0x166)](_0x42f45b)&&new TextEncoder()['encode'](_0x42f45b)[_0x7fd596(0xd3)]<=S;}function U(_0x29b246,_0x5757c4){const _0xa40f10=_0x5d9690;if(_0x29b246!==void 0x0){if(typeof _0x29b246!=_0xa40f10(0xe8)||_0x29b246['length']===0x0)throw new TypeError(_0xa40f10(0xe0)+_0x5757c4+'\x20must\x20be\x20a\x20non-empty\x20string');if(_0x29b246['trim']()!==_0x29b246)throw new TypeError(_0xa40f10(0xe0)+_0x5757c4+_0xa40f10(0x12f));if(k[_0xa40f10(0x166)](_0x29b246))throw new TypeError(_0xa40f10(0xe0)+_0x5757c4+_0xa40f10(0xab));if(new TextEncoder()['encode'](_0x29b246)['byteLength']>S)throw new TypeError(_0xa40f10(0xe0)+_0x5757c4+_0xa40f10(0xad)+S+_0xa40f10(0x134));return _0x29b246;}}function L(_0x2ae1fe){const _0x277dbd=_0x5d9690;if(_0x2ae1fe!==void 0x0){if(_0x2ae1fe===null||typeof _0x2ae1fe!='object'||Array[_0x277dbd(0x113)](_0x2ae1fe))throw new TypeError(_0x277dbd(0x11f));return Object['freeze']({'deviceId':U(_0x2ae1fe[_0x277dbd(0xe6)],_0x277dbd(0xe6)),'userId':U(_0x2ae1fe[_0x277dbd(0x161)],_0x277dbd(0x161))});}}function N(_0x4072a5){const _0x55d126=_0x5d9690;return _0x4072a5?.[_0x55d126(0xe6)]!==void 0x0||_0x4072a5?.[_0x55d126(0x161)]!==void 0x0;}function A(_0x7c9ef0){const _0x18b1f6=_0x5d9690;if(!_0x7c9ef0?.['trim']())return;let _0x68fff4=_0x6fc023(_0x7c9ef0,Y);try{if(_0x240a9d(_0x68fff4)){let _0x513247=_0x5ec0bd(_0x68fff4,_0x18b1f6(0x121))[_0x18b1f6(0x10b)]();return Z(_0x513247)?_0x513247:void 0x0;}_0x48c409(_0x7c9ef0,{'recursive':!0x0});let _0x7d679e=_0x38c13f();return _0x13bee7(_0x68fff4,_0x7d679e,_0x18b1f6(0x121)),_0x7d679e;}catch{return;}}var ee=0x1;function x(_0x28add3){const _0x3a9c73=_0x5d9690;let _0x334374=_0x28add3['modelArtifactContractVersion'];if(typeof _0x334374!=_0x3a9c73(0x154))throw q();let _0x3b22d8=_0x334374[_0x3a9c73(0xbd)](_0x28add3);if(!Number[_0x3a9c73(0xce)](_0x3b22d8)||_0x3b22d8<ee)throw q();}function q(){const _0x4d0bf1=_0x5d9690;return new Error(_0x4d0bf1(0xe3));}var Pe=0x708*0x3e8,te={'INVALID_ARGUMENT':!0x0,'NOT_FOUND':!0x0,'UNAUTHORIZED':!0x0,'NETWORK':!0x0,'DESERIALIZATION':!0x0,'MODEL_UNAVAILABLE':!0x0,'INTERNAL':!0x0},ne=new Set(Object['keys'](te));function re(_0x124d4b){const _0x434afa=_0x5d9690;if(!(_0x124d4b instanceof Error))return!0x1;let _0x25b3fd=_0x124d4b[_0x434afa(0xed)];return typeof _0x25b3fd==_0x434afa(0xe8)&&ne['has'](_0x25b3fd);}function p(_0x29aa5e,_0x529a61){return Object['assign'](new Error(_0x529a61),{'code':_0x29aa5e});}function b(_0x51d7a4){const _0x1e1c75=_0x5d9690;if(!(_0x51d7a4?.[_0x1e1c75(0xdc)]===void 0x0&&_0x51d7a4?.['candidateDepth']===void 0x0))return{'minScore':_0x51d7a4[_0x1e1c75(0xdc)],'candidateDepth':_0x51d7a4['candidateDepth']};}function _0x259c(){const _0x36513f=['warn','loadIndexes','data','609006HyBbtI','contentType','PendingUpload','loadModel','IndexManager','\x27\x20is\x20closed','function','received\x20','authenticator','then','POST','createIndex','412348fpUHsh','4689620KpJqog','inner','now','error','wrapProgress','replace','userId','number','INVALID_ARGUMENT','stringify','addDocs','test','toLowerCase','getAuthHeader','ensureCachePathDeviceId','authUrl','fetchAndCache','cachePathDeviceId','80595hlWlaO','query','queryText','Authentication\x20failed\x20(HTTP\x20401):\x20','asyncDispose','parseDocuments','moss-core\x20runtime\x20is\x20missing\x20ManageClient/IndexManager\x20exports','embedding','refreshCadence','HTTP\x20error!\x20status:\x20','projectKey','includePaths','added','sources','application/json','requireMultiIndexCore','pushIndex','resync','CLOUD_API_INDEX_URL','getJobStatus','respectRobots','pending_upload','\x20contains\x20an\x20unsupported\x20character','listWebSources','\x20must\x20be\x20at\x20most\x20','maxDepth','inspectSnapshot','createIndexFromFiles','from','ManageClient','received\x20a\x20progress\x20event\x20with\x20a\x20missing\x20or\x20empty\x20status\x20(','Index\x20\x22','getDocs','entries','addDocs\x20requires\x20at\x20least\x20one\x20document','updateWebSource','currentPhase','addDocuments','updated','166888MMbpgW','call','678412jEhNcq','deviceIdentity','docCount','\x27\x20returned\x20by\x20moss-core','createAuthenticatedSessionInner','cache','_warmModel','moss-core\x20rejected\x20the\x20auth\x20token:\x20','createWebSource','path','manageClient','default','map','text','MOSS_AUTH_URL','building','isSafeInteger','deleteWebSource','progress','HTTP\x20','createIndex\x20requires\x20at\x20least\x20one\x20document','byteLength','status','completed','\x22\x20is\x20not\x20loaded.\x20Call\x20loadIndex(\x22','topK','1660746lIynub','json','expiresAt','Bearer\x20','minScore','startsWith','\x22)\x20or\x20loadIndexes([...])\x20before\x20querying;\x20queries\x20run\x20locally\x20and\x20there\x20is\x20no\x20cloud\x20query\x20fallback.','[moss]\x20Auth\x20request\x20','MossClient\x20options.identity.','loadIndex','hasCustomAuthenticator','The\x20installed\x20@moss-js/moss-core\x20runtime\x20does\x20not\x20support\x20exact\x20model\x20artifact\x20identities.\x20Upgrade\x20moss-core\x20before\x20creating\x20this\x20session.','queryMultiIndex','message','deviceId','Documents\x20missing\x20.embedding\x20for\x20custom\x20model:\x20','string','applySessionIdentity','Web\x20source\x20methods\x20require\x20a\x20project\x20key.\x20Construct\x20MossClient\x20with\x20(projectId,\x20projectKey).','[moss]\x20Dropping\x20a\x20malformed\x20job\x20progress\x20event;\x20progress\x20reporting\x20may\x20be\x20incomplete\x20for\x20this\x20operation.\x20Cause:\x20','7XrwjPx','code','getWebSource','mossDeviceId','rebuildLegacy','modelId','some','unloadIndex','rootUrl','deleteDocuments','normalizeJobStatus','setIdentity','moss-core\x20runtime\x20is\x20missing\x20resolveAuthRequest/rejectAuthRequest\x20exports.\x20Ensure\x20you\x20are\x20using\x20a\x20moss-core\x20build\x20that\x20supports\x20custom\x20authenticators.','fromEntries','name','upsert','withAuthenticator','81ubvxEA','loadFromDisk','received\x20a\x20progress\x20event\x20with\x20a\x20missing\x20or\x20empty\x20jobId\x20(','moss-core\x20runtime\x20SessionIndex\x20is\x20missing\x20the\x20withAuthenticator\x20factory.\x20Upgrade\x20@moss-js/moss-core\x20to\x20a\x20build\x20that\x20supports\x20custom\x20authenticators\x20for\x20sessions.','close','token','inflight','getAuthToken','CLOUD_API_AUTH_URL','onProgress','version','projectId','env','The\x20installed\x20@moss-js/moss-core\x20does\x20not\x20support\x20multi-index\x20operations\x20(queryMultiIndex,\x20loadIndexes,\x20unloadIndexes).\x20Upgrade\x20@moss-js/moss-core.','trim','saveToDisk','[moss]\x20Ignoring\x20an\x20auth\x20request\x20with\x20no\x20usable\x20request\x20id;\x20custom\x20authentication\x20may\x20be\x20unavailable\x20for\x20this\x20client.\x20Cause:\x20','indexName','maxPages','indexManager','ManageApiError','SDK_VERSION_NUMBER','isArray','@moss-js/moss-core\x20>=\x200.20.0\x20is\x20required\x20for\x20MossClient.close()','_fromInner','_create','deleteIndex','getDocuments','resyncWebSource','maxDocuments','queryMultiIndexText','authNotifyFn','queryMultiIndex\x20requires\x20at\x20least\x20one\x20index\x20name','alpha','MossClient\x20options.identity\x20must\x20be\x20an\x20object','rejectAuthRequest','utf8','custom','deleteDocs\x20requires\x20at\x20least\x20one\x20document\x20ID','moss-core\x20runtime\x20ManageClient/IndexManager\x20is\x20missing\x20withAuthenticator\x20factory.\x20Ensure\x20you\x20are\x20using\x20a\x20moss-core\x20build\x20that\x20supports\x20custom\x20authenticators.','pendingupload','addDocumentsText','excludePaths','timeout','jobId','getIndex','applyIdentity','Uploading','received\x20a\x20progress\x20event\x20with\x20a\x20non-string\x20currentPhase\x20(','SessionIndex','\x20must\x20not\x20have\x20leading\x20or\x20trailing\x20whitespace','received\x20a\x20progress\x20event\x20with\x20a\x20non-finite\x20progress\x20value\x20(','expiresIn','.moss-device-id','identity','\x20UTF-8\x20bytes','bind','toByteArray','NOT_FOUND','unloadIndexes','hasIndex','slice','createIndexFromFiles\x20requires\x20at\x20least\x20one\x20file','resolveAuthRequest','5QrMneE','manifestSha256','filter','body','configuredIdentity','listIndexes','length','This\x20session\x20uses\x20custom\x20embeddings.\x20Provide\x20a\x20query\x20embedding\x20via\x20QueryOptions.embedding.','deleteDocs','uploading','cachePath','all','arrayBuffer','MossClient\x20is\x20closed'];_0x259c=function(){return _0x36513f;};return _0x259c();}function D(_0x3eefdb){const _0x2a3eed=_0x5d9690;return _0x3eefdb instanceof Error?_0x3eefdb[_0x2a3eed(0xe5)]:String(_0x3eefdb);}function se(_0xfc92cc){const _0x2e8f83=_0x5d9690;if(_0xfc92cc===null||typeof _0xfc92cc!='object')return _0x2e8f83(0x155)+String(_0xfc92cc);if(Array['isArray'](_0xfc92cc))return'received\x20an\x20array\x20where\x20a\x20JobProgress\x20object\x20was\x20expected';let _0x34c687=_0xfc92cc;return typeof _0x34c687[_0x2e8f83(0x129)]!=_0x2e8f83(0xe8)||_0x34c687[_0x2e8f83(0x129)]['length']===0x0?_0x2e8f83(0xff)+String(_0x34c687[_0x2e8f83(0x129)])+')':typeof _0x34c687[_0x2e8f83(0xd4)]!=_0x2e8f83(0xe8)||_0x34c687[_0x2e8f83(0xd4)][_0x2e8f83(0x143)]===0x0?_0x2e8f83(0xb3)+String(_0x34c687[_0x2e8f83(0xd4)])+')':typeof _0x34c687[_0x2e8f83(0xd0)]!=_0x2e8f83(0x162)||!Number['isFinite'](_0x34c687[_0x2e8f83(0xd0)])?_0x2e8f83(0x130)+String(_0x34c687[_0x2e8f83(0xd0)])+')':_0x34c687[_0x2e8f83(0xb9)]!==void 0x0&&_0x34c687[_0x2e8f83(0xb9)]!==null&&typeof _0x34c687[_0x2e8f83(0xb9)]!=_0x2e8f83(0xe8)?_0x2e8f83(0x12d)+String(_0x34c687['currentPhase'])+')':null;}var w=class{[_0x5d9690(0x156)];['manageClient'];[_0x5d9690(0x110)];[_0x5d9690(0x16c)];['configuredIdentity'];[_0x5d9690(0x108)];[_0x5d9690(0x11c)];constructor(_0x567e65,_0x395bb7,_0xcd974){const _0x51a82f=_0x5d9690;this[_0x51a82f(0x141)]=L(_0xcd974?.[_0x51a82f(0x133)]),this['cachePathDeviceId']=A(_0xcd974?.['cachePath']),this[_0x51a82f(0x108)]=_0x567e65;let _0x342df6=typeof _0x395bb7=='string'?new I(_0x567e65,_0x395bb7):_0x395bb7;this['authenticator']=new y(_0x342df6);let _0x295990=_0x1f7311,_0x3fe737=_0x295990['ManageClient']??_0x295990[_0x51a82f(0xc9)]?.[_0x51a82f(0xb2)],_0x3bdeb6=_0x295990[_0x51a82f(0x152)]??_0x295990['default']?.[_0x51a82f(0x152)];if(!_0x3fe737||!_0x3bdeb6)throw new Error(_0x51a82f(0x173));if(typeof _0x395bb7==_0x51a82f(0xe8))this[_0x51a82f(0xc8)]=new _0x3fe737(_0x567e65,_0x395bb7),this['indexManager']=new _0x3bdeb6(_0x567e65,_0x395bb7);else{let _0x2c7eac=_0x295990['resolveAuthRequest']??_0x295990['default']?.[_0x51a82f(0x13c)],_0x395ec4=_0x295990[_0x51a82f(0x120)]??_0x295990[_0x51a82f(0xc9)]?.[_0x51a82f(0x120)];if(!_0x2c7eac||!_0x395ec4)throw new Error(_0x51a82f(0xf8));let _0xbf8a68=this['authenticator'],_0x55f45a=(_0x353b2b,_0x5ef217)=>{const _0x586717=_0x51a82f;try{_0x395ec4(_0x353b2b,_0x5ef217);}catch(_0x51b4d0){console['warn'](_0x586717(0xdf)+_0x353b2b+'\x20could\x20not\x20be\x20settled:\x20'+D(_0x51b4d0));}},_0x1814ee=(_0x2d65ee,_0x2d98b4)=>{const _0x14fb01=_0x51a82f;try{_0x2c7eac(_0x2d65ee,_0x2d98b4);}catch(_0x369d46){_0x55f45a(_0x2d65ee,_0x14fb01(0xc5)+D(_0x369d46));}},_0x12f16d=!0x1,_0x105f62=(_0x6f1beb,_0x1b2339)=>{const _0x4f35fa=_0x51a82f;if(_0x6f1beb||!Number[_0x4f35fa(0xce)](_0x1b2339)||_0x1b2339<0x0){_0x12f16d||(_0x12f16d=!0x0,console[_0x4f35fa(0x14b)](_0x4f35fa(0x10d)+(_0x6f1beb?_0x6f1beb[_0x4f35fa(0xe5)]:_0x4f35fa(0x155)+String(_0x1b2339))));return;}_0xbf8a68['getAuthHeader']()[_0x4f35fa(0x157)](_0x2f20be=>{const _0x44b38a=_0x4f35fa;let _0x523d9f=_0x2f20be[_0x44b38a(0xdd)](_0x44b38a(0xdb))?_0x2f20be[_0x44b38a(0x13a)](0x7):_0x2f20be;_0x1814ee(_0x1b2339,_0x523d9f);},_0x445a0f=>_0x55f45a(_0x1b2339,D(_0x445a0f)));};this[_0x51a82f(0x11c)]=_0x105f62;let _0x51d358=_0x3fe737,_0x37c960=_0x3bdeb6;if(!_0x51d358[_0x51a82f(0xfc)]||!_0x37c960[_0x51a82f(0xfc)])throw new Error(_0x51a82f(0x124));this[_0x51a82f(0xc8)]=_0x51d358[_0x51a82f(0xfc)](_0x567e65,_0x105f62),this[_0x51a82f(0x110)]=_0x37c960[_0x51a82f(0xfc)](_0x567e65,_0x105f62);}this[_0x51a82f(0x12b)](this[_0x51a82f(0x110)]);}async[_0x5d9690(0x101)](){const _0x10aafb=_0x5d9690;let _0xdc4708=this[_0x10aafb(0x110)][_0x10aafb(0x101)];if(typeof _0xdc4708!=_0x10aafb(0x154))throw new Error(_0x10aafb(0x114));await _0xdc4708[_0x10aafb(0xbd)](this['indexManager']);}async[_0x5d9690(0x104)](){const _0x3bc3f5=_0x5d9690;return this['authenticator'][_0x3bc3f5(0x104)]();}[_0x5d9690(0x15f)](_0xc1f191){if(!_0xc1f191)return;let _0x58434b=!0x1;return(_0x29cb86,_0x1261af)=>{const _0xc90f7f=_0x1238;let _0x2d69dd=_0x29cb86?_0x29cb86[_0xc90f7f(0xe5)]:se(_0x1261af);if(_0x2d69dd!==null){_0x58434b||(_0x58434b=!0x0,console[_0xc90f7f(0x14b)](_0xc90f7f(0xeb)+_0x2d69dd));return;}_0xc1f191(_0x1261af);};}[_0x5d9690(0xf6)](_0x1d5698){const _0x388600=_0x5d9690;let _0x3987af=_0x1d5698[_0x388600(0x10b)]()[_0x388600(0x167)]()['replace'](/\s+/g,'_'),_0x1b0f79=_0x3987af[_0x388600(0x160)](/_/g,'');if(_0x3987af===_0x388600(0xaa)||_0x1b0f79===_0x388600(0x125))return _0x600eb6[_0x388600(0x150)];if(_0x3987af===_0x388600(0x146))return _0x600eb6[_0x388600(0x12c)];if(_0x3987af===_0x388600(0xcd))return _0x600eb6['Building'];if(_0x3987af===_0x388600(0xd5))return _0x600eb6['Completed'];if(_0x3987af==='failed')return _0x600eb6['Failed'];throw new Error('Unsupported\x20job\x20status\x20\x27'+_0x1d5698+_0x388600(0xc1));}async[_0x5d9690(0x159)](_0xdd023c,_0x3820f7,_0x2496d2,_0x2c121a){const _0x29c84b=_0x5d9690;if(!_0x3820f7[_0x29c84b(0x143)])throw new Error(_0x29c84b(0xd2));return await this['manageClient'][_0x29c84b(0x159)](_0xdd023c,_0x3820f7,_0x2496d2,this['wrapProgress'](_0x2c121a?.[_0x29c84b(0x106)]));}async[_0x5d9690(0x136)](_0x2b2e3d){const _0x26b7a9=_0x5d9690;if(_0x2b2e3d instanceof Uint8Array)return Array['from'](_0x2b2e3d);if(_0x2b2e3d instanceof ArrayBuffer)return Array[_0x26b7a9(0xb1)](new Uint8Array(_0x2b2e3d));if(typeof _0x2b2e3d[_0x26b7a9(0x149)]==_0x26b7a9(0x154)){let _0x134cdb=await _0x2b2e3d['arrayBuffer']();return Array[_0x26b7a9(0xb1)](new Uint8Array(_0x134cdb));}throw new Error('Unsupported\x20data\x20type\x20for\x20file\x20upload');}async[_0x5d9690(0xb0)](_0x9671cc,_0xec2d91,_0x384153){const _0x45c5cf=_0x5d9690;if(_0xec2d91['length']===0x0)throw new Error(_0x45c5cf(0x13b));let _0x5e9280=_0x384153?.[_0x45c5cf(0xf1)]??'moss-minilm',_0x509c5b=await Promise[_0x45c5cf(0x148)](_0xec2d91['map'](async _0x5f1c3f=>({'name':_0x5f1c3f[_0x45c5cf(0xfa)],'contentType':_0x5f1c3f[_0x45c5cf(0x14f)],'path':_0x5f1c3f[_0x45c5cf(0xc7)]??void 0x0,'data':_0x5f1c3f[_0x45c5cf(0x14d)]!=null?await this[_0x45c5cf(0x136)](_0x5f1c3f['data']):void 0x0})));return await this[_0x45c5cf(0xc8)][_0x45c5cf(0xb0)](_0x9671cc,_0x509c5b,_0x5e9280,this[_0x45c5cf(0x15f)](_0x384153?.[_0x45c5cf(0x106)]),_0x384153?.['parseOptions']??null);}async[_0x5d9690(0x165)](_0x4396e4,_0x224f74,_0x2145f6){const _0x459559=_0x5d9690;if(Array[_0x459559(0x113)](_0x224f74)&&_0x224f74[_0x459559(0x143)]===0x0)throw new Error(_0x459559(0xb7));return await this['manageClient'][_0x459559(0x165)](_0x4396e4,_0x224f74,_0x2145f6??null,this['wrapProgress'](_0x2145f6?.[_0x459559(0x106)]));}async[_0x5d9690(0x145)](_0x2b1a36,_0x13cfde,_0x56815d){const _0x692cca=_0x5d9690;if(Array[_0x692cca(0x113)](_0x13cfde)&&_0x13cfde[_0x692cca(0x143)]===0x0)throw new Error(_0x692cca(0x123));return await this[_0x692cca(0xc8)]['deleteDocs'](_0x2b1a36,_0x13cfde,this['wrapProgress'](_0x56815d?.[_0x692cca(0x106)]));}async[_0x5d9690(0xa8)](_0x5624eb){const _0x45579a=_0x5d9690;let _0x400b87=await this[_0x45579a(0xc8)][_0x45579a(0xa8)](_0x5624eb);return{..._0x400b87,'status':this[_0x45579a(0xf6)](_0x400b87[_0x45579a(0xd4)]),'currentPhase':_0x400b87[_0x45579a(0xb9)]??null,'error':_0x400b87[_0x45579a(0x15e)]??null};}async['getIndex'](_0x260f74){const _0x5180ad=_0x5d9690;return this[_0x5180ad(0xc8)]['getIndex'](_0x260f74);}async['listIndexes'](){const _0x49a987=_0x5d9690;return this['manageClient'][_0x49a987(0x142)]();}async[_0x5d9690(0x117)](_0x20e69e){const _0x23e6f9=_0x5d9690;return this['manageClient'][_0x23e6f9(0x117)](_0x20e69e);}async[_0x5d9690(0xb5)](_0x4a3a55,_0x23a6ec){const _0x50c356=_0x5d9690;return this[_0x50c356(0xc8)][_0x50c356(0xb5)](_0x4a3a55,_0x23a6ec??null);}async['loadIndex'](_0x8e2571,_0xaa4ed5){const _0x23f563=_0x5d9690;return this[_0x23f563(0x169)](_0xaa4ed5?.[_0x23f563(0x147)]),(await this[_0x23f563(0x110)][_0x23f563(0xe1)](_0x8e2571,_0xaa4ed5??null))[_0x23f563(0xfa)];}async[_0x5d9690(0x14c)](_0x4f9377,_0x4ba712){const _0x55a06e=_0x5d9690;let _0x32fc82=this['requireMultiIndexCore']();return this[_0x55a06e(0x169)](_0x4ba712?.['cachePath']),_0x32fc82[_0x55a06e(0x14c)](_0x4f9377,_0x4ba712??null);}async[_0x5d9690(0xf3)](_0xdaa616){const _0x4d2998=_0x5d9690;return this[_0x4d2998(0x110)][_0x4d2998(0xf3)](_0xdaa616);}async['unloadIndexes'](_0x587c01){const _0x30511f=_0x5d9690;return this[_0x30511f(0xa4)]()[_0x30511f(0x138)](_0x587c01);}[_0x5d9690(0xa4)](){const _0x18ed68=_0x5d9690;let _0x2c7244=this[_0x18ed68(0x110)];if(typeof _0x2c7244['queryMultiIndex']!='function'||typeof _0x2c7244[_0x18ed68(0x11b)]!=_0x18ed68(0x154)||typeof _0x2c7244[_0x18ed68(0x14c)]!=_0x18ed68(0x154)||typeof _0x2c7244[_0x18ed68(0x138)]!=_0x18ed68(0x154))throw new Error(_0x18ed68(0x10a));return{'queryMultiIndex':_0x2c7244['queryMultiIndex'][_0x18ed68(0x135)](_0x2c7244),'queryMultiIndexText':_0x2c7244[_0x18ed68(0x11b)][_0x18ed68(0x135)](_0x2c7244),'loadIndexes':_0x2c7244[_0x18ed68(0x14c)][_0x18ed68(0x135)](_0x2c7244),'unloadIndexes':_0x2c7244[_0x18ed68(0x138)][_0x18ed68(0x135)](_0x2c7244)};}[_0x5d9690(0x169)](_0x2cf27a){const _0x10da82=_0x5d9690;_0x2cf27a&&this[_0x10da82(0x16c)]===void 0x0&&A(_0x2cf27a);}[_0x5d9690(0x12b)]=_0x2ae6f0=>{const _0x1ecbe4=_0x5d9690;!N(this[_0x1ecbe4(0x141)])&&this['cachePathDeviceId']===void 0x0||_0x2ae6f0['setIdentity'](this[_0x1ecbe4(0x141)]?.[_0x1ecbe4(0xe6)]??null,this['configuredIdentity']?.['userId']??null,this[_0x1ecbe4(0x16c)]??null);};['applySessionIdentity']=_0x562794=>{const _0x1feb0c=_0x5d9690;let _0x434daf=this['indexManager'][_0x1feb0c(0xbf)]?.();if(!_0x434daf){this[_0x1feb0c(0x12b)](_0x562794);return;}_0x562794[_0x1feb0c(0xf7)](_0x434daf[_0x1feb0c(0xe6)]??null,this[_0x1feb0c(0x141)]?.[_0x1feb0c(0x161)]??null,_0x434daf[_0x1feb0c(0xef)]??null);};[_0x5d9690(0xe2)](){return this['authNotifyFn']!==void 0x0;}async[_0x5d9690(0xc2)](_0x2e44de,_0x58bfbb,_0x490628){const _0x1b3978=_0x5d9690;if(!this[_0x1b3978(0x11c)])throw new Error('createAuthenticatedSessionInner\x20requires\x20a\x20custom\x20IAuthenticator\x20client');let _0xfaf577=_0x1f7311,_0x44f556=_0xfaf577[_0x1b3978(0x12e)]??_0xfaf577[_0x1b3978(0xc9)]?.['SessionIndex'];if(!_0x44f556||typeof _0x44f556[_0x1b3978(0xfc)]!='function')throw new Error(_0x1b3978(0x100));return _0x490628&&x(_0x44f556),_0x44f556[_0x1b3978(0xfc)](_0x2e44de,_0x58bfbb,this[_0x1b3978(0x108)],this[_0x1b3978(0x11c)],null,null,_0x490628?.[_0x1b3978(0x107)]??null,_0x490628?.[_0x1b3978(0x13e)]??null);}async[_0x5d9690(0x16e)](_0x3f09c4,_0x3c3430,_0x328f65){const _0x55a838=_0x5d9690;if(!await this['indexManager'][_0x55a838(0x139)](_0x3f09c4))throw p(_0x55a838(0x137),_0x55a838(0xb4)+_0x3f09c4+_0x55a838(0xd6)+_0x3f09c4+_0x55a838(0xde));let _0x58d23b=_0x328f65?.[_0x55a838(0xd7)]??0x5,_0x110f4c=_0x328f65?.[_0x55a838(0x11e)]??0.8;return _0x328f65?.[_0x55a838(0x174)]?this[_0x55a838(0x110)][_0x55a838(0x16e)](_0x3f09c4,_0x3c3430,_0x328f65[_0x55a838(0x174)],_0x58d23b,_0x110f4c,_0x328f65?.['filter'],b(_0x328f65)):this['indexManager'][_0x55a838(0x16f)](_0x3f09c4,_0x3c3430,_0x58d23b,_0x110f4c,_0x328f65?.[_0x55a838(0x13f)],b(_0x328f65));}async[_0x5d9690(0xe4)](_0x283b1d,_0x231230,_0x46aac3){const _0x42a94f=_0x5d9690;if(_0x283b1d['length']===0x0)throw p(_0x42a94f(0x163),_0x42a94f(0x11d));let _0x183f64=this[_0x42a94f(0xa4)](),_0x1657e9=_0x46aac3?.[_0x42a94f(0xd7)]??0xa,_0x4ab51c=_0x46aac3?.[_0x42a94f(0x11e)]??0.8;return _0x46aac3?.[_0x42a94f(0x174)]?_0x183f64[_0x42a94f(0xe4)](_0x283b1d,_0x231230,_0x46aac3[_0x42a94f(0x174)],_0x1657e9,_0x4ab51c,_0x46aac3?.['filter'],b(_0x46aac3)):_0x183f64[_0x42a94f(0x11b)](_0x283b1d,_0x231230,_0x1657e9,_0x4ab51c,_0x46aac3?.[_0x42a94f(0x13f)],b(_0x46aac3));}};import{SessionIndex as _0x4f3d4d}from'@moss-js/moss-core';var h=class r{#e;#r;#s;#i=!0x1;#a;constructor(_0x49bd6c,_0x382a9f,_0x4fb340){this.#s=_0x49bd6c,this.#r=_0x382a9f,this.#e=_0x4fb340;}static async['_create'](_0x2866cd,_0x588ec3,_0x2a3f4f,_0x4c78e2,_0xf42072,_0x3ce766,_0x8136c1){const _0x4680da=_0x5d9690;let _0x45f3d4=_0x4f3d4d;_0x8136c1&&x(_0x45f3d4);let _0x5a3407=await _0x45f3d4['create'](_0x2866cd,_0x588ec3,_0x2a3f4f,_0x4c78e2,_0xf42072??null,_0x8136c1?.[_0x4680da(0x107)]??null,_0x8136c1?.[_0x4680da(0x13e)]??null);return r[_0x4680da(0x115)](_0x2866cd,_0x588ec3,_0x5a3407,_0x3ce766);}static[_0x5d9690(0x115)](_0x52d8a9,_0x4471cf,_0x54a2c9,_0x599e2e){return _0x599e2e?.(_0x54a2c9),new r(_0x52d8a9,_0x4471cf,_0x54a2c9);}get[_0x5d9690(0xfa)](){return this.#s;}get['docCount'](){const _0xbe9ea4=_0x5d9690;return this.#n(),this.#e[_0xbe9ea4(0xc0)];}get[_0x5d9690(0xf1)](){return this.#r;}async[_0x5d9690(0x165)](_0x33863c,_0xf6fe90){const _0x2a7334=_0x5d9690;this.#n();let _0x4748f3=_0xf6fe90?{'upsert':_0xf6fe90[_0x2a7334(0xfb)]??!0x0}:void 0x0;if(this.#r===_0x2a7334(0x122)){let _0x804a6d=r.#t(_0x33863c),_0x456116=_0x33863c['map'](_0x86aacd=>{const _0x1e5860=_0x2a7334;let _0x2de553={..._0x86aacd};return delete _0x2de553[_0x1e5860(0x174)],_0x2de553;}),_0xe7e9ed=await this.#e[_0x2a7334(0xba)](_0x456116,_0x804a6d,_0x4748f3);return{'added':_0xe7e9ed[_0x2a7334(0xa1)],'updated':_0xe7e9ed['updated']};}let _0x348aa6=await this.#e[_0x2a7334(0x126)](_0x33863c,_0x4748f3);return{'added':_0x348aa6[_0x2a7334(0xa1)],'updated':_0x348aa6[_0x2a7334(0xbb)]};}async['deleteDocs'](_0x15250b){const _0x4f1113=_0x5d9690;return this.#n(),await this.#e[_0x4f1113(0xf5)](_0x15250b);}async[_0x5d9690(0xb5)](_0x2d2826){const _0x53a5fe=_0x5d9690;return this.#n(),await this.#e[_0x53a5fe(0x118)](_0x2d2826??null);}async[_0x5d9690(0x16e)](_0x3a99b2,_0x3e917a){const _0x4827e0=_0x5d9690;this.#n();let _0x1fae6d=_0x3e917a?.[_0x4827e0(0xd7)]??0x5,_0x167e3d=_0x3e917a?.[_0x4827e0(0x11e)]??0.8,_0x15de2e=_0x3e917a?.[_0x4827e0(0x13f)]??null,_0x11bd33=_0x3e917a?.[_0x4827e0(0x174)];if(_0x11bd33==null){if(this.#r===_0x4827e0(0x122))throw p('INVALID_ARGUMENT',_0x4827e0(0x144));return await this.#e['queryText'](_0x3a99b2,_0x1fae6d,_0x167e3d,_0x15de2e);}return await this.#e['query'](_0x3a99b2,_0x1fae6d,Array['from'](_0x11bd33),_0x167e3d,_0x15de2e);}async['loadIndex'](_0x150248,_0x1c9db9){const _0x56cba4=_0x5d9690;return this.#n(),this.#e[_0x56cba4(0xe1)](_0x150248,_0x1c9db9??null);}async[_0x5d9690(0xa5)](){const _0x1186d5=_0x5d9690;return this.#n(),this.#e[_0x1186d5(0xa5)]();}async['saveToDisk'](_0x24cc0){const _0x2dee17=_0x5d9690;this.#n(),await this.#e[_0x2dee17(0x10c)](_0x24cc0);}async[_0x5d9690(0xfe)](_0x42e202,_0x1e361b){const _0x3d49e2=_0x5d9690;this.#n();let _0x1e5189=_0x1e361b?.[_0x3d49e2(0xf0)]??!0x0;return await this.#e['loadFromDisk'](_0x42e202,{'rebuildLegacy':_0x1e5189});}async[_0x5d9690(0xaf)](_0x2e876f){const _0x398f69=_0x5d9690;return this.#n(),await this.#e[_0x398f69(0xaf)](_0x2e876f);}#n(){const _0x84e74c=_0x5d9690;if(this.#i)throw new Error('SessionIndex\x20\x27'+this.#s+_0x84e74c(0x153));}['close'](){return this.#a??=this.#o(),this.#a;}async #o(){this.#i=!0x0;let _0x24900b=this.#e['close'];if(typeof _0x24900b!='function')throw new Error('@moss-js/moss-core\x20>=\x200.20.0\x20is\x20required\x20for\x20SessionIndex.close()');await _0x24900b['call'](this.#e);}async[Symbol[_0x5d9690(0x171)]](){const _0x5aa711=_0x5d9690;return this[_0x5aa711(0x101)]();}async[_0x5d9690(0xc4)](){const _0x238ab1=_0x5d9690;this.#n(),this.#r!==_0x238ab1(0x122)&&await this.#e[_0x238ab1(0x151)]();}static#t(_0x5739be){const _0x5b80e0=_0x5d9690;let _0x162635=_0x5739be['filter'](_0x229e10=>!_0x229e10[_0x5b80e0(0x174)]||_0x229e10[_0x5b80e0(0x174)][_0x5b80e0(0x143)]===0x0)[_0x5b80e0(0xca)](_0x46d796=>_0x46d796['id']);if(_0x162635[_0x5b80e0(0x143)]>0x0)throw new Error(_0x5b80e0(0xe7)+_0x162635['join'](',\x20')+'.\x20All\x20documents\x20must\x20have\x20.embedding\x20set\x20when\x20using\x20modelId=\x27custom\x27.');return _0x5739be[_0x5b80e0(0xca)](_0x3210be=>Array[_0x5b80e0(0xb1)](_0x3210be['embedding']??[]));}};import{validateIndexName as _0x447e7a}from'@moss-js/moss-core';function _0x1238(_0x577bc1,_0xc6836c){_0x577bc1=_0x577bc1-0x9d;const _0x259c5b=_0x259c();let _0x123859=_0x259c5b[_0x577bc1];return _0x123859;}var ie='https://service.usemoss.dev',ae='/v1/manage',M=class extends Error{[_0x5d9690(0xd4)];[_0x5d9690(0x140)];constructor(_0x297e78,_0x5731d3){const _0x3fc807=_0x5d9690;let _0x12f2b5=_0x5731d3?':\x20'+_0x5731d3:'';super(_0x3fc807(0x9e)+_0x297e78+_0x12f2b5),this['name']=_0x3fc807(0x111),this[_0x3fc807(0xd4)]=_0x297e78,this[_0x3fc807(0x140)]=_0x5731d3;}};function ue(){const _0xb25592=_0x5d9690;return''+(typeof process<'u'&&process[_0xb25592(0x109)]['MOSS_CLOUD_API_BASE_URL']||ie)[_0xb25592(0x160)](/\/+$/,'')+ae;}function de(_0x466472){const _0x536af=_0x5d9690;return _0x466472?Object[_0x536af(0xf9)](Object[_0x536af(0xb6)](_0x466472)[_0x536af(0x13f)](([,_0x263c17])=>_0x263c17!==void 0x0)):{};}async function j(_0x2d5201,_0x192a50,_0x7f11d3,_0x10e7c5){const _0x22e80f=_0x5d9690;let _0x174eac={...de(_0x10e7c5),'action':_0x7f11d3,'projectId':_0x2d5201},_0x1023f1=await fetch(ue(),{'method':_0x22e80f(0x158),'headers':{'Content-Type':'application/json','X-Project-Key':_0x192a50},'body':JSON[_0x22e80f(0x164)](_0x174eac),'signal':AbortSignal[_0x22e80f(0x128)](0x927c0)}),_0x32a7e3=await _0x1023f1['text']();if(!_0x1023f1['ok'])throw new M(_0x1023f1[_0x22e80f(0xd4)],_0x32a7e3);return _0x32a7e3?JSON['parse'](_0x32a7e3):{};}var W='moss-minilm',R=class{#e;#r;#s;#i=!0x1;#a;#n=new Set();constructor(_0xbe5b67,_0x5e5b4f,_0xedc69c){this.#e=new w(_0xbe5b67,_0x5e5b4f,_0xedc69c),this.#r=_0xbe5b67,this.#s=typeof _0x5e5b4f=='string'?_0x5e5b4f:null;}async[_0x5d9690(0x104)](){const _0x136c71=_0x5d9690;return this.#t(),this.#e[_0x136c71(0x104)]();}async['createIndex'](_0x2f0b12,_0x43b745,_0x2c0f34){const _0x5380f9=_0x5d9690;this.#t();let _0x5d8a99;return _0x2c0f34?.[_0x5380f9(0xf1)]!==void 0x0?_0x5d8a99=_0x2c0f34['modelId']:_0x5d8a99=_0x43b745[_0x5380f9(0xf2)](_0x31bb5a=>Array[_0x5380f9(0x113)](_0x31bb5a[_0x5380f9(0x174)])&&_0x31bb5a['embedding']['length']>0x0)?'custom':W,this.#e[_0x5380f9(0x159)](_0x2f0b12,_0x43b745,_0x5d8a99,_0x2c0f34);}async[_0x5d9690(0xb0)](_0x592740,_0x18579d,_0x31e388){const _0x35e7de=_0x5d9690;return this.#t(),this.#e[_0x35e7de(0xb0)](_0x592740,_0x18579d,_0x31e388);}async[_0x5d9690(0x12a)](_0xd0c1eb){return this.#t(),this.#e['getIndex'](_0xd0c1eb);}async[_0x5d9690(0x142)](){const _0x4a3cb5=_0x5d9690;return this.#t(),this.#e[_0x4a3cb5(0x142)]();}async['deleteIndex'](_0x493bfc){return this.#t(),this.#e['deleteIndex'](_0x493bfc);}async['addDocs'](_0xd40183,_0x91c7ae,_0x372572){const _0x337e5e=_0x5d9690;return this.#t(),this.#e[_0x337e5e(0x165)](_0xd40183,_0x91c7ae,_0x372572);}async[_0x5d9690(0x145)](_0x121706,_0x1ba4a0,_0x2dec65){const _0x6625c1=_0x5d9690;return this.#t(),this.#e[_0x6625c1(0x145)](_0x121706,_0x1ba4a0,_0x2dec65);}async[_0x5d9690(0xa8)](_0x46e591){return this.#t(),this.#e['getJobStatus'](_0x46e591);}async[_0x5d9690(0xc6)](_0x1a069e,_0x45475f,_0x2eec03){const _0xb34632=_0x5d9690;return this.#t(),_0x447e7a(_0x45475f),this.#o(_0xb34632(0xc6),{'rootUrl':_0x1a069e,'indexName':_0x45475f,'maxPages':_0x2eec03?.['maxPages'],'maxDocuments':_0x2eec03?.[_0xb34632(0x11a)],'maxDepth':_0x2eec03?.['maxDepth'],'includePaths':_0x2eec03?.[_0xb34632(0xa0)],'excludePaths':_0x2eec03?.[_0xb34632(0x127)],'respectRobots':_0x2eec03?.[_0xb34632(0xa9)],'parseDocuments':_0x2eec03?.[_0xb34632(0x172)],'refreshCadence':_0x2eec03?.[_0xb34632(0x9d)],'modelId':_0x2eec03?.[_0xb34632(0xf1)]});}async[_0x5d9690(0xac)](_0x48e465){const _0x4f2130=_0x5d9690;this.#t();let _0x444f29=(await this.#o(_0x4f2130(0xac),_0x48e465!==void 0x0?{'indexName':_0x48e465}:void 0x0))[_0x4f2130(0xa2)]??[];return _0x48e465===void 0x0?_0x444f29:_0x444f29[_0x4f2130(0x13f)](_0x1eae0a=>_0x1eae0a[_0x4f2130(0x10e)]===_0x48e465);}async[_0x5d9690(0xee)](_0x314c35){return this.#t(),this.#o('getWebSource',{'sourceId':_0x314c35});}async[_0x5d9690(0xb8)](_0x48dcba,_0x519cd5){const _0x13271c=_0x5d9690;return this.#t(),this.#o('updateWebSource',{'sourceId':_0x48dcba,'refreshCadence':_0x519cd5[_0x13271c(0x9d)],'rootUrl':_0x519cd5[_0x13271c(0xf4)],'includePaths':_0x519cd5[_0x13271c(0xa0)],'excludePaths':_0x519cd5['excludePaths'],'maxDepth':_0x519cd5[_0x13271c(0xae)],'maxPages':_0x519cd5[_0x13271c(0x10f)],'resync':_0x519cd5[_0x13271c(0xa6)]});}async[_0x5d9690(0x119)](_0x294fa4){const _0x479b4d=_0x5d9690;return this.#t(),this.#o(_0x479b4d(0x119),{'sourceId':_0x294fa4});}async[_0x5d9690(0xcf)](_0x58a244){const _0x44f262=_0x5d9690;return this.#t(),this.#o(_0x44f262(0xcf),{'sourceId':_0x58a244});}async #o(_0x2ab9f4,_0x1f73e2){const _0x5c2a52=_0x5d9690;if(this.#s===null)throw new Error(_0x5c2a52(0xea));return j(this.#r,this.#s,_0x2ab9f4,_0x1f73e2);}async[_0x5d9690(0xb5)](_0x11329f,_0x20861a){const _0x3ca098=_0x5d9690;return this.#t(),this.#e[_0x3ca098(0xb5)](_0x11329f,_0x20861a);}async[_0x5d9690(0xe1)](_0x392395,_0x5e436f){const _0x2a78e6=_0x5d9690;return this.#t(),this.#e[_0x2a78e6(0xe1)](_0x392395,_0x5e436f);}async[_0x5d9690(0x14c)](_0x13288a,_0x1563dc){const _0x435823=_0x5d9690;return this.#t(),this.#e[_0x435823(0x14c)](_0x13288a,_0x1563dc);}async[_0x5d9690(0xf3)](_0x2aa1fa){const _0x29c64a=_0x5d9690;return this.#t(),this.#e[_0x29c64a(0xf3)](_0x2aa1fa);}async[_0x5d9690(0x138)](_0x302477){return this.#t(),this.#e['unloadIndexes'](_0x302477);}async[_0x5d9690(0x16e)](_0x5f2fb9,_0x593e81,_0x62f742){return this.#t(),this.#e['query'](_0x5f2fb9,_0x593e81,_0x62f742);}async['queryMultiIndex'](_0x5ce96f,_0x5b280f,_0x4e37e8){const _0x546ca1=_0x5d9690;return this.#t(),this.#e[_0x546ca1(0xe4)](_0x5ce96f,_0x5b280f,_0x4e37e8);}async['session'](_0x141be1,_0x2fb7e7=W,_0x5909c2){const _0x5a7d80=_0x5d9690;this.#t();let _0x429429=this.#e[_0x5a7d80(0xe9)],_0x447608;if(this.#s!==null)_0x447608=await h[_0x5a7d80(0x116)](_0x141be1,_0x2fb7e7,this.#r,this.#s,void 0x0,_0x429429,_0x5909c2);else{let _0x3c9916=await this.#e[_0x5a7d80(0xc2)](_0x141be1,_0x2fb7e7,_0x5909c2);_0x447608=h[_0x5a7d80(0x115)](_0x141be1,_0x2fb7e7,_0x3c9916,_0x429429);}await _0x447608[_0x5a7d80(0xc4)]();for(let _0x293b84 of this.#n)_0x293b84['deref']()||this.#n['delete'](_0x293b84);return this.#n['add'](new WeakRef(_0x447608)),_0x447608;}#t(){const _0x7f332e=_0x5d9690;if(this.#i)throw new Error(_0x7f332e(0x14a));}[_0x5d9690(0x101)](){return this.#a??=this.#u(),this.#a;}async #u(){const _0x2f4ea5=_0x5d9690;this.#i=!0x0;let _0x1c6197=[...this.#n]['map'](_0x1308c7=>_0x1308c7['deref']())[_0x2f4ea5(0x13f)](_0x50063d=>_0x50063d!==void 0x0);this.#n['clear'](),await Promise[_0x2f4ea5(0x148)](_0x1c6197[_0x2f4ea5(0xca)](_0x23dfc9=>_0x23dfc9[_0x2f4ea5(0x101)]())),await this.#e['close']();}async[Symbol[_0x5d9690(0x171)]](){return this['close']();}};export{M as ManageApiError,R as MossClient,h as SessionIndex,re as isMossError};
|
|
1
|
+
const _0x5b9f34=_0x5487;(function(_0x442818,_0x340711){const _0x25067b=_0x5487,_0x3ccd46=_0x442818();while(!![]){try{const _0x438f4f=parseInt(_0x25067b(0x17c))/0x1+-parseInt(_0x25067b(0x1b4))/0x2*(parseInt(_0x25067b(0x1fa))/0x3)+parseInt(_0x25067b(0x1d8))/0x4+parseInt(_0x25067b(0x230))/0x5+parseInt(_0x25067b(0x242))/0x6+-parseInt(_0x25067b(0x22b))/0x7+-parseInt(_0x25067b(0x197))/0x8;if(_0x438f4f===_0x340711)break;else _0x3ccd46['push'](_0x3ccd46['shift']());}catch(_0x2e2135){_0x3ccd46['push'](_0x3ccd46['shift']());}}}(_0x5b4c,0xda705));import{JobStatus as _0x51b0f6}from'@moss-js/moss-core';import*as _0xdfe61 from'@moss-js/moss-core';import*as _0x526d8f from'@moss-js/moss-core';function _0x5b4c(){const _0x457cc7=['utf8','body','building','74628vJbcCa','warn','toLowerCase','Completed','listWebSources','received\x20an\x20array\x20where\x20a\x20JobProgress\x20object\x20was\x20expected','manifestSha256','refreshCadence','createAuthenticatedSessionInner','/v1/manage','applySessionIdentity','map','function','maxPages','authNotifyFn','slice','manageClient','session','\x20must\x20not\x20have\x20leading\x20or\x20trailing\x20whitespace','hasIndex','\x20must\x20be\x20at\x20most\x20','version','cachePath','NaN','toByteArray','upsert','CLOUD_API_AUTH_URL','3438944mDiPBQ','message','added','parseOptions','resolveAuthRequest','invalidate','_warmModel','env','deref','authUrl','unloadIndexes','Bearer\x20','MOSS_INDEX_URL','moss-core\x20runtime\x20is\x20missing\x20resolveAuthRequest/rejectAuthRequest\x20exports.\x20Ensure\x20you\x20are\x20using\x20a\x20moss-core\x20build\x20that\x20supports\x20custom\x20authenticators.','deleteDocs\x20requires\x20at\x20least\x20one\x20document\x20ID','setIdentity','HTTP\x20error!\x20status:\x20','@moss-js/moss-core\x20>=\x200.20.0\x20is\x20required\x20for\x20MossClient.close()','updated','getDocuments','all','timeout','withAuthenticator','create','deviceIdentity','candidateDepth','getAuthHeader','moss-core\x20runtime\x20SessionIndex\x20is\x20missing\x20the\x20withAuthenticator\x20factory.\x20Upgrade\x20@moss-js/moss-core\x20to\x20a\x20build\x20that\x20supports\x20custom\x20authenticators\x20for\x20sessions.','data','10YQRrbX','startsWith','byteLength','configuredIdentity','default','cachePathDeviceId','addDocs\x20requires\x20at\x20least\x20one\x20document','getIndex','INVALID_ARGUMENT','loadIndex','deviceId','identity','isArray','[moss]\x20Dropping\x20a\x20malformed\x20job\x20progress\x20event;\x20progress\x20reporting\x20may\x20be\x20incomplete\x20for\x20this\x20operation.\x20Cause:\x20','modelId','then','rootUrl','[moss]\x20Ignoring\x20an\x20auth\x20request\x20with\x20no\x20usable\x20request\x20id;\x20custom\x20authentication\x20may\x20be\x20unavailable\x20for\x20this\x20client.\x20Cause:\x20','asyncDispose','encode','text','stringify','userId','isSafeInteger','error','cache','queryText','getDocs','Uploading','received\x20a\x20progress\x20event\x20with\x20a\x20missing\x20or\x20empty\x20status\x20(','queryMultiIndexText','MOSS_AUTH_URL','close','applyIdentity','_fromInner','replace','5102812cVsIKg','deleteDocs','length','call','object','ensureCachePathDeviceId','projectId','onProgress','maxDocuments','loadFromDisk','received\x20a\x20progress\x20event\x20with\x20a\x20missing\x20or\x20empty\x20jobId\x20(','Unsupported\x20data\x20type\x20for\x20file\x20upload','_create','entries','excludePaths','test','Unsupported\x20job\x20status\x20\x27','expiresAt','docCount','addDocs','.\x20All\x20documents\x20must\x20have\x20.embedding\x20set\x20when\x20using\x20modelId=\x27custom\x27.','moss-core\x20rejected\x20the\x20auth\x20token:\x20','pending_upload','listIndexes','currentPhase','normalizeJobStatus','moss-minilm','hasCustomAuthenticator','createIndex','topK','resync','\x27\x20returned\x20by\x20moss-core','status','embedding','361347cOVIvx','includePaths','saveToDisk','parse','addDocumentsText','SDK_VERSION_NUMBER','wrapProgress','createIndex\x20requires\x20at\x20least\x20one\x20document','MOSS_CLOUD_API_BASE_URL','trim','createAuthenticatedSessionInner\x20requires\x20a\x20custom\x20IAuthenticator\x20client','addDocuments','maxDepth','\x20UTF-8\x20bytes','json','received\x20a\x20progress\x20event\x20with\x20a\x20non-finite\x20progress\x20value\x20(','pushIndex','alpha','.moss-device-id','string','requireMultiIndexCore','queryMultiIndex\x20requires\x20at\x20least\x20one\x20index\x20name','sources','\x20contains\x20an\x20unsupported\x20character','name','unloadIndex','https://service.usemoss.dev','minScore','fromEntries','query','Web\x20source\x20methods\x20require\x20a\x20project\x20key.\x20Construct\x20MossClient\x20with\x20(projectId,\x20projectKey).','custom','POST','delete','getJobStatus','indexManager','getAuthToken','from','filter','resyncWebSource','createIndexFromFiles','application/json','jobId','now','Authentication\x20failed\x20(HTTP\x20401):\x20','projectKey','some','This\x20session\x20uses\x20custom\x20embeddings.\x20Provide\x20a\x20query\x20embedding\x20via\x20QueryOptions.embedding.','The\x20installed\x20@moss-js/moss-core\x20does\x20not\x20support\x20multi-index\x20operations\x20(queryMultiIndex,\x20loadIndexes,\x20unloadIndexes).\x20Upgrade\x20@moss-js/moss-core.','7479059fGLvgs','contentType','MossClient\x20options.identity\x20must\x20be\x20an\x20object','inner','token','7068575lteeJA','createWebSource','Documents\x20missing\x20.embedding\x20for\x20custom\x20model:\x20','fetchAndCache','expiresIn','SessionIndex','bind','number','updateWebSource','code','inspectSnapshot','moss-core\x20runtime\x20ManageClient/IndexManager\x20is\x20missing\x20withAuthenticator\x20factory.\x20Ensure\x20you\x20are\x20using\x20a\x20moss-core\x20build\x20that\x20supports\x20custom\x20authenticators.','received\x20','Building','IndexManager','freeze','PendingUpload','ManageClient','1387374omVgZj','createIndexFromFiles\x20requires\x20at\x20least\x20one\x20file','arrayBuffer','keys','completed','MossClient\x20options.identity.','Failed','CLOUD_API_IDENTITY_URL','rejectAuthRequest','progress','deleteDocuments','[moss]\x20Auth\x20request\x20','mossDeviceId','deleteIndex','The\x20installed\x20@moss-js/moss-core\x20runtime\x20does\x20not\x20support\x20exact\x20model\x20artifact\x20identities.\x20Upgrade\x20moss-core\x20before\x20creating\x20this\x20session.','deleteWebSource','inflight','\x27\x20is\x20closed','loadIndexes','authenticator','\x22\x20is\x20not\x20loaded.\x20Call\x20loadIndex(\x22','received\x20a\x20progress\x20event\x20with\x20a\x20non-string\x20currentPhase\x20(','queryMultiIndex','pendingupload'];_0x5b4c=function(){return _0x457cc7;};return _0x5b4c();}var p=_0x526d8f,he=p['MODEL_DOWNLOAD_URL'],ge=p[_0x5b9f34(0x1ff)],pe=p[_0x5b9f34(0x168)],U=p[_0x5b9f34(0x196)],fe=typeof process<'u'&&process[_0x5b9f34(0x19e)][_0x5b9f34(0x1a3)]||p['CLOUD_API_INDEX_URL'],k=typeof process<'u'?process['env']:{},y=class{constructor(_0x25c483,_0x2a26a4){const _0x17c345=_0x5b9f34;this['projectId']=_0x25c483,this[_0x17c345(0x227)]=_0x2a26a4,this[_0x17c345(0x1a0)]=k[_0x17c345(0x1d3)]??U;}[_0x5b9f34(0x1de)];[_0x5b9f34(0x227)];[_0x5b9f34(0x1a0)];async[_0x5b9f34(0x21e)](){const _0x2a0e18=_0x5b9f34;let _0x166506=await fetch(this['authUrl'],{'method':'POST','headers':{'Content-Type':_0x2a0e18(0x223)},'body':JSON['stringify']({'projectId':this['projectId'],'projectKey':this[_0x2a0e18(0x227)]}),'signal':AbortSignal[_0x2a0e18(0x1ac)](0x7530)});if(_0x166506[_0x2a0e18(0x1f8)]===0x191){let _0x5bf83f=await _0x166506[_0x2a0e18(0x1c8)]();throw new Error(_0x2a0e18(0x226)+_0x5bf83f);}if(!_0x166506['ok']){let _0x1e4e89=await _0x166506[_0x2a0e18(0x1c8)]();throw new Error('HTTP\x20'+_0x166506[_0x2a0e18(0x1f8)]+':\x20'+_0x1e4e89);}let _0x3e3ca0=await _0x166506[_0x2a0e18(0x208)]();return{'token':_0x3e3ca0[_0x2a0e18(0x22f)],'expiresIn':_0x3e3ca0[_0x2a0e18(0x234)]};}async[_0x5b9f34(0x1b1)](){const _0x4efdee=_0x5b9f34;let {token:_0x1a7963}=await this[_0x4efdee(0x21e)]();return _0x4efdee(0x1a2)+_0x1a7963;}},x=class{constructor(_0x4c27c2){this['inner']=_0x4c27c2;}[_0x5b9f34(0x22e)];[_0x5b9f34(0x1cd)]=null;[_0x5b9f34(0x171)]=null;async[_0x5b9f34(0x21e)](){const _0x56f801=_0x5b9f34;if(this[_0x56f801(0x1cd)]&&this[_0x56f801(0x1cd)][_0x56f801(0x1e9)]>Date[_0x56f801(0x225)]())return{'token':this['cache'][_0x56f801(0x22f)],'expiresIn':this[_0x56f801(0x1cd)][_0x56f801(0x234)]};if(this[_0x56f801(0x171)])return this[_0x56f801(0x171)];this[_0x56f801(0x171)]=this[_0x56f801(0x233)]();try{return await this[_0x56f801(0x171)];}finally{this['inflight']=null;}}async[_0x5b9f34(0x1b1)](){const _0x3360ce=_0x5b9f34;let {token:_0x3ee198}=await this[_0x3360ce(0x21e)]();return'Bearer\x20'+_0x3ee198;}[_0x5b9f34(0x19c)](_0x4a6038){const _0x2947d0=_0x5b9f34;this[_0x2947d0(0x1cd)]?.[_0x2947d0(0x22f)]===_0x4a6038&&(this[_0x2947d0(0x1cd)]=null);}async[_0x5b9f34(0x233)](){const _0x1aecba=_0x5b9f34;let {token:_0x154cf8,expiresIn:_0x11ee1b}=await this[_0x1aecba(0x22e)][_0x1aecba(0x21e)](),_0x20c67e=Q(_0x11ee1b);return this['cache']=_0x20c67e>0x0?{'token':_0x154cf8,'expiresIn':_0x11ee1b,'expiresAt':Date[_0x1aecba(0x225)]()+_0x20c67e*0x3e8}:null,{'token':_0x154cf8,'expiresIn':_0x11ee1b};}};function Q(_0x2e19fb){const _0x2da6b3=_0x5b9f34;let _0x5d425d=typeof _0x2e19fb==_0x2da6b3(0x237)||typeof _0x2e19fb==_0x2da6b3(0x20d)?Number(_0x2e19fb):Number[_0x2da6b3(0x193)];return!Number['isFinite'](_0x5d425d)||_0x5d425d<=0x0?0x0:Math['max'](_0x5d425d*0.9,_0x5d425d-0x3c);}import{randomUUID as _0x2eae12}from'node:crypto';import{existsSync as _0x4f9ae0,mkdirSync as _0x1317ae,readFileSync as _0x23d8cb,writeFileSync as _0x52ace3}from'node:fs';import{join as _0xae99f6}from'node:path';var ee=_0x5b9f34(0x20c),A=0x100,N=/[\p{Cc}\p{Cf}\p{Cs}\uFFFD]/u;function te(_0x3e6e76){const _0x4cceed=_0x5b9f34;return _0x3e6e76[_0x4cceed(0x1da)]>0x0&&_0x3e6e76['trim']()===_0x3e6e76&&!N['test'](_0x3e6e76)&&new TextEncoder()[_0x4cceed(0x1c7)](_0x3e6e76)[_0x4cceed(0x1b6)]<=A;}function _0x5487(_0x27d31a,_0x2c709d){_0x27d31a=_0x27d31a-0x165;const _0x5b4ce2=_0x5b4c();let _0x548763=_0x5b4ce2[_0x27d31a];return _0x548763;}function L(_0xb263d9,_0x21872d){const _0x9c6fe7=_0x5b9f34;if(_0xb263d9!==void 0x0){if(typeof _0xb263d9!='string'||_0xb263d9[_0x9c6fe7(0x1da)]===0x0)throw new TypeError('MossClient\x20options.identity.'+_0x21872d+'\x20must\x20be\x20a\x20non-empty\x20string');if(_0xb263d9['trim']()!==_0xb263d9)throw new TypeError(_0x9c6fe7(0x166)+_0x21872d+_0x9c6fe7(0x18e));if(N[_0x9c6fe7(0x1e7)](_0xb263d9))throw new TypeError(_0x9c6fe7(0x166)+_0x21872d+_0x9c6fe7(0x211));if(new TextEncoder()['encode'](_0xb263d9)[_0x9c6fe7(0x1b6)]>A)throw new TypeError('MossClient\x20options.identity.'+_0x21872d+_0x9c6fe7(0x190)+A+_0x9c6fe7(0x207));return _0xb263d9;}}function q(_0x3532a6){const _0x47c153=_0x5b9f34;if(_0x3532a6!==void 0x0){if(_0x3532a6===null||typeof _0x3532a6!=_0x47c153(0x1dc)||Array['isArray'](_0x3532a6))throw new TypeError(_0x47c153(0x22d));return Object[_0x47c153(0x23f)]({'deviceId':L(_0x3532a6['deviceId'],'deviceId'),'userId':L(_0x3532a6[_0x47c153(0x1ca)],_0x47c153(0x1ca))});}}function F(_0x1fd0db){const _0x3e4dc3=_0x5b9f34;return _0x1fd0db?.[_0x3e4dc3(0x1be)]!==void 0x0||_0x1fd0db?.[_0x3e4dc3(0x1ca)]!==void 0x0;}function D(_0x264405){const _0x4fbca4=_0x5b9f34;if(!_0x264405?.[_0x4fbca4(0x203)]())return;let _0x45b363=_0xae99f6(_0x264405,ee);try{if(_0x4f9ae0(_0x45b363)){let _0x1ab5c8=_0x23d8cb(_0x45b363,_0x4fbca4(0x179))[_0x4fbca4(0x203)]();return te(_0x1ab5c8)?_0x1ab5c8:void 0x0;}_0x1317ae(_0x264405,{'recursive':!0x0});let _0x1c281e=_0x2eae12();return _0x52ace3(_0x45b363,_0x1c281e,_0x4fbca4(0x179)),_0x1c281e;}catch{return;}}var ne=0x1;function b(_0x3598f0){const _0x16d193=_0x5b9f34;let _0x381731=_0x3598f0['modelArtifactContractVersion'];if(typeof _0x381731!=_0x16d193(0x188))throw j();let _0x45c8ba=_0x381731[_0x16d193(0x1db)](_0x3598f0);if(!Number[_0x16d193(0x1cb)](_0x45c8ba)||_0x45c8ba<ne)throw j();}function j(){const _0xf5fd43=_0x5b9f34;return new Error(_0xf5fd43(0x16f));}var Ae=0x708*0x3e8,re={'INVALID_ARGUMENT':!0x0,'NOT_FOUND':!0x0,'UNAUTHORIZED':!0x0,'NETWORK':!0x0,'DESERIALIZATION':!0x0,'MODEL_UNAVAILABLE':!0x0,'INTERNAL':!0x0},se=new Set(Object[_0x5b9f34(0x245)](re));function oe(_0x5ebbbb){const _0x2bbd56=_0x5b9f34;if(!(_0x5ebbbb instanceof Error))return!0x1;let _0x10a119=_0x5ebbbb[_0x2bbd56(0x239)];return typeof _0x10a119==_0x2bbd56(0x20d)&&se['has'](_0x10a119);}function f(_0x11c6b5,_0x1aa275){return Object['assign'](new Error(_0x1aa275),{'code':_0x11c6b5});}function w(_0x538be0){const _0x2ae31e=_0x5b9f34;if(!(_0x538be0?.[_0x2ae31e(0x215)]===void 0x0&&_0x538be0?.[_0x2ae31e(0x1b0)]===void 0x0))return{'minScore':_0x538be0[_0x2ae31e(0x215)],'candidateDepth':_0x538be0[_0x2ae31e(0x1b0)]};}function R(_0x2e3770){return _0x2e3770 instanceof Error?_0x2e3770['message']:String(_0x2e3770);}function ie(_0x518aa9){const _0x109797=_0x5b9f34;if(_0x518aa9===null||typeof _0x518aa9!=_0x109797(0x1dc))return'received\x20'+String(_0x518aa9);if(Array[_0x109797(0x1c0)](_0x518aa9))return _0x109797(0x181);let _0x206ebc=_0x518aa9;return typeof _0x206ebc[_0x109797(0x224)]!='string'||_0x206ebc['jobId']['length']===0x0?_0x109797(0x1e2)+String(_0x206ebc[_0x109797(0x224)])+')':typeof _0x206ebc['status']!=_0x109797(0x20d)||_0x206ebc[_0x109797(0x1f8)]['length']===0x0?_0x109797(0x1d1)+String(_0x206ebc['status'])+')':typeof _0x206ebc[_0x109797(0x16a)]!=_0x109797(0x237)||!Number['isFinite'](_0x206ebc[_0x109797(0x16a)])?_0x109797(0x209)+String(_0x206ebc[_0x109797(0x16a)])+')':_0x206ebc[_0x109797(0x1f0)]!==void 0x0&&_0x206ebc[_0x109797(0x1f0)]!==null&&typeof _0x206ebc[_0x109797(0x1f0)]!=_0x109797(0x20d)?_0x109797(0x176)+String(_0x206ebc[_0x109797(0x1f0)])+')':null;}var P=class{[_0x5b9f34(0x174)];[_0x5b9f34(0x18c)];[_0x5b9f34(0x21d)];[_0x5b9f34(0x1b9)];[_0x5b9f34(0x1b7)];[_0x5b9f34(0x1de)];[_0x5b9f34(0x18a)];constructor(_0x420086,_0x4e8e01,_0x34c49e){const _0x3aa97a=_0x5b9f34;this['configuredIdentity']=q(_0x34c49e?.[_0x3aa97a(0x1bf)]),this[_0x3aa97a(0x1b9)]=D(_0x34c49e?.[_0x3aa97a(0x192)]),this['projectId']=_0x420086;let _0x27aa70=typeof _0x4e8e01==_0x3aa97a(0x20d)?new y(_0x420086,_0x4e8e01):_0x4e8e01;this[_0x3aa97a(0x174)]=new x(_0x27aa70);let _0x536de0=_0xdfe61,_0x484e57=_0x536de0['ManageClient']??_0x536de0[_0x3aa97a(0x1b8)]?.[_0x3aa97a(0x241)],_0x159996=_0x536de0[_0x3aa97a(0x23e)]??_0x536de0['default']?.[_0x3aa97a(0x23e)];if(!_0x484e57||!_0x159996)throw new Error('moss-core\x20runtime\x20is\x20missing\x20ManageClient/IndexManager\x20exports');if(typeof _0x4e8e01==_0x3aa97a(0x20d))this[_0x3aa97a(0x18c)]=new _0x484e57(_0x420086,_0x4e8e01),this[_0x3aa97a(0x21d)]=new _0x159996(_0x420086,_0x4e8e01);else{let _0x379c36=_0x536de0[_0x3aa97a(0x19b)]??_0x536de0[_0x3aa97a(0x1b8)]?.[_0x3aa97a(0x19b)],_0x48619d=_0x536de0[_0x3aa97a(0x169)]??_0x536de0[_0x3aa97a(0x1b8)]?.[_0x3aa97a(0x169)];if(!_0x379c36||!_0x48619d)throw new Error(_0x3aa97a(0x1a4));let _0x3c4bbf=this[_0x3aa97a(0x174)],_0x4e1684=(_0x8e85f2,_0xfa1084)=>{const _0x2e2ced=_0x3aa97a;try{_0x48619d(_0x8e85f2,_0xfa1084);}catch(_0x25be85){console['warn'](_0x2e2ced(0x16c)+_0x8e85f2+'\x20could\x20not\x20be\x20settled:\x20'+R(_0x25be85));}},_0xfc4aaa=(_0x3e80e0,_0xd83296)=>{const _0x6ece4c=_0x3aa97a;try{_0x379c36(_0x3e80e0,_0xd83296);}catch(_0x39498e){_0x4e1684(_0x3e80e0,_0x6ece4c(0x1ed)+R(_0x39498e));}},_0x1b8e8f=!0x1,_0x1544fe=(_0x5edeab,_0x288b56,_0x134e38)=>{const _0x506d64=_0x3aa97a;if(_0x5edeab||!Number[_0x506d64(0x1cb)](_0x288b56)||_0x288b56<0x0){_0x1b8e8f||(_0x1b8e8f=!0x0,console[_0x506d64(0x17d)](_0x506d64(0x1c5)+(_0x5edeab?_0x5edeab[_0x506d64(0x198)]:_0x506d64(0x23c)+String(_0x288b56))));return;}typeof _0x134e38==_0x506d64(0x20d)&&_0x3c4bbf[_0x506d64(0x19c)](_0x134e38),_0x3c4bbf[_0x506d64(0x1b1)]()[_0x506d64(0x1c3)](_0x3bce72=>{const _0x169de1=_0x506d64;let _0x4ff2d1=_0x3bce72[_0x169de1(0x1b5)]('Bearer\x20')?_0x3bce72[_0x169de1(0x18b)](0x7):_0x3bce72;_0xfc4aaa(_0x288b56,_0x4ff2d1);},_0x1fc686=>_0x4e1684(_0x288b56,R(_0x1fc686)));};this[_0x3aa97a(0x18a)]=_0x1544fe;let _0x11633f=_0x484e57,_0x443570=_0x159996;if(!_0x11633f[_0x3aa97a(0x1ad)]||!_0x443570[_0x3aa97a(0x1ad)])throw new Error(_0x3aa97a(0x23b));this['manageClient']=_0x11633f[_0x3aa97a(0x1ad)](_0x420086,_0x1544fe),this[_0x3aa97a(0x21d)]=_0x443570[_0x3aa97a(0x1ad)](_0x420086,_0x1544fe);}this[_0x3aa97a(0x1d5)](this[_0x3aa97a(0x21d)]);}async[_0x5b9f34(0x1d4)](){const _0x3d713e=_0x5b9f34;let _0x58b448=this[_0x3d713e(0x21d)][_0x3d713e(0x1d4)];if(typeof _0x58b448!='function')throw new Error(_0x3d713e(0x1a8));await _0x58b448['call'](this[_0x3d713e(0x21d)]);}async[_0x5b9f34(0x21e)](){const _0x20f30a=_0x5b9f34;return this[_0x20f30a(0x174)][_0x20f30a(0x21e)]();}[_0x5b9f34(0x200)](_0x145658){if(!_0x145658)return;let _0x5035a2=!0x1;return(_0x32f6ce,_0x29c0ff)=>{const _0x222b20=_0x5487;let _0x52eb3f=_0x32f6ce?_0x32f6ce[_0x222b20(0x198)]:ie(_0x29c0ff);if(_0x52eb3f!==null){_0x5035a2||(_0x5035a2=!0x0,console[_0x222b20(0x17d)](_0x222b20(0x1c1)+_0x52eb3f));return;}_0x145658(_0x29c0ff);};}[_0x5b9f34(0x1f1)](_0xcf1e92){const _0x4c1494=_0x5b9f34;let _0x45225c=_0xcf1e92[_0x4c1494(0x203)]()[_0x4c1494(0x17e)]()['replace'](/\s+/g,'_'),_0x4fcc43=_0x45225c[_0x4c1494(0x1d7)](/_/g,'');if(_0x45225c===_0x4c1494(0x1ee)||_0x4fcc43===_0x4c1494(0x178))return _0x51b0f6[_0x4c1494(0x240)];if(_0x45225c==='uploading')return _0x51b0f6[_0x4c1494(0x1d0)];if(_0x45225c===_0x4c1494(0x17b))return _0x51b0f6[_0x4c1494(0x23d)];if(_0x45225c===_0x4c1494(0x165))return _0x51b0f6[_0x4c1494(0x17f)];if(_0x45225c==='failed')return _0x51b0f6[_0x4c1494(0x167)];throw new Error(_0x4c1494(0x1e8)+_0xcf1e92+_0x4c1494(0x1f7));}async[_0x5b9f34(0x1f4)](_0x252973,_0x46dfae,_0x465683,_0xc26f1e){const _0x28e70a=_0x5b9f34;if(!_0x46dfae[_0x28e70a(0x1da)])throw new Error(_0x28e70a(0x201));return await this[_0x28e70a(0x18c)][_0x28e70a(0x1f4)](_0x252973,_0x46dfae,_0x465683,this[_0x28e70a(0x200)](_0xc26f1e?.['onProgress']));}async[_0x5b9f34(0x194)](_0x513b78){const _0x57547f=_0x5b9f34;if(_0x513b78 instanceof Uint8Array)return Array[_0x57547f(0x21f)](_0x513b78);if(_0x513b78 instanceof ArrayBuffer)return Array['from'](new Uint8Array(_0x513b78));if(typeof _0x513b78[_0x57547f(0x244)]==_0x57547f(0x188)){let _0xf94070=await _0x513b78['arrayBuffer']();return Array[_0x57547f(0x21f)](new Uint8Array(_0xf94070));}throw new Error(_0x57547f(0x1e3));}async[_0x5b9f34(0x222)](_0x1414c7,_0x4b3312,_0x333fdb){const _0x122b59=_0x5b9f34;if(_0x4b3312[_0x122b59(0x1da)]===0x0)throw new Error(_0x122b59(0x243));let _0x228520=_0x333fdb?.[_0x122b59(0x1c2)]??_0x122b59(0x1f2),_0x339e48=await Promise[_0x122b59(0x1ab)](_0x4b3312['map'](async _0x37d510=>({'name':_0x37d510['name'],'contentType':_0x37d510[_0x122b59(0x22c)],'path':_0x37d510['path']??void 0x0,'data':_0x37d510[_0x122b59(0x1b3)]!=null?await this[_0x122b59(0x194)](_0x37d510[_0x122b59(0x1b3)]):void 0x0})));return await this[_0x122b59(0x18c)][_0x122b59(0x222)](_0x1414c7,_0x339e48,_0x228520,this['wrapProgress'](_0x333fdb?.['onProgress']),_0x333fdb?.[_0x122b59(0x19a)]??null);}async[_0x5b9f34(0x1eb)](_0x3aecb6,_0x50b9f6,_0x5c83d7){const _0x3b182c=_0x5b9f34;if(Array[_0x3b182c(0x1c0)](_0x50b9f6)&&_0x50b9f6[_0x3b182c(0x1da)]===0x0)throw new Error(_0x3b182c(0x1ba));return await this[_0x3b182c(0x18c)][_0x3b182c(0x1eb)](_0x3aecb6,_0x50b9f6,_0x5c83d7??null,this['wrapProgress'](_0x5c83d7?.[_0x3b182c(0x1df)]));}async[_0x5b9f34(0x1d9)](_0x1b12bc,_0x10f332,_0xb9ae4e){const _0x50664f=_0x5b9f34;if(Array[_0x50664f(0x1c0)](_0x10f332)&&_0x10f332[_0x50664f(0x1da)]===0x0)throw new Error(_0x50664f(0x1a5));return await this['manageClient'][_0x50664f(0x1d9)](_0x1b12bc,_0x10f332,this[_0x50664f(0x200)](_0xb9ae4e?.[_0x50664f(0x1df)]));}async[_0x5b9f34(0x21c)](_0x3b7415){const _0x10c27b=_0x5b9f34;let _0x57e087=await this[_0x10c27b(0x18c)][_0x10c27b(0x21c)](_0x3b7415);return{..._0x57e087,'status':this[_0x10c27b(0x1f1)](_0x57e087[_0x10c27b(0x1f8)]),'currentPhase':_0x57e087[_0x10c27b(0x1f0)]??null,'error':_0x57e087[_0x10c27b(0x1cc)]??null};}async['getIndex'](_0x58bc20){const _0x1ccab1=_0x5b9f34;return this['manageClient'][_0x1ccab1(0x1bb)](_0x58bc20);}async[_0x5b9f34(0x1ef)](){const _0x3f3326=_0x5b9f34;return this[_0x3f3326(0x18c)][_0x3f3326(0x1ef)]();}async[_0x5b9f34(0x16e)](_0x1f67c4){const _0x1529ad=_0x5b9f34;return this[_0x1529ad(0x18c)][_0x1529ad(0x16e)](_0x1f67c4);}async[_0x5b9f34(0x1cf)](_0x4f6d9c,_0x1e3baa){const _0x4d73d0=_0x5b9f34;return this['manageClient'][_0x4d73d0(0x1cf)](_0x4f6d9c,_0x1e3baa??null);}async[_0x5b9f34(0x1bd)](_0xa70331,_0x270741){const _0x51181d=_0x5b9f34;return this[_0x51181d(0x1dd)](_0x270741?.['cachePath']),(await this[_0x51181d(0x21d)][_0x51181d(0x1bd)](_0xa70331,_0x270741??null))[_0x51181d(0x212)];}async[_0x5b9f34(0x173)](_0x469f33,_0x3fd8db){const _0x26da7f=_0x5b9f34;let _0x1ba064=this[_0x26da7f(0x20e)]();return this['ensureCachePathDeviceId'](_0x3fd8db?.[_0x26da7f(0x192)]),_0x1ba064[_0x26da7f(0x173)](_0x469f33,_0x3fd8db??null);}async[_0x5b9f34(0x213)](_0x56863e){const _0x1fcae7=_0x5b9f34;return this[_0x1fcae7(0x21d)][_0x1fcae7(0x213)](_0x56863e);}async[_0x5b9f34(0x1a1)](_0x5cb798){const _0xad977d=_0x5b9f34;return this['requireMultiIndexCore']()[_0xad977d(0x1a1)](_0x5cb798);}['requireMultiIndexCore'](){const _0x211aa9=_0x5b9f34;let _0x51ab4b=this[_0x211aa9(0x21d)];if(typeof _0x51ab4b[_0x211aa9(0x177)]!=_0x211aa9(0x188)||typeof _0x51ab4b[_0x211aa9(0x1d2)]!=_0x211aa9(0x188)||typeof _0x51ab4b[_0x211aa9(0x173)]!=_0x211aa9(0x188)||typeof _0x51ab4b[_0x211aa9(0x1a1)]!=_0x211aa9(0x188))throw new Error(_0x211aa9(0x22a));return{'queryMultiIndex':_0x51ab4b['queryMultiIndex'][_0x211aa9(0x236)](_0x51ab4b),'queryMultiIndexText':_0x51ab4b[_0x211aa9(0x1d2)]['bind'](_0x51ab4b),'loadIndexes':_0x51ab4b[_0x211aa9(0x173)]['bind'](_0x51ab4b),'unloadIndexes':_0x51ab4b['unloadIndexes'][_0x211aa9(0x236)](_0x51ab4b)};}[_0x5b9f34(0x1dd)](_0x4cb9ca){const _0x109e24=_0x5b9f34;_0x4cb9ca&&this[_0x109e24(0x1b9)]===void 0x0&&D(_0x4cb9ca);}[_0x5b9f34(0x1d5)]=_0x1b6744=>{const _0x3ba133=_0x5b9f34;!F(this[_0x3ba133(0x1b7)])&&this[_0x3ba133(0x1b9)]===void 0x0||_0x1b6744[_0x3ba133(0x1a6)](this[_0x3ba133(0x1b7)]?.['deviceId']??null,this[_0x3ba133(0x1b7)]?.[_0x3ba133(0x1ca)]??null,this[_0x3ba133(0x1b9)]??null);};[_0x5b9f34(0x186)]=_0x18d1d7=>{const _0x2e786a=_0x5b9f34;let _0x19c215=this[_0x2e786a(0x21d)][_0x2e786a(0x1af)]?.();if(!_0x19c215){this[_0x2e786a(0x1d5)](_0x18d1d7);return;}_0x18d1d7[_0x2e786a(0x1a6)](_0x19c215[_0x2e786a(0x1be)]??null,this[_0x2e786a(0x1b7)]?.[_0x2e786a(0x1ca)]??null,_0x19c215[_0x2e786a(0x16d)]??null);};[_0x5b9f34(0x1f3)](){const _0x35b4b3=_0x5b9f34;return this[_0x35b4b3(0x18a)]!==void 0x0;}async[_0x5b9f34(0x184)](_0x311fe1,_0x26efb3,_0x2a561f){const _0x4c094b=_0x5b9f34;if(!this[_0x4c094b(0x18a)])throw new Error(_0x4c094b(0x204));let _0x470e02=_0xdfe61,_0x1f88f5=_0x470e02[_0x4c094b(0x235)]??_0x470e02[_0x4c094b(0x1b8)]?.['SessionIndex'];if(!_0x1f88f5||typeof _0x1f88f5[_0x4c094b(0x1ad)]!=_0x4c094b(0x188))throw new Error(_0x4c094b(0x1b2));return _0x2a561f&&b(_0x1f88f5),_0x1f88f5['withAuthenticator'](_0x311fe1,_0x26efb3,this[_0x4c094b(0x1de)],this[_0x4c094b(0x18a)],null,null,_0x2a561f?.[_0x4c094b(0x191)]??null,_0x2a561f?.['manifestSha256']??null);}async[_0x5b9f34(0x217)](_0x445d53,_0x46802d,_0x4c6173){const _0x1ff42a=_0x5b9f34;if(!await this[_0x1ff42a(0x21d)][_0x1ff42a(0x18f)](_0x445d53))throw f('NOT_FOUND','Index\x20\x22'+_0x445d53+_0x1ff42a(0x175)+_0x445d53+'\x22)\x20or\x20loadIndexes([...])\x20before\x20querying;\x20queries\x20run\x20locally\x20and\x20there\x20is\x20no\x20cloud\x20query\x20fallback.');let _0xa910c1=_0x4c6173?.[_0x1ff42a(0x1f5)]??0x5,_0x2c45d4=_0x4c6173?.['alpha']??0.8;return _0x4c6173?.[_0x1ff42a(0x1f9)]?this[_0x1ff42a(0x21d)]['query'](_0x445d53,_0x46802d,_0x4c6173[_0x1ff42a(0x1f9)],_0xa910c1,_0x2c45d4,_0x4c6173?.[_0x1ff42a(0x220)],w(_0x4c6173)):this['indexManager'][_0x1ff42a(0x1ce)](_0x445d53,_0x46802d,_0xa910c1,_0x2c45d4,_0x4c6173?.['filter'],w(_0x4c6173));}async[_0x5b9f34(0x177)](_0x430e02,_0x5c561a,_0xeb9b0b){const _0x11d353=_0x5b9f34;if(_0x430e02['length']===0x0)throw f('INVALID_ARGUMENT',_0x11d353(0x20f));let _0x1eb6a5=this[_0x11d353(0x20e)](),_0x38be74=_0xeb9b0b?.[_0x11d353(0x1f5)]??0xa,_0x2849e0=_0xeb9b0b?.[_0x11d353(0x20b)]??0.8;return _0xeb9b0b?.[_0x11d353(0x1f9)]?_0x1eb6a5[_0x11d353(0x177)](_0x430e02,_0x5c561a,_0xeb9b0b[_0x11d353(0x1f9)],_0x38be74,_0x2849e0,_0xeb9b0b?.['filter'],w(_0xeb9b0b)):_0x1eb6a5['queryMultiIndexText'](_0x430e02,_0x5c561a,_0x38be74,_0x2849e0,_0xeb9b0b?.[_0x11d353(0x220)],w(_0xeb9b0b));}};import{SessionIndex as _0x2854d6}from'@moss-js/moss-core';var h=class r{#e;#o;#r=!0x1;#a;constructor(_0x161d61,_0x190363){this.#o=_0x161d61,this.#e=_0x190363;}static async['_create'](_0xd3fe63,_0x18371e,_0x140e43,_0x5eeab6,_0x483eb8,_0x1ad0ae,_0x5e5c96){const _0x2e0241=_0x5b9f34;let _0x2a62a3=_0x2854d6;_0x5e5c96&&b(_0x2a62a3);let _0x50cc18=await _0x2a62a3[_0x2e0241(0x1ae)](_0xd3fe63,_0x18371e,_0x140e43,_0x5eeab6,_0x483eb8??null,_0x5e5c96?.['version']??null,_0x5e5c96?.[_0x2e0241(0x182)]??null);return r['_fromInner'](_0xd3fe63,_0x50cc18,_0x1ad0ae);}static['_fromInner'](_0x3c7261,_0x247d28,_0x292797){return _0x292797?.(_0x247d28),new r(_0x3c7261,_0x247d28);}get[_0x5b9f34(0x212)](){return this.#o;}get[_0x5b9f34(0x1ea)](){return this.#n(),this.#e['docCount'];}get[_0x5b9f34(0x1c2)](){const _0x20b2b1=_0x5b9f34;return this.#e[_0x20b2b1(0x1c2)];}async[_0x5b9f34(0x1eb)](_0x4cd366,_0x30de3){const _0x485c2b=_0x5b9f34;this.#n();let _0x297cec=_0x30de3?{'upsert':_0x30de3[_0x485c2b(0x195)]??!0x0}:void 0x0;if(this['modelId']===_0x485c2b(0x219)){let _0x446a8e=r.#s(_0x4cd366),_0x17ec5b=_0x4cd366['map'](_0x2bc5f2=>{const _0x5e3672=_0x485c2b;let _0x170c36={..._0x2bc5f2};return delete _0x170c36[_0x5e3672(0x1f9)],_0x170c36;}),_0x171931=await this.#e[_0x485c2b(0x205)](_0x17ec5b,_0x446a8e,_0x297cec);return{'added':_0x171931[_0x485c2b(0x199)],'updated':_0x171931[_0x485c2b(0x1a9)]};}let _0x133dc7=await this.#e[_0x485c2b(0x1fe)](_0x4cd366,_0x297cec);return{'added':_0x133dc7[_0x485c2b(0x199)],'updated':_0x133dc7[_0x485c2b(0x1a9)]};}async['deleteDocs'](_0x4aa8e6){const _0x46c1b4=_0x5b9f34;return this.#n(),await this.#e[_0x46c1b4(0x16b)](_0x4aa8e6);}async[_0x5b9f34(0x1cf)](_0x59da1b){const _0x37e994=_0x5b9f34;return this.#n(),await this.#e[_0x37e994(0x1aa)](_0x59da1b??null);}async[_0x5b9f34(0x217)](_0x4e5cd2,_0x4cea02){const _0x370660=_0x5b9f34;this.#n();let _0x46b751=_0x4cea02?.['topK']??0x5,_0x4944d2=_0x4cea02?.['alpha']??0.8,_0x133b3d=_0x4cea02?.['filter']??null,_0x223663=_0x4cea02?.[_0x370660(0x1f9)];if(_0x223663==null){if(this[_0x370660(0x1c2)]===_0x370660(0x219))throw f(_0x370660(0x1bc),_0x370660(0x229));return await this.#e[_0x370660(0x1ce)](_0x4e5cd2,_0x46b751,_0x4944d2,_0x133b3d);}return await this.#e['query'](_0x4e5cd2,_0x46b751,Array['from'](_0x223663),_0x4944d2,_0x133b3d);}async['loadIndex'](_0x1562d7,_0x38cd84){const _0x4d817e=_0x5b9f34;return this.#n(),this.#e[_0x4d817e(0x1bd)](_0x1562d7,_0x38cd84??null);}async[_0x5b9f34(0x20a)](){const _0x67a746=_0x5b9f34;return this.#n(),this.#e[_0x67a746(0x20a)]();}async[_0x5b9f34(0x1fc)](_0x2105d8){const _0x2c4ce1=_0x5b9f34;this.#n(),await this.#e[_0x2c4ce1(0x1fc)](_0x2105d8);}async[_0x5b9f34(0x1e1)](_0x39255f,_0x5f0506){const _0x3d8e95=_0x5b9f34;this.#n();let _0x171733=_0x5f0506?.['rebuildLegacy']??!0x0;return await this.#e[_0x3d8e95(0x1e1)](_0x39255f,{'rebuildLegacy':_0x171733});}async[_0x5b9f34(0x23a)](_0x275d50){const _0x3bd114=_0x5b9f34;return this.#n(),await this.#e[_0x3bd114(0x23a)](_0x275d50);}#n(){const _0x54bb22=_0x5b9f34;if(this.#r)throw new Error('SessionIndex\x20\x27'+this.#o+_0x54bb22(0x172));}[_0x5b9f34(0x1d4)](){return this.#a??=this.#i(),this.#a;}async #i(){const _0x5d4e76=_0x5b9f34;this.#r=!0x0;let _0x5d8fa3=this.#e[_0x5d4e76(0x1d4)];if(typeof _0x5d8fa3!=_0x5d4e76(0x188))throw new Error('@moss-js/moss-core\x20>=\x200.20.0\x20is\x20required\x20for\x20SessionIndex.close()');await _0x5d8fa3[_0x5d4e76(0x1db)](this.#e);}async[Symbol[_0x5b9f34(0x1c6)]](){const _0x11790d=_0x5b9f34;return this[_0x11790d(0x1d4)]();}async[_0x5b9f34(0x19d)](){const _0x76e886=_0x5b9f34;this.#n(),this[_0x76e886(0x1c2)]!=='custom'&&await this.#e['loadModel']();}static#s(_0x531da6){const _0x5a2b39=_0x5b9f34;let _0x37f0b5=_0x531da6[_0x5a2b39(0x220)](_0x20c5d2=>!_0x20c5d2['embedding']||_0x20c5d2[_0x5a2b39(0x1f9)]['length']===0x0)[_0x5a2b39(0x187)](_0x7676ff=>_0x7676ff['id']);if(_0x37f0b5[_0x5a2b39(0x1da)]>0x0)throw new Error(_0x5a2b39(0x232)+_0x37f0b5['join'](',\x20')+_0x5a2b39(0x1ec));return _0x531da6[_0x5a2b39(0x187)](_0x5e4d36=>Array[_0x5a2b39(0x21f)](_0x5e4d36['embedding']??[]));}};import{validateIndexName as _0x227faf}from'@moss-js/moss-core';var ue=_0x5b9f34(0x214),de=_0x5b9f34(0x185),M=class extends Error{['status'];[_0x5b9f34(0x17a)];constructor(_0x1b20f8,_0x3fefed){const _0x36f8bf=_0x5b9f34;let _0x36f049=_0x3fefed?':\x20'+_0x3fefed:'';super(_0x36f8bf(0x1a7)+_0x1b20f8+_0x36f049),this[_0x36f8bf(0x212)]='ManageApiError',this[_0x36f8bf(0x1f8)]=_0x1b20f8,this[_0x36f8bf(0x17a)]=_0x3fefed;}};function ce(){const _0x1e2139=_0x5b9f34;return''+(typeof process<'u'&&process[_0x1e2139(0x19e)][_0x1e2139(0x202)]||ue)[_0x1e2139(0x1d7)](/\/+$/,'')+de;}function le(_0x211852){const _0x5b067f=_0x5b9f34;return _0x211852?Object[_0x5b067f(0x216)](Object[_0x5b067f(0x1e5)](_0x211852)[_0x5b067f(0x220)](([,_0x2c94f0])=>_0x2c94f0!==void 0x0)):{};}async function $(_0x3314c1,_0x5dcefc,_0x5cbbfd,_0x35710f){const _0x26758e=_0x5b9f34;let _0x238e78={...le(_0x35710f),'action':_0x5cbbfd,'projectId':_0x3314c1},_0x1c4e45=await fetch(ce(),{'method':_0x26758e(0x21a),'headers':{'Content-Type':_0x26758e(0x223),'X-Project-Key':_0x5dcefc},'body':JSON[_0x26758e(0x1c9)](_0x238e78),'signal':AbortSignal[_0x26758e(0x1ac)](0x927c0)}),_0x5ef59a=await _0x1c4e45[_0x26758e(0x1c8)]();if(!_0x1c4e45['ok'])throw new M(_0x1c4e45[_0x26758e(0x1f8)],_0x5ef59a);return _0x5ef59a?JSON[_0x26758e(0x1fd)](_0x5ef59a):{};}var J=_0x5b9f34(0x1f2),C=class{#e;#o;#r;#a=!0x1;#n;#i=new Set();constructor(_0x4f342a,_0x1e2c6a,_0x53b230){const _0x3e8844=_0x5b9f34;this.#e=new P(_0x4f342a,_0x1e2c6a,_0x53b230),this.#o=_0x4f342a,this.#r=typeof _0x1e2c6a==_0x3e8844(0x20d)?_0x1e2c6a:null;}async[_0x5b9f34(0x21e)](){const _0x1d9bc5=_0x5b9f34;return this.#t(),this.#e[_0x1d9bc5(0x21e)]();}async[_0x5b9f34(0x1f4)](_0x5ecf12,_0x175a41,_0x4cde1d){const _0x3643a6=_0x5b9f34;this.#t();let _0x57168f;return _0x4cde1d?.['modelId']!==void 0x0?_0x57168f=_0x4cde1d['modelId']:_0x57168f=_0x175a41[_0x3643a6(0x228)](_0x1192f1=>Array[_0x3643a6(0x1c0)](_0x1192f1[_0x3643a6(0x1f9)])&&_0x1192f1[_0x3643a6(0x1f9)][_0x3643a6(0x1da)]>0x0)?'custom':J,this.#e[_0x3643a6(0x1f4)](_0x5ecf12,_0x175a41,_0x57168f,_0x4cde1d);}async[_0x5b9f34(0x222)](_0x269fa3,_0x2462d9,_0x199c2a){const _0x1b1abf=_0x5b9f34;return this.#t(),this.#e[_0x1b1abf(0x222)](_0x269fa3,_0x2462d9,_0x199c2a);}async[_0x5b9f34(0x1bb)](_0x5367b0){const _0x5393e3=_0x5b9f34;return this.#t(),this.#e[_0x5393e3(0x1bb)](_0x5367b0);}async[_0x5b9f34(0x1ef)](){const _0x4830dc=_0x5b9f34;return this.#t(),this.#e[_0x4830dc(0x1ef)]();}async[_0x5b9f34(0x16e)](_0x418c5b){const _0x3f6700=_0x5b9f34;return this.#t(),this.#e[_0x3f6700(0x16e)](_0x418c5b);}async[_0x5b9f34(0x1eb)](_0x32c019,_0x23a2b1,_0x490c58){const _0x4317a0=_0x5b9f34;return this.#t(),this.#e[_0x4317a0(0x1eb)](_0x32c019,_0x23a2b1,_0x490c58);}async['deleteDocs'](_0x53cc7b,_0x2d6255,_0x3cceb7){const _0x5ed743=_0x5b9f34;return this.#t(),this.#e[_0x5ed743(0x1d9)](_0x53cc7b,_0x2d6255,_0x3cceb7);}async[_0x5b9f34(0x21c)](_0x2994fa){return this.#t(),this.#e['getJobStatus'](_0x2994fa);}async[_0x5b9f34(0x231)](_0x2e692e,_0x363db7,_0x56ddf7){const _0x1b6a29=_0x5b9f34;return this.#t(),_0x227faf(_0x363db7),this.#s('createWebSource',{'rootUrl':_0x2e692e,'indexName':_0x363db7,'maxPages':_0x56ddf7?.[_0x1b6a29(0x189)],'maxDocuments':_0x56ddf7?.[_0x1b6a29(0x1e0)],'maxDepth':_0x56ddf7?.[_0x1b6a29(0x206)],'includePaths':_0x56ddf7?.[_0x1b6a29(0x1fb)],'excludePaths':_0x56ddf7?.[_0x1b6a29(0x1e6)],'respectRobots':_0x56ddf7?.['respectRobots'],'parseDocuments':_0x56ddf7?.['parseDocuments'],'refreshCadence':_0x56ddf7?.[_0x1b6a29(0x183)],'modelId':_0x56ddf7?.[_0x1b6a29(0x1c2)]});}async[_0x5b9f34(0x180)](_0x573081){const _0x2bef5a=_0x5b9f34;this.#t();let _0x2c6f05=(await this.#s('listWebSources',_0x573081!==void 0x0?{'indexName':_0x573081}:void 0x0))[_0x2bef5a(0x210)]??[];return _0x573081===void 0x0?_0x2c6f05:_0x2c6f05['filter'](_0x12fb68=>_0x12fb68['indexName']===_0x573081);}async['getWebSource'](_0x5c1725){return this.#t(),this.#s('getWebSource',{'sourceId':_0x5c1725});}async['updateWebSource'](_0x1dede4,_0x415cfe){const _0x37257a=_0x5b9f34;return this.#t(),this.#s(_0x37257a(0x238),{'sourceId':_0x1dede4,'refreshCadence':_0x415cfe[_0x37257a(0x183)],'rootUrl':_0x415cfe[_0x37257a(0x1c4)],'includePaths':_0x415cfe[_0x37257a(0x1fb)],'excludePaths':_0x415cfe[_0x37257a(0x1e6)],'maxDepth':_0x415cfe[_0x37257a(0x206)],'maxPages':_0x415cfe['maxPages'],'resync':_0x415cfe[_0x37257a(0x1f6)]});}async[_0x5b9f34(0x221)](_0x5186c2){const _0x51dab4=_0x5b9f34;return this.#t(),this.#s(_0x51dab4(0x221),{'sourceId':_0x5186c2});}async[_0x5b9f34(0x170)](_0x5e1476){const _0x595a85=_0x5b9f34;return this.#t(),this.#s(_0x595a85(0x170),{'sourceId':_0x5e1476});}async #s(_0x25c43b,_0x510403){const _0x10370d=_0x5b9f34;if(this.#r===null)throw new Error(_0x10370d(0x218));return $(this.#o,this.#r,_0x25c43b,_0x510403);}async[_0x5b9f34(0x1cf)](_0x19cac5,_0x5abd0d){const _0x1b839e=_0x5b9f34;return this.#t(),this.#e[_0x1b839e(0x1cf)](_0x19cac5,_0x5abd0d);}async[_0x5b9f34(0x1bd)](_0x58db63,_0x5ef272){const _0x3aaa1f=_0x5b9f34;return this.#t(),this.#e[_0x3aaa1f(0x1bd)](_0x58db63,_0x5ef272);}async[_0x5b9f34(0x173)](_0x541f13,_0x46fc49){const _0x1a085a=_0x5b9f34;return this.#t(),this.#e[_0x1a085a(0x173)](_0x541f13,_0x46fc49);}async[_0x5b9f34(0x213)](_0x5e4374){const _0x127210=_0x5b9f34;return this.#t(),this.#e[_0x127210(0x213)](_0x5e4374);}async[_0x5b9f34(0x1a1)](_0x6e198b){const _0x559fef=_0x5b9f34;return this.#t(),this.#e[_0x559fef(0x1a1)](_0x6e198b);}async[_0x5b9f34(0x217)](_0x33fd29,_0xe49993,_0x19b496){const _0x951705=_0x5b9f34;return this.#t(),this.#e[_0x951705(0x217)](_0x33fd29,_0xe49993,_0x19b496);}async[_0x5b9f34(0x177)](_0x4aea79,_0x37f05d,_0xe32ecd){const _0x4b04e0=_0x5b9f34;return this.#t(),this.#e[_0x4b04e0(0x177)](_0x4aea79,_0x37f05d,_0xe32ecd);}async[_0x5b9f34(0x18d)](_0x3f7740,_0x5eecee=J,_0x420cc1){const _0x5c1d83=_0x5b9f34;this.#t();let _0x44be93=this.#e[_0x5c1d83(0x186)],_0x106d80;if(this.#r!==null)_0x106d80=await h[_0x5c1d83(0x1e4)](_0x3f7740,_0x5eecee,this.#o,this.#r,void 0x0,_0x44be93,_0x420cc1);else{let _0x235847=await this.#e['createAuthenticatedSessionInner'](_0x3f7740,_0x5eecee,_0x420cc1);_0x106d80=h[_0x5c1d83(0x1d6)](_0x3f7740,_0x235847,_0x44be93);}await _0x106d80[_0x5c1d83(0x19d)]();for(let _0x217135 of this.#i)_0x217135[_0x5c1d83(0x19f)]()||this.#i[_0x5c1d83(0x21b)](_0x217135);return this.#i['add'](new WeakRef(_0x106d80)),_0x106d80;}#t(){if(this.#a)throw new Error('MossClient\x20is\x20closed');}[_0x5b9f34(0x1d4)](){return this.#n??=this.#u(),this.#n;}async #u(){const _0x27f682=_0x5b9f34;this.#a=!0x0;let _0x1389b0=[...this.#i][_0x27f682(0x187)](_0x447fba=>_0x447fba[_0x27f682(0x19f)]())[_0x27f682(0x220)](_0x415640=>_0x415640!==void 0x0);this.#i['clear'](),await Promise[_0x27f682(0x1ab)](_0x1389b0[_0x27f682(0x187)](_0x5e7d0f=>_0x5e7d0f[_0x27f682(0x1d4)]())),await this.#e[_0x27f682(0x1d4)]();}async[Symbol['asyncDispose']](){const _0x4abae2=_0x5b9f34;return this[_0x4abae2(0x1d4)]();}};export{M as ManageApiError,C as MossClient,h as SessionIndex,oe as isMossError};
|
package/dist/moss.d.ts
CHANGED
|
@@ -679,11 +679,13 @@ export declare interface MossIdentity {
|
|
|
679
679
|
* - **`"moss-mediumlm"`**: Balanced model offering higher accuracy with reasonable performance.
|
|
680
680
|
* Best for applications where search quality is important and moderate latency is acceptable.
|
|
681
681
|
*
|
|
682
|
+
* - **`"moss-litelm"`**: Smallest built-in model, available to entitled organizations.
|
|
683
|
+
*
|
|
682
684
|
* - **`"custom"`**: Use this when providing pre-computed embeddings from external sources.
|
|
683
685
|
* No embedding model is loaded. All documents must include embeddings, and all queries
|
|
684
686
|
* must provide embeddings via QueryOptions.embedding.
|
|
685
687
|
*/
|
|
686
|
-
export declare type MossModel = "moss-minilm" | "moss-mediumlm" | "custom";
|
|
688
|
+
export declare type MossModel = "moss-minilm" | "moss-mediumlm" | "moss-litelm" | "custom";
|
|
687
689
|
|
|
688
690
|
/**
|
|
689
691
|
* Options for async mutation operations (addDocs, deleteDocs).
|
|
@@ -801,7 +803,7 @@ export declare class SessionIndex {
|
|
|
801
803
|
* @internal Construct via `MossClient.session()` — direct instantiation
|
|
802
804
|
* is intentionally unsupported so the auth context flows from the client.
|
|
803
805
|
*/
|
|
804
|
-
constructor(name: string,
|
|
806
|
+
constructor(name: string, inner: SessionIndex_2);
|
|
805
807
|
/**
|
|
806
808
|
* @internal Factory used by `MossClient.session()`. Constructs the
|
|
807
809
|
* underlying Rust `SessionIndex` and wraps it. Async because the
|
|
@@ -815,7 +817,7 @@ export declare class SessionIndex {
|
|
|
815
817
|
* custom-authenticator path, where `InternalMossClient` builds the core
|
|
816
818
|
* handle via the auth bridge (`SessionIndex.withAuthenticator`).
|
|
817
819
|
*/
|
|
818
|
-
static _fromInner(name: string,
|
|
820
|
+
static _fromInner(name: string, inner: SessionIndex_2, applyIdentity?: (target: IdentityTarget) => void): SessionIndex;
|
|
819
821
|
/** The session index name. Identifies the cloud index on `pushIndex` / `loadIndex`. */
|
|
820
822
|
get name(): string;
|
|
821
823
|
/**
|
|
@@ -825,7 +827,11 @@ export declare class SessionIndex {
|
|
|
825
827
|
* up on a later read.
|
|
826
828
|
*/
|
|
827
829
|
get docCount(): number;
|
|
828
|
-
/**
|
|
830
|
+
/**
|
|
831
|
+
* The model this session embeds with, as of its last completed call.
|
|
832
|
+
* `addDocs` and `query` read it on every call to pick their path, and
|
|
833
|
+
* `loadIndex`, `loadFromDisk` or a version that auto-refresh installs can change it.
|
|
834
|
+
*/
|
|
829
835
|
get modelId(): MossModel;
|
|
830
836
|
/**
|
|
831
837
|
* Add or update documents in the local session index.
|
|
@@ -866,6 +872,10 @@ export declare class SessionIndex {
|
|
|
866
872
|
* pulls newer versions in on subsequent reads; the poller pauses
|
|
867
873
|
* while local un-pushed edits exist.
|
|
868
874
|
*
|
|
875
|
+
* The index replaces this session's documents and model, so after a
|
|
876
|
+
* custom-model index loads, `addDocs` and `query` need embeddings.
|
|
877
|
+
* Auto-refresh can install a custom-model version the same way.
|
|
878
|
+
*
|
|
869
879
|
* @returns Number of documents loaded into the session.
|
|
870
880
|
*/
|
|
871
881
|
loadIndex(indexName: string, options?: LoadSessionOptions): Promise<number>;
|
|
@@ -885,6 +895,9 @@ export declare class SessionIndex {
|
|
|
885
895
|
/**
|
|
886
896
|
* Restore a session previously written by `saveToDisk`.
|
|
887
897
|
*
|
|
898
|
+
* The snapshot replaces this session's documents and model, so after a
|
|
899
|
+
* custom-model snapshot loads, `addDocs` and `query` need embeddings.
|
|
900
|
+
*
|
|
888
901
|
* A snapshot saved by an SDK older than 1.8 for a built-in model carries
|
|
889
902
|
* no model artifact provenance, so the core can only restore it as a
|
|
890
903
|
* custom-model session. This method asks the core to rebuild such a
|
|
@@ -914,8 +927,8 @@ export declare class SessionIndex {
|
|
|
914
927
|
* Release the session's native resources deterministically: the
|
|
915
928
|
* auto-refresh poller, the in-memory index, and this session's
|
|
916
929
|
* reference to the shared embedding model. Safe to call more than
|
|
917
|
-
* once. Afterwards `name` and `modelId` stay readable (
|
|
918
|
-
*
|
|
930
|
+
* once. Afterwards `name` and `modelId` stay readable (`modelId` as
|
|
931
|
+
* of the last call); `docCount` and all methods throw "is closed".
|
|
919
932
|
*
|
|
920
933
|
* Also invoked by `await using` (Symbol.asyncDispose).
|
|
921
934
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moss-js/moss",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.17.0",
|
|
4
4
|
"main": "dist/index.esm.js",
|
|
5
5
|
"module": "dist/index.esm.js",
|
|
6
6
|
"types": "dist/moss.d.ts",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"author": "InferEdge Inc.",
|
|
46
46
|
"license": "SEE LICENSE IN LICENSE",
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@moss-js/moss-core": "0.
|
|
48
|
+
"@moss-js/moss-core": "0.32.0"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@eslint/js": "^9.39.4",
|