@moss-js/moss 1.8.0 → 1.10.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 +27 -0
- package/dist/index.esm.js +1 -1
- package/dist/moss.d.ts +119 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -226,6 +226,33 @@ each index, and `filter` applies to every index. `loadIndexes` is best-effort:
|
|
|
226
226
|
names that fail are reported in `failed` without rolling back the ones that
|
|
227
227
|
loaded.
|
|
228
228
|
|
|
229
|
+
## Web sources
|
|
230
|
+
|
|
231
|
+
POST the existing `/v1/manage` web-source actions and return typed results.
|
|
232
|
+
Poll `jobId` with `getJobStatus`. Depends on the index-manager release with
|
|
233
|
+
several sources per index and source-preserving crawls, and the moss-control
|
|
234
|
+
release with the deleteIndex proxy. Set `MOSS_CLOUD_API_BASE_URL` to send
|
|
235
|
+
manage calls to a non-default host (defaults to `https://service.usemoss.dev`).
|
|
236
|
+
|
|
237
|
+
```typescript
|
|
238
|
+
const created = await mossClient.createWebSource(
|
|
239
|
+
"https://docs.example.com",
|
|
240
|
+
"knowledge-base",
|
|
241
|
+
{ maxPages: 200, refreshCadence: "weekly" },
|
|
242
|
+
);
|
|
243
|
+
await mossClient.getJobStatus(created.jobId);
|
|
244
|
+
|
|
245
|
+
const sources = await mossClient.listWebSources("knowledge-base");
|
|
246
|
+
const source = await mossClient.getWebSource(created.id);
|
|
247
|
+
const updated = await mossClient.updateWebSource(created.id, {
|
|
248
|
+
refreshCadence: "daily",
|
|
249
|
+
});
|
|
250
|
+
// updated.jobId is set when resync: true enqueued a crawl.
|
|
251
|
+
const resync = await mossClient.resyncWebSource(created.id);
|
|
252
|
+
const deleted = await mossClient.deleteWebSource(created.id);
|
|
253
|
+
// deleted.purgeJobId is set when a purge was enqueued.
|
|
254
|
+
```
|
|
255
|
+
|
|
229
256
|
## Metadata filtering
|
|
230
257
|
|
|
231
258
|
You can pass a metadata filter in `query` options after loading an index locally:
|
package/dist/index.esm.js
CHANGED
|
@@ -1 +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};
|
|
1
|
+
const _0x1d9c9a=_0xb15c;(function(_0x4e98a7,_0x492d2d){const _0x2a6859=_0xb15c,_0x5ba88b=_0x4e98a7();while(!![]){try{const _0x17a5ed=-parseInt(_0x2a6859(0x1b9))/0x1+-parseInt(_0x2a6859(0x1d0))/0x2*(-parseInt(_0x2a6859(0x207))/0x3)+-parseInt(_0x2a6859(0x22b))/0x4*(-parseInt(_0x2a6859(0x1e3))/0x5)+parseInt(_0x2a6859(0x149))/0x6*(parseInt(_0x2a6859(0x1f7))/0x7)+parseInt(_0x2a6859(0x20d))/0x8*(parseInt(_0x2a6859(0x21f))/0x9)+-parseInt(_0x2a6859(0x160))/0xa*(parseInt(_0x2a6859(0x18b))/0xb)+parseInt(_0x2a6859(0x1d6))/0xc*(-parseInt(_0x2a6859(0x199))/0xd);if(_0x17a5ed===_0x492d2d)break;else _0x5ba88b['push'](_0x5ba88b['shift']());}catch(_0x243a1b){_0x5ba88b['push'](_0x5ba88b['shift']());}}}(_0x3424,0xb1644));import{JobStatus as _0x2b3a90}from'@moss-js/moss-core';import*as _0x138886 from'@moss-js/moss-core';import*as _0x531af6 from'@moss-js/moss-core';var p=_0x531af6,Ie=p[_0x1d9c9a(0x14f)],fe=p['SDK_VERSION_NUMBER'],ye=p[_0x1d9c9a(0x174)],E=p[_0x1d9c9a(0x1f1)],xe=typeof process<'u'&&process[_0x1d9c9a(0x1f3)][_0x1d9c9a(0x1ba)]||p[_0x1d9c9a(0x173)],_=typeof process<'u'?process['env']:{},I=class{constructor(_0x5ec9de,_0x314b81){const _0x49c46b=_0x1d9c9a;this[_0x49c46b(0x1ae)]=_0x5ec9de,this['projectKey']=_0x314b81,this[_0x49c46b(0x15c)]=_[_0x49c46b(0x16e)]??E;}[_0x1d9c9a(0x1ae)];[_0x1d9c9a(0x1ea)];[_0x1d9c9a(0x15c)];async['getAuthToken'](){const _0x20d68e=_0x1d9c9a;let _0x136d8b=await fetch(this[_0x20d68e(0x15c)],{'method':'POST','headers':{'Content-Type':_0x20d68e(0x18c)},'body':JSON[_0x20d68e(0x165)]({'projectId':this[_0x20d68e(0x1ae)],'projectKey':this[_0x20d68e(0x1ea)]}),'signal':AbortSignal[_0x20d68e(0x18a)](0x7530)});if(_0x136d8b[_0x20d68e(0x1f4)]===0x191){let _0x1f6aaa=await _0x136d8b[_0x20d68e(0x1e9)]();throw new Error(_0x20d68e(0x14a)+_0x1f6aaa);}if(!_0x136d8b['ok']){let _0x451e30=await _0x136d8b[_0x20d68e(0x1e9)]();throw new Error(_0x20d68e(0x22a)+_0x136d8b[_0x20d68e(0x1f4)]+':\x20'+_0x451e30);}let _0x4ea64c=await _0x136d8b[_0x20d68e(0x15f)]();return{'token':_0x4ea64c[_0x20d68e(0x1d2)],'expiresIn':_0x4ea64c['expiresIn']};}async[_0x1d9c9a(0x1b0)](){const _0x4dd088=_0x1d9c9a;let {token:_0x469c1f}=await this[_0x4dd088(0x15b)]();return _0x4dd088(0x15e)+_0x469c1f;}},f=class{constructor(_0x59ed3b){const _0x1ecc64=_0x1d9c9a;this[_0x1ecc64(0x192)]=_0x59ed3b;}['inner'];[_0x1d9c9a(0x1b8)]=null;[_0x1d9c9a(0x1fe)]=null;async[_0x1d9c9a(0x15b)](){const _0x5c471f=_0x1d9c9a;if(this[_0x5c471f(0x1b8)]&&this[_0x5c471f(0x1b8)][_0x5c471f(0x21e)]>Date[_0x5c471f(0x190)]())return{'token':this[_0x5c471f(0x1b8)][_0x5c471f(0x1d2)],'expiresIn':this[_0x5c471f(0x1b8)]['expiresIn']};if(this[_0x5c471f(0x1fe)])return this[_0x5c471f(0x1fe)];this[_0x5c471f(0x1fe)]=this[_0x5c471f(0x1a1)]();try{return await this[_0x5c471f(0x1fe)];}finally{this[_0x5c471f(0x1fe)]=null;}}async[_0x1d9c9a(0x1b0)](){const _0x204c9a=_0x1d9c9a;let {token:_0x579914}=await this[_0x204c9a(0x15b)]();return _0x204c9a(0x15e)+_0x579914;}async[_0x1d9c9a(0x1a1)](){const _0x38fb28=_0x1d9c9a;let {token:_0x517dc8,expiresIn:_0x21de41}=await this[_0x38fb28(0x192)][_0x38fb28(0x15b)](),_0x37a77d=Date[_0x38fb28(0x190)]()+(_0x21de41-0x3c)*0x3e8;return this['cache']={'token':_0x517dc8,'expiresIn':_0x21de41,'expiresAt':_0x37a77d},{'token':_0x517dc8,'expiresIn':_0x21de41};}};import{randomUUID as _0x20e6fa}from'node:crypto';import{existsSync as _0x40895e,mkdirSync as _0x56d12c,readFileSync as _0x489f9c,writeFileSync as _0x476dff}from'node:fs';import{homedir as _0x1e747f}from'node:os';import{join as _0x461421,resolve as _0x1713a1}from'node:path';function _0xb15c(_0x10f699,_0x5bdf5e){_0x10f699=_0x10f699-0x149;const _0x342462=_0x3424();let _0xb15cee=_0x342462[_0x10f699];return _0xb15cee;}var ne=_0x1d9c9a(0x22c),re=_0x1d9c9a(0x16a),S=0x100,L=/[\p{Cc}\p{Cf}\p{Cs}\uFFFD]/u,j=_0x1d9c9a(0x1cd);function se(_0x152c40){const _0x5253a0=_0x1d9c9a;return _0x152c40[_0x5253a0(0x1a8)]>0x0&&_0x152c40[_0x5253a0(0x203)]()===_0x152c40&&!L[_0x5253a0(0x1be)](_0x152c40)&&new TextEncoder()[_0x5253a0(0x1b5)](_0x152c40)[_0x5253a0(0x1bc)]<=S;}function oe(_0x2b3b29){const _0x38375e=_0x1d9c9a;try{let _0x1887e8=_0x1713a1(_0x2b3b29),_0xc7e461=_0x461421(_0x1887e8,ne);if(_0x40895e(_0xc7e461)){let _0x1b999b=_0x489f9c(_0xc7e461,_0x38375e(0x202))[_0x38375e(0x203)]();if(se(_0x1b999b))return _0x1b999b;}_0x56d12c(_0x1887e8,{'recursive':!0x0});let _0x5d8b49=_0x20e6fa();return _0x476dff(_0xc7e461,_0x5d8b49,_0x38375e(0x202)),_0x5d8b49;}catch{return _0x20e6fa();}}function _0x3424(){const _0x14b21b=['test','_create','\x22\x20is\x20not\x20loaded.\x20Call\x20loadIndex(\x22','HOME','parseDocuments','error','_warmModel','resyncWebSource','hostDeviceId','query','createIndexFromFiles\x20requires\x20at\x20least\x20one\x20file','Web\x20source\x20methods\x20require\x20a\x20project\x20key.\x20Construct\x20MossClient\x20with\x20(projectId,\x20projectKey).','fromEntries','jobId','SessionIndex','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.','docCount','deviceId','2qsOiow','unloadIndexes','token','Unsupported\x20data\x20type\x20for\x20file\x20upload','userId','createIndexFromFiles','12bFNEpu','deviceIdState','wrapProgress','\x20must\x20not\x20have\x20leading\x20or\x20trailing\x20whitespace','map','name','uploading','replace','/v1/manage','rejectAuthRequest','some','from','ManageClient','10gINEzS','progress','MossClient\x20is\x20closed','listWebSources','contentType','\x20contains\x20an\x20unsupported\x20character','text','projectKey','_fromInner','\x20must\x20be\x20at\x20most\x20','received\x20an\x20array\x20where\x20a\x20JobProgress\x20object\x20was\x20expected','moss-core\x20rejected\x20the\x20auth\x20token:\x20','SessionIndex\x20\x27','includePaths','CLOUD_API_AUTH_URL','configuredIdentity','env','status','string','resync','609nToUsf','toByteArray','setIdentity','startsWith','sources','.\x20All\x20documents\x20must\x20have\x20.embedding\x20set\x20when\x20using\x20modelId=\x27custom\x27.','added','inflight','The\x20installed\x20@moss-js/moss-core\x20runtime\x20does\x20not\x20support\x20exact\x20model\x20artifact\x20identities.\x20Upgrade\x20moss-core\x20before\x20creating\x20this\x20session.','queryText','object','utf8','trim','getDocuments','isArray','MossClient\x20options.identity\x20must\x20be\x20an\x20object','924864RvFXsF','\x20UTF-8\x20bytes','toLowerCase','path','filter','moss-core\x20runtime\x20is\x20missing\x20ManageClient/IndexManager\x20exports','1880wHaLEi','authNotifyFn','\x20could\x20not\x20be\x20settled:\x20','isFinite','\x20Provide\x20a\x20query\x20vector\x20via\x20options.embedding,\x20or\x20use\x20alpha\x200\x20for\x20keyword-only\x20search.','Building','parse','rootUrl','data','loadIndex','slice','loadQueryModel','entries','upsert','hasIndex','body','delete','expiresAt','16092SkURme','loadModel','default','\x20must\x20be\x20a\x20non-empty\x20string','custom','call','indexName','getWebSource','loadIndexes','refreshCadence','all','HTTP\x20','1776212CdKgBh','.moss-device-id','64920uDDQIA','Authentication\x20failed\x20(HTTP\x20401):\x20','includes','version','[moss]\x20Ignoring\x20an\x20auth\x20request\x20with\x20no\x20usable\x20request\x20id;\x20custom\x20authentication\x20may\x20be\x20unavailable\x20for\x20this\x20client.\x20Cause:\x20','queryMultiIndexText','MODEL_DOWNLOAD_URL','modelId','onProgress','alpha','deleteDocs','deleteDocs\x20requires\x20at\x20least\x20one\x20document\x20ID','getIndex','pending_upload','\x22)\x20or\x20loadIndexes([...])\x20before\x20querying;\x20queries\x20run\x20locally\x20and\x20there\x20is\x20no\x20cloud\x20query\x20fallback.','deref','MossClient\x20options.identity.','isSafeInteger','getAuthToken','authUrl','getJobStatus','Bearer\x20','json','2140nODIIE','moss-core\x20runtime\x20SessionIndex\x20is\x20missing\x20the\x20withAuthenticator\x20factory.\x20Upgrade\x20@moss-js/moss-core\x20to\x20a\x20build\x20that\x20supports\x20custom\x20authenticators\x20for\x20sessions.','topK','function','The\x20installed\x20@moss-js/moss-core\x20does\x20not\x20support\x20multi-index\x20operations\x20(queryMultiIndex,\x20loadIndexes,\x20unloadIndexes).\x20Upgrade\x20@moss-js/moss-core.','stringify','createWebSource','deviceIdCachePath','deleteDocuments','USERPROFILE','.moss','getDocs','updated','completed','MOSS_AUTH_URL','maxDocuments','requireMultiIndexCore','[moss]\x20Auth\x20request\x20','embedding','CLOUD_API_INDEX_URL','CLOUD_API_IDENTITY_URL','building','addDocs','excludePaths','createIndex','normalizeJobStatus','applyIdentityToManager','warn','callerSupplied','One\x20or\x20more\x20indexes\x20use\x20custom\x20embeddings.\x20Provide\x20a\x20query\x20vector\x20via\x20options.embedding,\x20or\x20use\x20alpha\x200\x20for\x20keyword-only\x20search.','This\x20session\x20uses\x20custom\x20embeddings.\x20Provide\x20a\x20query\x20embedding\x20via\x20QueryOptions.embedding.','no\x20exact\x20artifact\x20identity','setDeviceId','pushIndex','resolveAuthRequest','asyncDispose','Unsupported\x20job\x20status\x20\x27','PendingUpload','addDocuments','requires\x20explicit\x20query\x20embeddings','applied','saveToDisk','timeout','32593GVEaHB','application/json','Uploading','POST','clear','now','create','inner','HTTP\x20error!\x20status:\x20','updateWebSource','unloadIndex','@moss-js/moss-core\x20>=\x200.20.0\x20is\x20required\x20for\x20SessionIndex.close()','received\x20a\x20progress\x20event\x20with\x20a\x20non-string\x20currentPhase\x20(','received\x20a\x20progress\x20event\x20with\x20a\x20missing\x20or\x20empty\x20status\x20(','437086CDyfHt','respectRobots','deleteWebSource','parseOptions','indexManager','manifestSha256','deleteIndex','createAuthenticatedSessionInner','fetchAndCache','identity','mossDeviceId','createIndex\x20requires\x20at\x20least\x20one\x20document','withAuthenticator','bind','close','length','listIndexes','manageClient','currentPhase','queryMultiIndex','authenticator','projectId','message','getAuthHeader','hasCustomAuthenticator','maxDepth','failed','queryMultiIndex\x20requires\x20at\x20least\x20one\x20index\x20name','encode','moss-core\x20runtime\x20is\x20missing\x20resolveAuthRequest/rejectAuthRequest\x20exports.\x20Ensure\x20you\x20are\x20using\x20a\x20moss-core\x20build\x20that\x20supports\x20custom\x20authenticators.','IndexManager','cache','1163614yGiNxv','MOSS_INDEX_URL','join','byteLength','Documents\x20missing\x20.embedding\x20for\x20custom\x20model:\x20'];_0x3424=function(){return _0x14b21b;};return _0x3424();}function ie(_0x3018d5=process['env']){const _0x345701=_0x1d9c9a;let _0x31cfbc=_0x3018d5[_0x345701(0x1c1)]?.[_0x345701(0x203)]()||_0x3018d5[_0x345701(0x169)]?.['trim']()||_0x1e747f();return _0x461421(_0x31cfbc,re);}function k(_0x173c33,_0x26db39){const _0x21bebd=_0x1d9c9a;if(_0x173c33!==void 0x0){if(typeof _0x173c33!=_0x21bebd(0x1f5)||_0x173c33['length']===0x0)throw new TypeError(_0x21bebd(0x159)+_0x26db39+_0x21bebd(0x222));if(_0x173c33[_0x21bebd(0x203)]()!==_0x173c33)throw new TypeError(_0x21bebd(0x159)+_0x26db39+_0x21bebd(0x1d9));if(L[_0x21bebd(0x1be)](_0x173c33))throw new TypeError(_0x21bebd(0x159)+_0x26db39+_0x21bebd(0x1e8));if(new TextEncoder()[_0x21bebd(0x1b5)](_0x173c33)[_0x21bebd(0x1bc)]>S)throw new TypeError('MossClient\x20options.identity.'+_0x26db39+_0x21bebd(0x1ec)+S+_0x21bebd(0x208));return _0x173c33;}}function F(_0x1b99d7){const _0xec9af2=_0x1d9c9a;if(_0x1b99d7!==void 0x0){if(_0x1b99d7===null||typeof _0x1b99d7!=_0xec9af2(0x201)||Array[_0xec9af2(0x205)](_0x1b99d7))throw new TypeError(_0xec9af2(0x206));return Object['freeze']({'deviceId':k(_0x1b99d7[_0xec9af2(0x1cf)],_0xec9af2(0x1cf)),'userId':k(_0x1b99d7[_0xec9af2(0x1d4)],_0xec9af2(0x1d4))});}}function P(_0x237ef7){const _0x38bc0e=_0x1d9c9a;return _0x237ef7?.[_0x38bc0e(0x1cf)]!==void 0x0||_0x237ef7?.['userId']!==void 0x0;}function W(_0x5eb3d1){const _0x5e7b93=_0x1d9c9a;if(typeof _0x5eb3d1[_0x5e7b93(0x1f9)]!='function')throw new Error(j);}function ae(_0x5c60ae,_0x2cc583,_0x209a31=process[_0x1d9c9a(0x1f3)]){const _0x25c4da=_0x1d9c9a;if(_0x5c60ae['id'])return _0x5c60ae['id'];let _0x2b59b5=_0x2cc583?.[_0x25c4da(0x203)]()?_0x2cc583:ie(_0x209a31);return _0x5c60ae['id']=oe(_0x2b59b5),_0x5c60ae['id'];}function ue(_0x4cc1f7,_0x235b8e){const _0x1f0d87=_0x1d9c9a;if(typeof _0x4cc1f7[_0x1f0d87(0x180)]!=_0x1f0d87(0x163))return!0x0;try{return _0x4cc1f7[_0x1f0d87(0x180)](_0x235b8e),!0x0;}catch{return!0x1;}}function M(_0x13b7eb,_0x150049,_0x337acb,_0x219d8f=process[_0x1d9c9a(0x1f3)]){const _0x227123=_0x1d9c9a;let _0x20f89e=ae(_0x13b7eb,_0x337acb,_0x219d8f);return{'deviceId':_0x150049?.[_0x227123(0x1cf)]??_0x20f89e,'hostDeviceId':_0x150049?.[_0x227123(0x1cf)],'mossDeviceId':_0x20f89e,'userId':_0x150049?.[_0x227123(0x1d4)],'callerSupplied':P(_0x150049)};}function v(_0x49d839,_0x2e9a0e){const _0x5e5917=_0x1d9c9a;if(typeof _0x49d839['setIdentity']!=_0x5e5917(0x163)){if(_0x2e9a0e['callerSupplied'])throw new Error(j);return ue(_0x49d839,_0x2e9a0e[_0x5e5917(0x1cf)]);}if(!_0x2e9a0e[_0x5e5917(0x17c)])try{return _0x49d839['setIdentity'](null,null,_0x2e9a0e[_0x5e5917(0x1a3)]),!0x0;}catch{return!0x1;}return _0x49d839[_0x5e5917(0x1f9)](_0x2e9a0e[_0x5e5917(0x1c6)]??null,_0x2e9a0e[_0x5e5917(0x1d4)]??null,_0x2e9a0e['mossDeviceId']),!0x0;}function N(_0x27de3f,_0x468c78,_0x226590,_0x469167,_0x2b10ba=process['env']){const _0x2941a0=_0x1d9c9a;_0x468c78[_0x2941a0(0x188)]||(_0x468c78['applied']=v(_0x27de3f,M(_0x468c78,_0x226590,_0x469167,_0x2b10ba)));}var de=0x1;function y(_0x48e8d6){const _0x4208cc=_0x1d9c9a;let _0x53dbd3=_0x48e8d6['modelArtifactContractVersion'];if(typeof _0x53dbd3!=_0x4208cc(0x163))throw $();let _0x31131b=_0x53dbd3[_0x4208cc(0x224)](_0x48e8d6);if(!Number[_0x4208cc(0x15a)](_0x31131b)||_0x31131b<de)throw $();}function $(){const _0x3875e2=_0x1d9c9a;return new Error(_0x3875e2(0x1ff));}var Ce=0x708*0x3e8;function A(_0x381cc2){const _0x487000=_0x1d9c9a;return _0x381cc2 instanceof Error?_0x381cc2[_0x487000(0x1af)]:String(_0x381cc2);}function ce(_0x5750ff){const _0x5294b6=_0x1d9c9a;if(_0x5750ff===null||typeof _0x5750ff!='object')return'received\x20'+String(_0x5750ff);if(Array[_0x5294b6(0x205)](_0x5750ff))return _0x5294b6(0x1ed);let _0x495810=_0x5750ff;return typeof _0x495810[_0x5294b6(0x1cb)]!=_0x5294b6(0x1f5)||_0x495810[_0x5294b6(0x1cb)][_0x5294b6(0x1a8)]===0x0?'received\x20a\x20progress\x20event\x20with\x20a\x20missing\x20or\x20empty\x20jobId\x20('+String(_0x495810[_0x5294b6(0x1cb)])+')':typeof _0x495810['status']!=_0x5294b6(0x1f5)||_0x495810['status'][_0x5294b6(0x1a8)]===0x0?_0x5294b6(0x198)+String(_0x495810[_0x5294b6(0x1f4)])+')':typeof _0x495810[_0x5294b6(0x1e4)]!='number'||!Number[_0x5294b6(0x210)](_0x495810['progress'])?'received\x20a\x20progress\x20event\x20with\x20a\x20non-finite\x20progress\x20value\x20('+String(_0x495810['progress'])+')':_0x495810[_0x5294b6(0x1ab)]!==void 0x0&&_0x495810[_0x5294b6(0x1ab)]!==null&&typeof _0x495810['currentPhase']!=_0x5294b6(0x1f5)?_0x5294b6(0x197)+String(_0x495810['currentPhase'])+')':null;}var x=class{[_0x1d9c9a(0x1ad)];[_0x1d9c9a(0x1aa)];['indexManager'];[_0x1d9c9a(0x1d7)]={'applied':!0x1};[_0x1d9c9a(0x167)];[_0x1d9c9a(0x1f2)];[_0x1d9c9a(0x1ae)];[_0x1d9c9a(0x20e)];constructor(_0x1350f6,_0x2a22ae,_0x111c53){const _0x4ca37a=_0x1d9c9a;this[_0x4ca37a(0x1f2)]=F(_0x111c53?.[_0x4ca37a(0x1a2)]),this['deviceIdCachePath']=_0x111c53?.['cachePath'],this[_0x4ca37a(0x1ae)]=_0x1350f6;let _0x18a5da=typeof _0x2a22ae=='string'?new I(_0x1350f6,_0x2a22ae):_0x2a22ae;this['authenticator']=new f(_0x18a5da);let _0x301767=_0x138886,_0x3b65ee=_0x301767[_0x4ca37a(0x1e2)]??_0x301767[_0x4ca37a(0x221)]?.[_0x4ca37a(0x1e2)],_0x38e8eb=_0x301767[_0x4ca37a(0x1b7)]??_0x301767[_0x4ca37a(0x221)]?.[_0x4ca37a(0x1b7)];if(!_0x3b65ee||!_0x38e8eb)throw new Error(_0x4ca37a(0x20c));if(typeof _0x2a22ae==_0x4ca37a(0x1f5))this[_0x4ca37a(0x1aa)]=new _0x3b65ee(_0x1350f6,_0x2a22ae),this['indexManager']=new _0x38e8eb(_0x1350f6,_0x2a22ae);else{let _0x402189=_0x301767[_0x4ca37a(0x182)]??_0x301767[_0x4ca37a(0x221)]?.['resolveAuthRequest'],_0x366764=_0x301767[_0x4ca37a(0x1df)]??_0x301767[_0x4ca37a(0x221)]?.['rejectAuthRequest'];if(!_0x402189||!_0x366764)throw new Error(_0x4ca37a(0x1b6));let _0x4384ff=this[_0x4ca37a(0x1ad)],_0xb74df0=(_0x21ed52,_0x23500b)=>{const _0x39a95a=_0x4ca37a;try{_0x366764(_0x21ed52,_0x23500b);}catch(_0x4d118d){console[_0x39a95a(0x17b)](_0x39a95a(0x171)+_0x21ed52+_0x39a95a(0x20f)+A(_0x4d118d));}},_0x1ff085=(_0x5f332e,_0xe77228)=>{const _0x3aebb7=_0x4ca37a;try{_0x402189(_0x5f332e,_0xe77228);}catch(_0x5d0ec3){_0xb74df0(_0x5f332e,_0x3aebb7(0x1ee)+A(_0x5d0ec3));}},_0x3c4ae6=!0x1,_0x547521=(_0x12940d,_0x160682)=>{const _0x2cbbe0=_0x4ca37a;if(_0x12940d||!Number['isSafeInteger'](_0x160682)||_0x160682<0x0){_0x3c4ae6||(_0x3c4ae6=!0x0,console[_0x2cbbe0(0x17b)](_0x2cbbe0(0x14d)+(_0x12940d?_0x12940d[_0x2cbbe0(0x1af)]:'received\x20'+String(_0x160682))));return;}_0x4384ff['getAuthHeader']()['then'](_0x4cdb12=>{const _0x1cafea=_0x2cbbe0;let _0x51863b=_0x4cdb12[_0x1cafea(0x1fa)]('Bearer\x20')?_0x4cdb12[_0x1cafea(0x217)](0x7):_0x4cdb12;_0x1ff085(_0x160682,_0x51863b);},_0x3604dc=>_0xb74df0(_0x160682,A(_0x3604dc)));};this[_0x4ca37a(0x20e)]=_0x547521;let _0x54b7d1=_0x3b65ee,_0x1f4ba8=_0x38e8eb;if(!_0x54b7d1[_0x4ca37a(0x1a5)]||!_0x1f4ba8[_0x4ca37a(0x1a5)])throw new Error('moss-core\x20runtime\x20ManageClient/IndexManager\x20is\x20missing\x20withAuthenticator\x20factory.\x20Ensure\x20you\x20are\x20using\x20a\x20moss-core\x20build\x20that\x20supports\x20custom\x20authenticators.');this[_0x4ca37a(0x1aa)]=_0x54b7d1['withAuthenticator'](_0x1350f6,_0x547521),this[_0x4ca37a(0x19d)]=_0x1f4ba8[_0x4ca37a(0x1a5)](_0x1350f6,_0x547521);}P(this[_0x4ca37a(0x1f2)])&&W(this[_0x4ca37a(0x19d)]);}async[_0x1d9c9a(0x1a7)](){const _0x37df2d=_0x1d9c9a;let _0x53c87b=this['indexManager'][_0x37df2d(0x1a7)];if(typeof _0x53c87b!='function')throw new Error('@moss-js/moss-core\x20>=\x200.20.0\x20is\x20required\x20for\x20MossClient.close()');await _0x53c87b[_0x37df2d(0x224)](this['indexManager']);}async[_0x1d9c9a(0x15b)](){const _0xa236c0=_0x1d9c9a;return this[_0xa236c0(0x1ad)][_0xa236c0(0x15b)]();}['wrapProgress'](_0x29a189){if(!_0x29a189)return;let _0x32c5d9=!0x1;return(_0x37dad8,_0x333e7b)=>{const _0x4938a6=_0xb15c;let _0x384a63=_0x37dad8?_0x37dad8[_0x4938a6(0x1af)]:ce(_0x333e7b);if(_0x384a63!==null){_0x32c5d9||(_0x32c5d9=!0x0,console['warn']('[moss]\x20Dropping\x20a\x20malformed\x20job\x20progress\x20event;\x20progress\x20reporting\x20may\x20be\x20incomplete\x20for\x20this\x20operation.\x20Cause:\x20'+_0x384a63));return;}_0x29a189(_0x333e7b);};}['normalizeJobStatus'](_0x476d07){const _0x10e06c=_0x1d9c9a;let _0x234d49=_0x476d07['trim']()[_0x10e06c(0x209)]()['replace'](/\s+/g,'_'),_0x23f6bc=_0x234d49['replace'](/_/g,'');if(_0x234d49===_0x10e06c(0x156)||_0x23f6bc==='pendingupload')return _0x2b3a90[_0x10e06c(0x185)];if(_0x234d49===_0x10e06c(0x1dc))return _0x2b3a90[_0x10e06c(0x18d)];if(_0x234d49===_0x10e06c(0x175))return _0x2b3a90[_0x10e06c(0x212)];if(_0x234d49===_0x10e06c(0x16d))return _0x2b3a90['Completed'];if(_0x234d49===_0x10e06c(0x1b3))return _0x2b3a90['Failed'];throw new Error(_0x10e06c(0x184)+_0x476d07+'\x27\x20returned\x20by\x20moss-core');}async['createIndex'](_0x4e911d,_0x25f6a4,_0x29ce83,_0x1b99d3){const _0xd150f5=_0x1d9c9a;if(!_0x25f6a4[_0xd150f5(0x1a8)])throw new Error(_0xd150f5(0x1a4));return await this[_0xd150f5(0x1aa)]['createIndex'](_0x4e911d,_0x25f6a4,_0x29ce83,this[_0xd150f5(0x1d8)](_0x1b99d3?.[_0xd150f5(0x151)]));}async[_0x1d9c9a(0x1f8)](_0x17b6cb){const _0x10cd0f=_0x1d9c9a;if(_0x17b6cb instanceof Uint8Array)return Array[_0x10cd0f(0x1e1)](_0x17b6cb);if(_0x17b6cb instanceof ArrayBuffer)return Array[_0x10cd0f(0x1e1)](new Uint8Array(_0x17b6cb));if(typeof _0x17b6cb['arrayBuffer']=='function'){let _0x2bb70d=await _0x17b6cb['arrayBuffer']();return Array[_0x10cd0f(0x1e1)](new Uint8Array(_0x2bb70d));}throw new Error(_0x10cd0f(0x1d3));}async[_0x1d9c9a(0x1d5)](_0x43ea98,_0x142eb4,_0xb942e){const _0x398443=_0x1d9c9a;if(_0x142eb4['length']===0x0)throw new Error(_0x398443(0x1c8));let _0x2db9e9=_0xb942e?.[_0x398443(0x150)]??'moss-minilm',_0x54f188=await Promise['all'](_0x142eb4[_0x398443(0x1da)](async _0x4c7fea=>({'name':_0x4c7fea[_0x398443(0x1db)],'contentType':_0x4c7fea[_0x398443(0x1e7)],'path':_0x4c7fea[_0x398443(0x20a)]??void 0x0,'data':_0x4c7fea['data']!=null?await this[_0x398443(0x1f8)](_0x4c7fea[_0x398443(0x215)]):void 0x0})));return await this[_0x398443(0x1aa)][_0x398443(0x1d5)](_0x43ea98,_0x54f188,_0x2db9e9,this['wrapProgress'](_0xb942e?.['onProgress']),_0xb942e?.[_0x398443(0x19c)]??null);}async['addDocs'](_0x41a2f1,_0x26a8dc,_0x49a117){const _0x26f789=_0x1d9c9a;if(Array[_0x26f789(0x205)](_0x26a8dc)&&_0x26a8dc[_0x26f789(0x1a8)]===0x0)throw new Error('addDocs\x20requires\x20at\x20least\x20one\x20document');return await this[_0x26f789(0x1aa)]['addDocs'](_0x41a2f1,_0x26a8dc,_0x49a117??null,this[_0x26f789(0x1d8)](_0x49a117?.[_0x26f789(0x151)]));}async[_0x1d9c9a(0x153)](_0x51a910,_0x1c2e66,_0x4b6cbf){const _0x5e0163=_0x1d9c9a;if(Array['isArray'](_0x1c2e66)&&_0x1c2e66['length']===0x0)throw new Error(_0x5e0163(0x154));return await this[_0x5e0163(0x1aa)][_0x5e0163(0x153)](_0x51a910,_0x1c2e66,this[_0x5e0163(0x1d8)](_0x4b6cbf?.[_0x5e0163(0x151)]));}async['getJobStatus'](_0x37d06c){const _0x32d421=_0x1d9c9a;let _0x2155b7=await this[_0x32d421(0x1aa)][_0x32d421(0x15d)](_0x37d06c);return{..._0x2155b7,'status':this[_0x32d421(0x179)](_0x2155b7['status']),'currentPhase':_0x2155b7[_0x32d421(0x1ab)]??null,'error':_0x2155b7[_0x32d421(0x1c3)]??null};}async[_0x1d9c9a(0x155)](_0x2ad83a){const _0x1c5afd=_0x1d9c9a;return this[_0x1c5afd(0x1aa)][_0x1c5afd(0x155)](_0x2ad83a);}async[_0x1d9c9a(0x1a9)](){const _0x328d2c=_0x1d9c9a;return this[_0x328d2c(0x1aa)]['listIndexes']();}async[_0x1d9c9a(0x19f)](_0x108113){const _0x4aa0fa=_0x1d9c9a;return this[_0x4aa0fa(0x1aa)][_0x4aa0fa(0x19f)](_0x108113);}async[_0x1d9c9a(0x16b)](_0x10b19c,_0x575d0c){return this['manageClient']['getDocs'](_0x10b19c,_0x575d0c??null);}async[_0x1d9c9a(0x216)](_0x299089,_0x21e326){const _0x388c82=_0x1d9c9a;this[_0x388c82(0x17a)](_0x21e326?.['cachePath']);let _0x19c64b=await this[_0x388c82(0x19d)][_0x388c82(0x216)](_0x299089,_0x21e326??null);return _0x19c64b['model']['id']!=='custom'&&await this[_0x388c82(0x19d)][_0x388c82(0x218)](_0x299089),_0x19c64b[_0x388c82(0x1db)];}async['loadIndexes'](_0x50faaa,_0x2a4d14){const _0x58e45a=_0x1d9c9a;let _0x5efe8a=this[_0x58e45a(0x170)]();return this['applyIdentityToManager'](_0x2a4d14?.['cachePath']),_0x5efe8a[_0x58e45a(0x227)](_0x50faaa,_0x2a4d14??null);}async['unloadIndex'](_0xe1e75a){const _0x302cc1=_0x1d9c9a;return this[_0x302cc1(0x19d)][_0x302cc1(0x195)](_0xe1e75a);}async[_0x1d9c9a(0x1d1)](_0x1cb298){const _0x5d4103=_0x1d9c9a;return this[_0x5d4103(0x170)]()[_0x5d4103(0x1d1)](_0x1cb298);}['requireMultiIndexCore'](){const _0x44353a=_0x1d9c9a;let _0x1ebced=this[_0x44353a(0x19d)];if(typeof _0x1ebced[_0x44353a(0x1ac)]!=_0x44353a(0x163)||typeof _0x1ebced[_0x44353a(0x14e)]!=_0x44353a(0x163)||typeof _0x1ebced[_0x44353a(0x227)]!='function'||typeof _0x1ebced[_0x44353a(0x1d1)]!=_0x44353a(0x163))throw new Error(_0x44353a(0x164));return{'queryMultiIndex':_0x1ebced['queryMultiIndex'][_0x44353a(0x1a6)](_0x1ebced),'queryMultiIndexText':_0x1ebced['queryMultiIndexText'][_0x44353a(0x1a6)](_0x1ebced),'loadIndexes':_0x1ebced['loadIndexes']['bind'](_0x1ebced),'unloadIndexes':_0x1ebced['unloadIndexes'][_0x44353a(0x1a6)](_0x1ebced)};}[_0x1d9c9a(0x17a)](_0x59b650){const _0x368e43=_0x1d9c9a;N(this[_0x368e43(0x19d)],this['deviceIdState'],this[_0x368e43(0x1f2)],this[_0x368e43(0x167)]??_0x59b650);}['resolveIdentityForSession'](){const _0x20d545=_0x1d9c9a;return M(this['deviceIdState'],this[_0x20d545(0x1f2)],this[_0x20d545(0x167)]);}[_0x1d9c9a(0x1b1)](){return this['authNotifyFn']!==void 0x0;}async[_0x1d9c9a(0x1a0)](_0x4904de,_0xfa3f79,_0x5025c8){const _0x32d003=_0x1d9c9a;if(!this[_0x32d003(0x20e)])throw new Error('createAuthenticatedSessionInner\x20requires\x20a\x20custom\x20IAuthenticator\x20client');let _0x52d08a=_0x138886,_0x57be9b=_0x52d08a[_0x32d003(0x1cc)]??_0x52d08a['default']?.['SessionIndex'];if(!_0x57be9b||typeof _0x57be9b[_0x32d003(0x1a5)]!='function')throw new Error(_0x32d003(0x161));return _0x5025c8&&y(_0x57be9b),_0x57be9b[_0x32d003(0x1a5)](_0x4904de,_0xfa3f79,this[_0x32d003(0x1ae)],this[_0x32d003(0x20e)],null,null,_0x5025c8?.[_0x32d003(0x14c)]??null,_0x5025c8?.[_0x32d003(0x19e)]??null);}async[_0x1d9c9a(0x1c7)](_0x5a4fb4,_0x43da45,_0x204669){const _0x28f208=_0x1d9c9a;if(!await this[_0x28f208(0x19d)][_0x28f208(0x21b)](_0x5a4fb4))throw new Error('Index\x20\x22'+_0x5a4fb4+_0x28f208(0x1c0)+_0x5a4fb4+_0x28f208(0x157));let _0x484f61=_0x204669?.[_0x28f208(0x162)]??0x5,_0x3596be=_0x204669?.[_0x28f208(0x152)]??0.8;return _0x204669?.[_0x28f208(0x172)]?this[_0x28f208(0x19d)]['query'](_0x5a4fb4,_0x43da45,_0x204669[_0x28f208(0x172)],_0x484f61,_0x3596be,_0x204669?.[_0x28f208(0x20b)]):this[_0x28f208(0x19d)][_0x28f208(0x200)](_0x5a4fb4,_0x43da45,_0x484f61,_0x3596be,_0x204669?.[_0x28f208(0x20b)]);}async[_0x1d9c9a(0x1ac)](_0x1e9e53,_0x36e53e,_0x4e74cd){const _0x5935bf=_0x1d9c9a;if(_0x1e9e53[_0x5935bf(0x1a8)]===0x0)throw new Error(_0x5935bf(0x1b4));let _0x3d7d9f=this[_0x5935bf(0x170)](),_0x217fb2=_0x4e74cd?.[_0x5935bf(0x162)]??0xa,_0x3e2fa5=_0x4e74cd?.[_0x5935bf(0x152)]??0.8;if(_0x4e74cd?.[_0x5935bf(0x172)])return _0x3d7d9f['queryMultiIndex'](_0x1e9e53,_0x36e53e,_0x4e74cd[_0x5935bf(0x172)],_0x217fb2,_0x3e2fa5,_0x4e74cd?.[_0x5935bf(0x20b)]);try{return await _0x3d7d9f[_0x5935bf(0x14e)](_0x1e9e53,_0x36e53e,_0x217fb2,_0x3e2fa5,_0x4e74cd?.['filter']);}catch(_0xf48d27){throw _0xf48d27 instanceof Error&&_0xf48d27['message']['includes'](_0x5935bf(0x17f))?new Error(_0xf48d27[_0x5935bf(0x1af)]+_0x5935bf(0x211),{'cause':_0xf48d27}):_0xf48d27 instanceof Error&&_0xf48d27[_0x5935bf(0x1af)][_0x5935bf(0x14b)](_0x5935bf(0x187))?new Error(_0x5935bf(0x17d),{'cause':_0xf48d27}):_0xf48d27;}}};import{SessionIndex as _0x919d31}from'@moss-js/moss-core';var h=class r{#e;#r;#s;#i=!0x1;#a;constructor(_0x3fec0a,_0x25a3e5,_0x1e1dc){this.#s=_0x3fec0a,this.#r=_0x25a3e5,this.#e=_0x1e1dc;}static async['_create'](_0x2b3b1a,_0x5dbe58,_0x26bcec,_0x219bba,_0x43d9a8,_0x86870,_0x14317f){const _0x579af3=_0x1d9c9a;let _0x5f21c0=_0x919d31;_0x14317f&&y(_0x5f21c0);let _0x180a76=await _0x5f21c0[_0x579af3(0x191)](_0x2b3b1a,_0x5dbe58,_0x26bcec,_0x219bba,_0x43d9a8??null,_0x14317f?.[_0x579af3(0x14c)]??null,_0x14317f?.['manifestSha256']??null);return r[_0x579af3(0x1eb)](_0x2b3b1a,_0x5dbe58,_0x180a76,_0x86870);}static[_0x1d9c9a(0x1eb)](_0x4919c3,_0x1db4ca,_0x3b5f02,_0x4edf16){return _0x4edf16&&v(_0x3b5f02,_0x4edf16),new r(_0x4919c3,_0x1db4ca,_0x3b5f02);}get[_0x1d9c9a(0x1db)](){return this.#s;}get[_0x1d9c9a(0x1ce)](){return this.#n(),this.#e['docCount'];}get['modelId'](){return this.#r;}async['addDocs'](_0x9ecbce,_0xaa3342){const _0x55aa70=_0x1d9c9a;this.#n();let _0x391e0b=_0xaa3342?{'upsert':_0xaa3342[_0x55aa70(0x21a)]??!0x0}:void 0x0;if(this.#r===_0x55aa70(0x223)){let _0x2a2da9=r.#t(_0x9ecbce),_0x3f1234=_0x9ecbce[_0x55aa70(0x1da)](_0x2dc523=>{const _0x302d53=_0x55aa70;let _0x39b810={..._0x2dc523};return delete _0x39b810[_0x302d53(0x172)],_0x39b810;}),_0x119716=this.#e[_0x55aa70(0x186)](_0x3f1234,_0x2a2da9,_0x391e0b);return{'added':_0x119716[_0x55aa70(0x1fd)],'updated':_0x119716[_0x55aa70(0x16c)]};}let _0xb8dc6e=this.#e['addDocumentsText'](_0x9ecbce,_0x391e0b);return{'added':_0xb8dc6e['added'],'updated':_0xb8dc6e[_0x55aa70(0x16c)]};}async[_0x1d9c9a(0x153)](_0x409d6e){const _0x1a19dc=_0x1d9c9a;return this.#n(),this.#e[_0x1a19dc(0x168)](_0x409d6e);}async[_0x1d9c9a(0x16b)](_0x4b9429){const _0x5dbf01=_0x1d9c9a;return this.#n(),this.#e[_0x5dbf01(0x204)](_0x4b9429??null);}async[_0x1d9c9a(0x1c7)](_0x1d3b4c,_0x50010a){const _0x95f767=_0x1d9c9a;this.#n();let _0x9a4230=_0x50010a?.[_0x95f767(0x162)]??0x5,_0x4b69c8=_0x50010a?.[_0x95f767(0x152)]??0.8,_0x57ce77=_0x50010a?.[_0x95f767(0x20b)]??null,_0x1f013d=_0x50010a?.['embedding'];if(_0x1f013d==null){if(this.#r==='custom')throw new Error(_0x95f767(0x17e));return this.#e['queryText'](_0x1d3b4c,_0x9a4230,_0x4b69c8,_0x57ce77);}return this.#e[_0x95f767(0x1c7)](_0x1d3b4c,_0x9a4230,Array['from'](_0x1f013d),_0x4b69c8,_0x57ce77);}async['loadIndex'](_0x383f9e,_0x3467ea){const _0x5c2310=_0x1d9c9a;return this.#n(),this.#e[_0x5c2310(0x216)](_0x383f9e,_0x3467ea??null);}async[_0x1d9c9a(0x181)](){const _0x150c1d=_0x1d9c9a;return this.#n(),this.#e[_0x150c1d(0x181)]();}async[_0x1d9c9a(0x189)](_0x216d0c){const _0x5cf998=_0x1d9c9a;this.#n(),this.#e[_0x5cf998(0x189)](_0x216d0c);}async['loadFromDisk'](_0x46a5ad){return this.#n(),this.#e['loadFromDisk'](_0x46a5ad);}#n(){const _0xd43b=_0x1d9c9a;if(this.#i)throw new Error(_0xd43b(0x1ef)+this.#s+'\x27\x20is\x20closed');}[_0x1d9c9a(0x1a7)](){return this.#a??=this.#o(),this.#a;}async #o(){const _0x42711a=_0x1d9c9a;this.#i=!0x0;let _0xc57023=this.#e[_0x42711a(0x1a7)];if(typeof _0xc57023!='function')throw new Error(_0x42711a(0x196));await _0xc57023[_0x42711a(0x224)](this.#e);}async[Symbol[_0x1d9c9a(0x183)]](){const _0x31e077=_0x1d9c9a;return this[_0x31e077(0x1a7)]();}async[_0x1d9c9a(0x1c4)](){const _0x18c32d=_0x1d9c9a;this.#n(),this.#r!==_0x18c32d(0x223)&&this.#e[_0x18c32d(0x220)]();}static#t(_0x153670){const _0x52cb26=_0x1d9c9a;let _0x365403=_0x153670[_0x52cb26(0x20b)](_0x2fe7cd=>!_0x2fe7cd['embedding']||_0x2fe7cd[_0x52cb26(0x172)][_0x52cb26(0x1a8)]===0x0)[_0x52cb26(0x1da)](_0x540eb7=>_0x540eb7['id']);if(_0x365403[_0x52cb26(0x1a8)]>0x0)throw new Error(_0x52cb26(0x1bd)+_0x365403[_0x52cb26(0x1bb)](',\x20')+_0x52cb26(0x1fc));return _0x153670[_0x52cb26(0x1da)](_0x154f0c=>Array[_0x52cb26(0x1e1)](_0x154f0c[_0x52cb26(0x172)]??[]));}},me='https://service.usemoss.dev',he=_0x1d9c9a(0x1de),b=class extends Error{['status'];[_0x1d9c9a(0x21c)];constructor(_0x58475b,_0x147d32){const _0x491708=_0x1d9c9a;let _0x38b03a=_0x147d32?':\x20'+_0x147d32:'';super(_0x491708(0x193)+_0x58475b+_0x38b03a),this[_0x491708(0x1db)]='ManageApiError',this['status']=_0x58475b,this['body']=_0x147d32;}};function pe(){const _0x3a9fbb=_0x1d9c9a;return''+(typeof process<'u'&&process['env']['MOSS_CLOUD_API_BASE_URL']||me)[_0x3a9fbb(0x1dd)](/\/+$/,'')+he;}function ge(_0x36c362){const _0x426470=_0x1d9c9a;return _0x36c362?Object[_0x426470(0x1ca)](Object[_0x426470(0x219)](_0x36c362)[_0x426470(0x20b)](([,_0x51ddf0])=>_0x51ddf0!==void 0x0)):{};}async function B(_0xf17a30,_0x2bcaa4,_0x1cea1e,_0x44be28){const _0x1820bf=_0x1d9c9a;let _0x572020={...ge(_0x44be28),'action':_0x1cea1e,'projectId':_0xf17a30},_0x359ea6=await fetch(pe(),{'method':_0x1820bf(0x18e),'headers':{'Content-Type':_0x1820bf(0x18c),'X-Project-Key':_0x2bcaa4},'body':JSON[_0x1820bf(0x165)](_0x572020),'signal':AbortSignal[_0x1820bf(0x18a)](0x927c0)}),_0x4a5a1c=await _0x359ea6[_0x1820bf(0x1e9)]();if(!_0x359ea6['ok'])throw new b(_0x359ea6['status'],_0x4a5a1c);return _0x4a5a1c?JSON[_0x1820bf(0x213)](_0x4a5a1c):{};}var K='moss-minilm',D=class{#e;#r;#s;#i=!0x1;#a;#n=new Set();constructor(_0x2d5e37,_0x221b2e,_0x365466){const _0x2f81e9=_0x1d9c9a;this.#e=new x(_0x2d5e37,_0x221b2e,_0x365466),this.#r=_0x2d5e37,this.#s=typeof _0x221b2e==_0x2f81e9(0x1f5)?_0x221b2e:null;}async[_0x1d9c9a(0x15b)](){const _0x1d4889=_0x1d9c9a;return this.#t(),this.#e[_0x1d4889(0x15b)]();}async[_0x1d9c9a(0x178)](_0x406a4f,_0x6ef077,_0x538ff0){const _0x767f21=_0x1d9c9a;this.#t();let _0x235b7e;return _0x538ff0?.[_0x767f21(0x150)]!==void 0x0?_0x235b7e=_0x538ff0['modelId']:_0x235b7e=_0x6ef077[_0x767f21(0x1e0)](_0x40a4be=>Array[_0x767f21(0x205)](_0x40a4be['embedding'])&&_0x40a4be[_0x767f21(0x172)]['length']>0x0)?_0x767f21(0x223):K,this.#e[_0x767f21(0x178)](_0x406a4f,_0x6ef077,_0x235b7e,_0x538ff0);}async[_0x1d9c9a(0x1d5)](_0x2674dd,_0x401f88,_0x2daf98){const _0xf66106=_0x1d9c9a;return this.#t(),this.#e[_0xf66106(0x1d5)](_0x2674dd,_0x401f88,_0x2daf98);}async[_0x1d9c9a(0x155)](_0x17c9a4){return this.#t(),this.#e['getIndex'](_0x17c9a4);}async[_0x1d9c9a(0x1a9)](){const _0x5940f0=_0x1d9c9a;return this.#t(),this.#e[_0x5940f0(0x1a9)]();}async[_0x1d9c9a(0x19f)](_0x370e1c){return this.#t(),this.#e['deleteIndex'](_0x370e1c);}async[_0x1d9c9a(0x176)](_0x1ff7bc,_0x3c5fb8,_0x549a6f){const _0x51d043=_0x1d9c9a;return this.#t(),this.#e[_0x51d043(0x176)](_0x1ff7bc,_0x3c5fb8,_0x549a6f);}async[_0x1d9c9a(0x153)](_0x46018d,_0x5d8e0b,_0x468d65){return this.#t(),this.#e['deleteDocs'](_0x46018d,_0x5d8e0b,_0x468d65);}async[_0x1d9c9a(0x15d)](_0x3a2da6){const _0x335820=_0x1d9c9a;return this.#t(),this.#e[_0x335820(0x15d)](_0x3a2da6);}async[_0x1d9c9a(0x166)](_0x2d6b7d,_0x29d38e,_0x3a960e){const _0x4ffeca=_0x1d9c9a;return this.#t(),this.#o('createWebSource',{'rootUrl':_0x2d6b7d,'indexName':_0x29d38e,'maxPages':_0x3a960e?.['maxPages'],'maxDocuments':_0x3a960e?.[_0x4ffeca(0x16f)],'maxDepth':_0x3a960e?.['maxDepth'],'includePaths':_0x3a960e?.[_0x4ffeca(0x1f0)],'excludePaths':_0x3a960e?.[_0x4ffeca(0x177)],'respectRobots':_0x3a960e?.[_0x4ffeca(0x19a)],'parseDocuments':_0x3a960e?.[_0x4ffeca(0x1c2)],'refreshCadence':_0x3a960e?.[_0x4ffeca(0x228)],'modelId':_0x3a960e?.[_0x4ffeca(0x150)]});}async['listWebSources'](_0x36fea0){const _0x3ac6ca=_0x1d9c9a;this.#t();let _0x477a5f=(await this.#o(_0x3ac6ca(0x1e6),_0x36fea0!==void 0x0?{'indexName':_0x36fea0}:void 0x0))[_0x3ac6ca(0x1fb)]??[];return _0x36fea0===void 0x0?_0x477a5f:_0x477a5f['filter'](_0x23d6b6=>_0x23d6b6[_0x3ac6ca(0x225)]===_0x36fea0);}async['getWebSource'](_0x34af9c){const _0x3eeef3=_0x1d9c9a;return this.#t(),this.#o(_0x3eeef3(0x226),{'sourceId':_0x34af9c});}async[_0x1d9c9a(0x194)](_0x3f87ce,_0x2e3232){const _0xd57f46=_0x1d9c9a;return this.#t(),this.#o(_0xd57f46(0x194),{'sourceId':_0x3f87ce,'refreshCadence':_0x2e3232['refreshCadence'],'rootUrl':_0x2e3232[_0xd57f46(0x214)],'includePaths':_0x2e3232['includePaths'],'excludePaths':_0x2e3232['excludePaths'],'maxDepth':_0x2e3232[_0xd57f46(0x1b2)],'maxPages':_0x2e3232['maxPages'],'resync':_0x2e3232[_0xd57f46(0x1f6)]});}async[_0x1d9c9a(0x1c5)](_0x41789d){const _0x3e0b10=_0x1d9c9a;return this.#t(),this.#o(_0x3e0b10(0x1c5),{'sourceId':_0x41789d});}async['deleteWebSource'](_0x3f1f28){const _0x3aa086=_0x1d9c9a;return this.#t(),this.#o(_0x3aa086(0x19b),{'sourceId':_0x3f1f28});}async #o(_0x503e15,_0x340ed5){const _0x4168ad=_0x1d9c9a;if(this.#s===null)throw new Error(_0x4168ad(0x1c9));return B(this.#r,this.#s,_0x503e15,_0x340ed5);}async[_0x1d9c9a(0x16b)](_0x4235f6,_0x3ee12a){return this.#t(),this.#e['getDocs'](_0x4235f6,_0x3ee12a);}async['loadIndex'](_0x14dbc2,_0xd33ff){const _0x445519=_0x1d9c9a;return this.#t(),this.#e[_0x445519(0x216)](_0x14dbc2,_0xd33ff);}async[_0x1d9c9a(0x227)](_0x230bf7,_0x544516){const _0x28d59d=_0x1d9c9a;return this.#t(),this.#e[_0x28d59d(0x227)](_0x230bf7,_0x544516);}async[_0x1d9c9a(0x195)](_0xbe608f){const _0x1da43f=_0x1d9c9a;return this.#t(),this.#e[_0x1da43f(0x195)](_0xbe608f);}async['unloadIndexes'](_0x3e99e9){const _0x46f5e1=_0x1d9c9a;return this.#t(),this.#e[_0x46f5e1(0x1d1)](_0x3e99e9);}async[_0x1d9c9a(0x1c7)](_0x35950c,_0x1087c6,_0x2962d9){const _0x235018=_0x1d9c9a;return this.#t(),this.#e[_0x235018(0x1c7)](_0x35950c,_0x1087c6,_0x2962d9);}async[_0x1d9c9a(0x1ac)](_0x213717,_0x16ed36,_0x4a5497){const _0x34b358=_0x1d9c9a;return this.#t(),this.#e[_0x34b358(0x1ac)](_0x213717,_0x16ed36,_0x4a5497);}async['session'](_0x1809af,_0x29944c=K,_0x111c56){const _0x40dd94=_0x1d9c9a;this.#t();let _0x290250=this.#e['resolveIdentityForSession'](),_0x9c63c9;if(this.#s!==null)_0x9c63c9=await h[_0x40dd94(0x1bf)](_0x1809af,_0x29944c,this.#r,this.#s,void 0x0,_0x290250,_0x111c56);else{let _0x447156=await this.#e[_0x40dd94(0x1a0)](_0x1809af,_0x29944c,_0x111c56);_0x9c63c9=h[_0x40dd94(0x1eb)](_0x1809af,_0x29944c,_0x447156,_0x290250);}await _0x9c63c9[_0x40dd94(0x1c4)]();for(let _0x11b5ef of this.#n)_0x11b5ef[_0x40dd94(0x158)]()||this.#n[_0x40dd94(0x21d)](_0x11b5ef);return this.#n['add'](new WeakRef(_0x9c63c9)),_0x9c63c9;}#t(){const _0x35ac06=_0x1d9c9a;if(this.#i)throw new Error(_0x35ac06(0x1e5));}[_0x1d9c9a(0x1a7)](){return this.#a??=this.#u(),this.#a;}async #u(){const _0xac0440=_0x1d9c9a;this.#i=!0x0;let _0x47dd3f=[...this.#n]['map'](_0x30f4dc=>_0x30f4dc[_0xac0440(0x158)]())[_0xac0440(0x20b)](_0x3c53e6=>_0x3c53e6!==void 0x0);this.#n[_0xac0440(0x18f)](),await Promise[_0xac0440(0x229)](_0x47dd3f[_0xac0440(0x1da)](_0x1afa31=>_0x1afa31['close']())),await this.#e[_0xac0440(0x1a7)]();}async[Symbol[_0x1d9c9a(0x183)]](){return this['close']();}};export{b as ManageApiError,D as MossClient,h as SessionIndex};
|
package/dist/moss.d.ts
CHANGED
|
@@ -54,6 +54,32 @@ export declare interface CreateIndexOptions {
|
|
|
54
54
|
onProgress?: (progress: JobProgress) => void;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
+
export declare interface CreateWebSourceOptions {
|
|
58
|
+
maxPages?: number;
|
|
59
|
+
maxDocuments?: number;
|
|
60
|
+
maxDepth?: number;
|
|
61
|
+
includePaths?: string[];
|
|
62
|
+
excludePaths?: string[];
|
|
63
|
+
respectRobots?: boolean;
|
|
64
|
+
parseDocuments?: boolean;
|
|
65
|
+
refreshCadence?: "daily" | "weekly";
|
|
66
|
+
modelId?: "moss-minilm" | "moss-mediumlm";
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export declare interface CreateWebSourceResult extends WebSource {
|
|
70
|
+
/** Crawl job to poll with `getJobStatus`. */
|
|
71
|
+
jobId: string;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export declare interface DeleteWebSourceResult {
|
|
75
|
+
deleted: boolean;
|
|
76
|
+
id: string;
|
|
77
|
+
/**
|
|
78
|
+
* Present when a purge was enqueued. Poll with `getJobStatus`.
|
|
79
|
+
*/
|
|
80
|
+
purgeJobId?: string;
|
|
81
|
+
}
|
|
82
|
+
|
|
57
83
|
export { DocumentInfo }
|
|
58
84
|
|
|
59
85
|
export { GetDocumentsOptions }
|
|
@@ -125,6 +151,12 @@ export declare interface LoadIndexOptions {
|
|
|
125
151
|
|
|
126
152
|
export { LoadSessionOptions }
|
|
127
153
|
|
|
154
|
+
export declare class ManageApiError extends Error {
|
|
155
|
+
readonly status: number;
|
|
156
|
+
readonly body: string;
|
|
157
|
+
constructor(status: number, body: string);
|
|
158
|
+
}
|
|
159
|
+
|
|
128
160
|
/** Exact immutable publisher identity required for local foundation models. */
|
|
129
161
|
export declare interface ModelArtifactIdentity {
|
|
130
162
|
/** Version embedded in the publisher manifest and immutable artifact URL. */
|
|
@@ -340,6 +372,40 @@ export declare class MossClient {
|
|
|
340
372
|
* ```
|
|
341
373
|
*/
|
|
342
374
|
getJobStatus(jobId: string): Promise<JobStatusResponse>;
|
|
375
|
+
/**
|
|
376
|
+
* POST `createWebSource` and return the typed source plus `jobId` for
|
|
377
|
+
* `getJobStatus`. Server-release notes: see the package README Web sources
|
|
378
|
+
* section.
|
|
379
|
+
*/
|
|
380
|
+
createWebSource(rootUrl: string, indexName: string, options?: CreateWebSourceOptions): Promise<CreateWebSourceResult>;
|
|
381
|
+
/**
|
|
382
|
+
* POST `listWebSources` and return the typed sources. When `indexName` is
|
|
383
|
+
* given, only sources for that index are returned.
|
|
384
|
+
*/
|
|
385
|
+
listWebSources(indexName?: string): Promise<WebSource[]>;
|
|
386
|
+
/**
|
|
387
|
+
* POST `getWebSource` and return the typed source: crawl status, last run,
|
|
388
|
+
* and page/document counts.
|
|
389
|
+
*/
|
|
390
|
+
getWebSource(sourceId: string): Promise<WebSource>;
|
|
391
|
+
/**
|
|
392
|
+
* POST `updateWebSource` and return the typed source. `jobId` is present
|
|
393
|
+
* when `resync` is true and the server enqueued a crawl; poll with
|
|
394
|
+
* `getJobStatus`. `refreshCadence` is live today. Other fields: see the
|
|
395
|
+
* package README Web sources section.
|
|
396
|
+
*/
|
|
397
|
+
updateWebSource(sourceId: string, options: UpdateWebSourceOptions): Promise<UpdateWebSourceResult>;
|
|
398
|
+
/**
|
|
399
|
+
* POST `resyncWebSource` and return a `jobId` to poll with `getJobStatus`.
|
|
400
|
+
* See the package README Web sources section.
|
|
401
|
+
*/
|
|
402
|
+
resyncWebSource(sourceId: string): Promise<ResyncWebSourceResult>;
|
|
403
|
+
/**
|
|
404
|
+
* POST `deleteWebSource` and return `{ deleted, id }`. `purgeJobId` is
|
|
405
|
+
* present when a purge was enqueued; poll with `getJobStatus`. Does not
|
|
406
|
+
* delete the index.
|
|
407
|
+
*/
|
|
408
|
+
deleteWebSource(sourceId: string): Promise<DeleteWebSourceResult>;
|
|
343
409
|
/**
|
|
344
410
|
* Retrieves documents from an index.
|
|
345
411
|
*
|
|
@@ -675,6 +741,13 @@ declare interface ResolvedTelemetryIdentity {
|
|
|
675
741
|
callerSupplied: boolean;
|
|
676
742
|
}
|
|
677
743
|
|
|
744
|
+
export declare interface ResyncWebSourceResult {
|
|
745
|
+
id: string;
|
|
746
|
+
jobId: string;
|
|
747
|
+
status?: string;
|
|
748
|
+
indexName?: string;
|
|
749
|
+
}
|
|
750
|
+
|
|
678
751
|
export { SearchResult }
|
|
679
752
|
|
|
680
753
|
/**
|
|
@@ -791,4 +864,50 @@ export declare class SessionIndex {
|
|
|
791
864
|
_warmModel(): Promise<void>;
|
|
792
865
|
}
|
|
793
866
|
|
|
867
|
+
export declare interface UpdateWebSourceOptions {
|
|
868
|
+
refreshCadence?: WebSourceRefreshCadence;
|
|
869
|
+
rootUrl?: string;
|
|
870
|
+
includePaths?: string[];
|
|
871
|
+
excludePaths?: string[];
|
|
872
|
+
maxDepth?: number;
|
|
873
|
+
maxPages?: number;
|
|
874
|
+
resync?: boolean;
|
|
875
|
+
}
|
|
876
|
+
|
|
877
|
+
export declare interface UpdateWebSourceResult extends WebSource {
|
|
878
|
+
/**
|
|
879
|
+
* Present when `resync` is true and the server enqueued a crawl.
|
|
880
|
+
* Poll with `getJobStatus`.
|
|
881
|
+
*/
|
|
882
|
+
jobId?: string;
|
|
883
|
+
}
|
|
884
|
+
|
|
885
|
+
/**
|
|
886
|
+
* Public web-source record from the manage API (`toPublic` shape).
|
|
887
|
+
*/
|
|
888
|
+
export declare interface WebSource {
|
|
889
|
+
id: string;
|
|
890
|
+
indexName: string;
|
|
891
|
+
rootUrl: string;
|
|
892
|
+
maxPages: number;
|
|
893
|
+
maxDocuments: number;
|
|
894
|
+
maxDepth: number;
|
|
895
|
+
includePaths?: string[];
|
|
896
|
+
excludePaths?: string[];
|
|
897
|
+
respectRobots: boolean;
|
|
898
|
+
parseDocuments: boolean;
|
|
899
|
+
refreshCadence: WebSourceRefreshCadence;
|
|
900
|
+
nextRefreshAt: string | null;
|
|
901
|
+
lastCrawledAt: string | null;
|
|
902
|
+
lastPageCount: number | null;
|
|
903
|
+
lastDocCount: number | null;
|
|
904
|
+
status: WebSourceStatus;
|
|
905
|
+
lastErrorCode: string | null;
|
|
906
|
+
createdAt?: string;
|
|
907
|
+
}
|
|
908
|
+
|
|
909
|
+
export declare type WebSourceRefreshCadence = "daily" | "weekly" | "manual";
|
|
910
|
+
|
|
911
|
+
export declare type WebSourceStatus = "idle" | "crawling" | "failed" | "removing";
|
|
912
|
+
|
|
794
913
|
export { }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moss-js/moss",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.10.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.25.0"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@eslint/js": "^9.39.4",
|