@lovrabet/lovrabet-cli 2.3.5-beta.2 → 2.3.6-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cli.js +1 -1
- package/lib/commands/api-doc/index.js +1 -1
- package/lib/commands/app/cache.js +1 -1
- package/lib/commands/app/definitions.js +1 -1
- package/lib/commands/app/eligibility.js +1 -1
- package/lib/commands/app/mock-loader.js +1 -1
- package/lib/commands/app/remote-source.js +1 -1
- package/lib/commands/app/shared.js +1 -1
- package/lib/commands/app-config/get.js +1 -1
- package/lib/commands/app-config/index.js +1 -1
- package/lib/commands/approval/index.js +1 -1
- package/lib/commands/artifact/index.js +1 -1
- package/lib/commands/auth/device.js +1 -1
- package/lib/commands/auth/index.js +1 -1
- package/lib/commands/auth/prompt.js +1 -1
- package/lib/commands/bff/detail.js +1 -1
- package/lib/commands/bff/exec.js +1 -1
- package/lib/commands/bff/index.js +1 -1
- package/lib/commands/cli-skill/index.js +1 -1
- package/lib/commands/common/config-policy.js +1 -1
- package/lib/commands/common/constraints.js +1 -1
- package/lib/commands/common/flags.js +1 -1
- package/lib/commands/common/local-file.js +1 -1
- package/lib/commands/config/definitions.js +1 -1
- package/lib/commands/config/init.js +1 -1
- package/lib/commands/config/shared.js +1 -1
- package/lib/commands/data/import-excel.js +1 -1
- package/lib/commands/data/index.js +1 -1
- package/lib/commands/dataset/detail.js +1 -1
- package/lib/commands/dataset/index.js +1 -1
- package/lib/commands/dataset/list.js +1 -1
- package/lib/commands/dataset/sdk-doc.js +1 -1
- package/lib/commands/doctor.js +1 -1
- package/lib/commands/file/index.js +1 -1
- package/lib/commands/init.js +1 -1
- package/lib/commands/kb/index.js +1 -1
- package/lib/commands/logs/index.js +1 -1
- package/lib/commands/notification/config-list.js +1 -1
- package/lib/commands/notification/index.js +1 -1
- package/lib/commands/notification/shared.js +1 -1
- package/lib/commands/ocr/index.js +1 -1
- package/lib/commands/permit/dataset-get.js +1 -1
- package/lib/commands/permit/dataset-set.js +1 -1
- package/lib/commands/permit/index.js +1 -1
- package/lib/commands/permit/page-get.js +1 -1
- package/lib/commands/permit/page-set.js +1 -1
- package/lib/commands/permit/role-menus-set.js +1 -1
- package/lib/commands/permit/role-menus.js +1 -1
- package/lib/commands/permit/shared.js +1 -1
- package/lib/commands/personal-bff/index.js +1 -1
- package/lib/commands/registry.js +1 -1
- package/lib/commands/role/create.js +1 -1
- package/lib/commands/role/delete.js +1 -1
- package/lib/commands/role/detail.js +1 -1
- package/lib/commands/role/index.js +1 -1
- package/lib/commands/role/list.js +1 -1
- package/lib/commands/role/shared.js +1 -1
- package/lib/commands/role/update.js +1 -1
- package/lib/commands/role/user-add.js +1 -1
- package/lib/commands/role/user-remove.js +1 -1
- package/lib/commands/schedule/index.js +1 -1
- package/lib/commands/schema.js +1 -1
- package/lib/commands/service/dynamic.js +1 -1
- package/lib/commands/service/function-name-adapter.js +1 -1
- package/lib/commands/service/index.js +1 -1
- package/lib/commands/service/registry.js +1 -1
- package/lib/commands/skill/commands/create.js +1 -1
- package/lib/commands/skill/commands/diagram.js +1 -1
- package/lib/commands/skill/commands/install.js +1 -1
- package/lib/commands/skill/commands/list.js +1 -1
- package/lib/commands/skill/commands/push.js +1 -1
- package/lib/commands/skill/commands/validate.js +1 -1
- package/lib/commands/skill/diagram.js +1 -1
- package/lib/commands/skill/flags.js +1 -1
- package/lib/commands/skill/index.js +1 -1
- package/lib/commands/skill/manifest-helpers.js +1 -1
- package/lib/commands/skill/push-execute.js +1 -1
- package/lib/commands/skill/push-flow-helpers.js +1 -1
- package/lib/commands/skill/push-retarget.js +1 -1
- package/lib/commands/skill/scopes.js +1 -1
- package/lib/commands/skill/summary.js +1 -1
- package/lib/commands/skill/templates.js +1 -1
- package/lib/commands/skill/validate.js +1 -1
- package/lib/commands/sql/detail.js +1 -1
- package/lib/commands/sql/exec.js +1 -1
- package/lib/commands/sql/index.js +1 -1
- package/lib/commands/update.js +1 -1
- package/lib/commands/user-account/bind.js +1 -1
- package/lib/commands/user-account/index.js +1 -1
- package/lib/commands/workspace/index.js +1 -1
- package/lib/config/domain-config.js +1 -1
- package/lib/config/schema.js +1 -1
- package/lib/constant/app.js +1 -1
- package/lib/constant/auth-mode.js +1 -1
- package/lib/constant/cli.js +1 -1
- package/lib/constant/defaults.js +1 -1
- package/lib/constant/distribution.js +1 -1
- package/lib/constant/domain.js +1 -1
- package/lib/constant/env.js +1 -1
- package/lib/constant/output.js +1 -1
- package/lib/constant/product.js +1 -1
- package/lib/constant/region.js +1 -1
- package/lib/constant/risk.js +1 -1
- package/lib/constant/url.js +1 -1
- package/lib/context.js +1 -1
- package/lib/core/api-client.d.ts +10 -0
- package/lib/core/api-client.js +1 -1
- package/lib/core/db-resolver.js +1 -1
- package/lib/core/kb-search-client.js +1 -1
- package/lib/core/sdk-client.js +1 -1
- package/lib/errors.js +1 -1
- package/lib/framework/access-error.js +1 -1
- package/lib/framework/build-all-flags.js +1 -1
- package/lib/framework/dryrun.js +1 -1
- package/lib/framework/flags.js +1 -1
- package/lib/framework/help.js +1 -1
- package/lib/framework/index.js +1 -1
- package/lib/framework/output.js +1 -1
- package/lib/framework/preparse.js +1 -1
- package/lib/framework/rate-limit.js +1 -1
- package/lib/framework/raw-flags.js +1 -1
- package/lib/framework/response.js +1 -1
- package/lib/framework/runner-confirmation.js +1 -1
- package/lib/framework/runner-error.js +1 -1
- package/lib/framework/runner.js +1 -1
- package/lib/framework/schema-export.js +1 -1
- package/lib/framework/service-order.js +1 -1
- package/lib/framework/types.js +1 -1
- package/lib/generated/build-info.d.ts +4 -4
- package/lib/generated/build-info.js +1 -1
- package/lib/generated/official-routing.js +1 -1
- package/lib/generated/routing-contract.js +1 -1
- package/lib/help.js +1 -1
- package/lib/postinstall.js +1 -1
- package/lib/runtime/confirmation.js +1 -1
- package/lib/runtime/event.js +1 -1
- package/lib/runtime/index.js +1 -1
- package/lib/runtime/queue.js +1 -1
- package/lib/runtime/resolve.js +1 -1
- package/lib/services/dataset-import/auto-id-runner.d.ts +3 -1
- package/lib/services/dataset-import/auto-id-runner.js +1 -1
- package/lib/services/dataset-import/excel-reader.js +1 -1
- package/lib/services/dataset-import/image-bytes.d.ts +3 -0
- package/lib/services/dataset-import/image-bytes.js +1 -0
- package/lib/services/dataset-import/image-ooxml.d.ts +10 -0
- package/lib/services/dataset-import/image-ooxml.js +1 -0
- package/lib/services/dataset-import/image-runner.d.ts +48 -0
- package/lib/services/dataset-import/image-runner.js +1 -0
- package/lib/services/dataset-import/metadata.js +1 -1
- package/lib/services/dataset-import/preview.js +1 -1
- package/lib/services/dataset-import/runner.d.ts +10 -1
- package/lib/services/dataset-import/runner.js +1 -1
- package/lib/services/dataset-import/types.d.ts +28 -1
- package/lib/skills/builtin-skill.js +1 -1
- package/lib/skills/npx-skills-add.js +1 -1
- package/lib/skills/runtime-skill-sync/constants.js +1 -1
- package/lib/skills/runtime-skill-sync/fs-utils.js +1 -1
- package/lib/skills/runtime-skill-sync/hashing.js +1 -1
- package/lib/skills/runtime-skill-sync/install-target.js +1 -1
- package/lib/skills/runtime-skill-sync/links.js +1 -1
- package/lib/skills/runtime-skill-sync/list-local.js +1 -1
- package/lib/skills/runtime-skill-sync/local-files.js +1 -1
- package/lib/skills/runtime-skill-sync/materialize.js +1 -1
- package/lib/skills/runtime-skill-sync/metadata.js +1 -1
- package/lib/skills/runtime-skill-sync/paths.js +1 -1
- package/lib/skills/runtime-skill-sync/push.js +1 -1
- package/lib/skills/runtime-skill-sync/scopes.js +1 -1
- package/lib/skills/runtime-skill-sync/zip-codec.js +1 -1
- package/lib/skills/runtime-skill-sync/zip-package.js +1 -1
- package/lib/skills/runtime-skill-sync.js +1 -1
- package/lib/skills/skill-presence.js +1 -1
- package/lib/utils/access-key-redaction.js +1 -1
- package/lib/utils/apply-jq-filter.js +1 -1
- package/lib/utils/cli-version-check.js +1 -1
- package/lib/utils/cli-version-policy.js +1 -1
- package/lib/utils/logger.js +1 -1
- package/lib/utils/lossless-json.js +1 -1
- package/lib/utils/params.js +1 -1
- package/lib/utils/positive-safe-integer.js +1 -1
- package/lib/utils/redaction.js +1 -1
- package/lib/utils/update-notice.js +1 -1
- package/lib/utils/version.js +1 -1
- package/lib/utils/write-cli-side-channel.js +1 -1
- package/package.json +4 -1
- package/skills/lovrabet/SKILL.md +3 -1
- package/skills/lovrabet/references/lovrabet-excel-import.md +19 -0
- package/skills/lovrabet.manifest.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(_0x3a54f7,_0x3ca8fb){const _0x1a016e=a142_0x5bd7,_0x4f5782=_0x3a54f7();while(!![]){try{const _0x1b4525=-parseInt(_0x1a016e(0x186))/0x1+parseInt(_0x1a016e(0x168))/0x2*(-parseInt(_0x1a016e(0x162))/0x3)+-parseInt(_0x1a016e(0x160))/0x4+parseInt(_0x1a016e(0x155))/0x5+-parseInt(_0x1a016e(0x1ad))/0x6+-parseInt(_0x1a016e(0x1a4))/0x7+parseInt(_0x1a016e(0x1b5))/0x8*(parseInt(_0x1a016e(0x1a7))/0x9);if(_0x1b4525===_0x3ca8fb)break;else _0x4f5782['push'](_0x4f5782['shift']());}catch(_0x7d2400){_0x4f5782['push'](_0x4f5782['shift']());}}}(a142_0x5549,0xe57df));function a142_0x5549(){const _0x382651=['3639128PGlULM','sync','Excel\x20row\x20','Invalid\x20import\x20lock\x20owner.','join','version','Import\x20checkpoint\x20does\x20not\x20match\x20the\x20input,\x20target\x20or\x20identity.','toString','2239100vtlVYc','ENOENT','pid','push','warnings','maxBatchSize','string','rowNumber','Import\x20lock\x20recovery\x20is\x20active\x20or\x20interrupted;\x20inspect\x20the\x20recovery\x20guard\x20before\x20retrying.','The\x20import\x20checkpoint\x20is\x20locked\x20by\x20a\x20running\x20process.','errors','6255960ChzWmA','unknown','7593aBWfmm','Import\x20primary\x20key\x20collision;\x20stop\x20without\x20replacing\x20the\x20fixed\x20IDs.','Import\x20checkpoint\x20contains\x20a\x20content\x20conflict.','resume','sort','hex','844avCXTi','importId','Import\x20output\x20must\x20not\x20be\x20a\x20symbolic\x20link.','Import\x20lock\x20changed;\x20retry\x20recovery.','ids','values','.recovery','unsent','stringify','isArray','forEach','conflict','runtimeDomain','succeeded','length','appCode','write','slice','filter','schemaFingerprint','Import\x20checkpoint\x20already\x20exists;\x20use\x20--resume.','fileHash','now','writeFile','has','Previously\x20imported\x20records\x20are\x20no\x20longer\x20visible;\x20recovery\x20stopped.','report','maxBatchBytes','.lock','EEXIST','612010vqIzlF','some','completed','checkpoint','message','keys','strategy','Incomplete\x20readback.','pending','utf8','schemaVersion','parse','get','incomplete','map','emptyRows','source','Invalid\x20import\x20readback\x20response.','set','readback','sheet','isSafeInteger','token','status','.tmp-','rows','Import\x20input,\x20output\x20and\x20lock\x20paths\x20must\x20be\x20different\x20files.','code','Import\x20content\x20conflict\x20at\x20Excel\x20row\x20','actorId','5803049asAoWV','batchSize','size','126JDaNdM','ESRCH','count','close','fixed-negative-id','Invalid\x20write\x20result.','10819236HrHgaU','Invalid\x20import\x20lock;\x20inspect\x20it\x20before\x20recovery.','METADATA','Excel\x20contains\x20no\x20valid\x20data\x20rows.','byteLength','\x20exceeds\x20the\x20import\x20request\x20size\x20limit.','datasetCode','undefined'];a142_0x5549=function(){return _0x382651;};return a142_0x5549();}import{randomBytes,randomUUID}from'node:crypto';import{lstat,open,readFile,realpath,rename,unlink}from'node:fs/promises';function a142_0x5bd7(_0x13e2a1,_0x532666){_0x13e2a1=_0x13e2a1-0x155;const _0x5549ad=a142_0x5549();let _0x5bd765=_0x5549ad[_0x13e2a1];return _0x5bd765;}import{resolve,dirname,basename}from'node:path';export function canonical(_0x38e657){const _0x22658b=a142_0x5bd7;if(Array[_0x22658b(0x171)](_0x38e657))return'['+_0x38e657[_0x22658b(0x194)](canonical)['join'](',')+']';if(_0x38e657&&typeof _0x38e657==='object')return'{'+Object[_0x22658b(0x18b)](_0x38e657)[_0x22658b(0x166)]()[_0x22658b(0x194)](_0x50cbe6=>JSON[_0x22658b(0x170)](_0x50cbe6)+':'+canonical(_0x38e657[_0x50cbe6]))[_0x22658b(0x1b9)](',')+'}';return JSON[_0x22658b(0x170)](_0x38e657)??_0x22658b(0x1b4);}export function sameImportValue(_0x163a3e,_0x3561a5){return _0x163a3e===null?_0x3561a5===null||_0x3561a5===undefined:canonical(_0x3561a5)===canonical(_0x163a3e);}async function rejectSymlink(_0x19a1cf){const _0x2ffcdb=a142_0x5bd7;try{if((await lstat(_0x19a1cf))['isSymbolicLink']())throw Error(_0x2ffcdb(0x16a));}catch(_0x143bc9){if(_0x143bc9[_0x2ffcdb(0x1a1)]!==_0x2ffcdb(0x156))throw _0x143bc9;}}export async function resolveImportOutputPath(_0x594ab9){return await rejectSymlink(_0x594ab9),resolve(await realpath(dirname(resolve(_0x594ab9))),basename(_0x594ab9));}export function assertImportPaths(_0x3cb5d9,_0x1dbc28,_0x2ce9ad=[]){const _0x52dd3f=a142_0x5bd7,_0x35e065=[..._0x2ce9ad,_0x3cb5d9,_0x1dbc28,_0x3cb5d9+_0x52dd3f(0x184),_0x3cb5d9+'.lock.recovery'][_0x52dd3f(0x194)](_0x86b1ef=>resolve(_0x86b1ef));if(new Set(_0x35e065)[_0x52dd3f(0x1a6)]!==_0x35e065[_0x52dd3f(0x176)])throw Error(_0x52dd3f(0x1a0));}export async function saveImportJson(_0x3d4bcb,_0xd89f5c){const _0x2e1a79=a142_0x5bd7;await rejectSymlink(_0x3d4bcb);const _0x40f899=_0x3d4bcb+_0x2e1a79(0x19e)+randomUUID(),_0x1a4402=await open(_0x40f899,'wx',0x180);try{await _0x1a4402[_0x2e1a79(0x17f)](JSON[_0x2e1a79(0x170)](_0xd89f5c,null,0x2)),await _0x1a4402[_0x2e1a79(0x1b6)]();}finally{await _0x1a4402[_0x2e1a79(0x1aa)]();}try{await rename(_0x40f899,_0x3d4bcb);}catch(_0x55c385){await unlink(_0x40f899)['catch'](()=>{});throw _0x55c385;}}export async function acquireLock(_0x3341f1){const _0x314da8=a142_0x5bd7,_0x59a912=_0x3341f1+_0x314da8(0x184),_0xbc9216=randomUUID();await rejectSymlink(_0x59a912);const _0x2f2e96=_0x59a912+_0x314da8(0x16e);let _0xb93ce1,_0x1d9944;try{try{_0xb93ce1=await open(_0x59a912,'wx',0x180);}catch(_0x1ec113){if(_0x1ec113['code']!==_0x314da8(0x185))throw _0x1ec113;try{_0x1d9944=await open(_0x2f2e96,'wx',0x180);}catch(_0x20eb92){if(_0x20eb92[_0x314da8(0x1a1)]===_0x314da8(0x185))throw Error(_0x314da8(0x15d));throw _0x20eb92;}await _0x1d9944[_0x314da8(0x17f)](JSON[_0x314da8(0x170)]({'pid':process[_0x314da8(0x157)],'token':_0xbc9216})),await _0x1d9944[_0x314da8(0x1b6)](),await rejectSymlink(_0x59a912);let _0x2b640b;try{_0x2b640b=await readFile(_0x59a912,_0x314da8(0x18f));}catch(_0x3af55e){if(_0x3af55e['code']!=='ENOENT')throw _0x3af55e;}if(_0x2b640b!==undefined){let _0x3e9bd8;try{_0x3e9bd8=JSON[_0x314da8(0x191)](_0x2b640b);}catch{throw Error(_0x314da8(0x1ae));}if(!_0x3e9bd8||!Number[_0x314da8(0x19b)](_0x3e9bd8[_0x314da8(0x157)])||_0x3e9bd8['pid']<=0x0)throw Error(_0x314da8(0x1b8));try{process['kill'](_0x3e9bd8[_0x314da8(0x157)],0x0);throw Error(_0x314da8(0x15e));}catch(_0x3751cd){if(_0x3751cd[_0x314da8(0x1a1)]!==_0x314da8(0x1a8))throw _0x3751cd;}if(await readFile(_0x59a912,_0x314da8(0x18f))!==_0x2b640b)throw Error(_0x314da8(0x16b));await unlink(_0x59a912);}_0xb93ce1=await open(_0x59a912,'wx',0x180);}await _0xb93ce1[_0x314da8(0x17f)](JSON[_0x314da8(0x170)]({'pid':process[_0x314da8(0x157)],'token':_0xbc9216})),await _0xb93ce1[_0x314da8(0x1b6)]();}finally{try{await _0xb93ce1?.[_0x314da8(0x1aa)]();}finally{if(_0x1d9944)try{await _0x1d9944[_0x314da8(0x1aa)]();}finally{await unlink(_0x2f2e96);}}}return async()=>{const _0x178326=_0x314da8;if(JSON[_0x178326(0x191)](await readFile(_0x59a912,_0x178326(0x18f)))[_0x178326(0x19c)]===_0xbc9216)await unlink(_0x59a912);};}export function assertImportContract(_0x3ba855,_0x53b0c4,_0x172c17){const _0x51303f=a142_0x5bd7;if(!_0x3ba855||!(_0x3ba855[_0x51303f(0x190)]===0x1&&_0x3ba855[_0x51303f(0x18c)]===_0x51303f(0x1ab)||_0x3ba855[_0x51303f(0x190)]===0x2&&_0x3ba855[_0x51303f(0x18c)]==='auto-id-task-marker')||_0x3ba855[_0x51303f(0x196)]!==_0x51303f(0x1af)||_0x3ba855['appCode']!==_0x53b0c4||_0x3ba855[_0x51303f(0x1b3)]!==_0x172c17||typeof _0x3ba855['actorId']!=='string'||!_0x3ba855[_0x51303f(0x1a3)]||typeof _0x3ba855['schemaFingerprint']!==_0x51303f(0x15b)||!_0x3ba855[_0x51303f(0x17b)]||!Number[_0x51303f(0x19b)](_0x3ba855[_0x51303f(0x15a)])||_0x3ba855[_0x51303f(0x15a)]<0x1||_0x3ba855[_0x51303f(0x15a)]>0x3e8||!Number[_0x51303f(0x19b)](_0x3ba855[_0x51303f(0x183)])||_0x3ba855[_0x51303f(0x183)]<0x1||_0x3ba855['maxBatchBytes']>0x14*0x400*0x400)throw Error('The\x20server\x20import\x20contract\x20is\x20unsupported\x20or\x20incomplete.');}export async function runExcelImport(_0x42a948){const _0x25776d=a142_0x5bd7;_0x42a948={..._0x42a948,'checkpoint':await resolveImportOutputPath(_0x42a948[_0x25776d(0x189)]),'report':await resolveImportOutputPath(_0x42a948[_0x25776d(0x182)])};const {manifest:_0x1caa80,contract:_0x30d825,api:_0x37f297}=_0x42a948;assertImportContract(_0x30d825,_0x42a948[_0x25776d(0x177)],_0x42a948[_0x25776d(0x1b3)]);if(_0x30d825['schemaVersion']!==0x1)throw Error('The\x20fixed-ID\x20runner\x20requires\x20the\x20v1\x20import\x20contract.');if(_0x1caa80[_0x25776d(0x15f)][_0x25776d(0x176)])throw Error('Excel\x20contains\x20invalid\x20rows;\x20no\x20data\x20was\x20written.');if(!_0x1caa80['rows'][_0x25776d(0x176)])throw Error(_0x25776d(0x1b0));if(!Number['isInteger'](_0x42a948[_0x25776d(0x1a5)])||_0x42a948[_0x25776d(0x1a5)]<0x1||_0x42a948[_0x25776d(0x1a5)]>_0x30d825[_0x25776d(0x15a)])throw Error('Invalid\x20import\x20batch\x20size.');for(const _0xcad06c of _0x1caa80[_0x25776d(0x19f)]){if(Buffer[_0x25776d(0x1b1)](JSON[_0x25776d(0x170)]({'schemaFingerprint':_0x30d825[_0x25776d(0x17b)],'items':[{..._0xcad06c[_0x25776d(0x16d)],'id':-0x1fffffffffffff}]}),_0x25776d(0x18f))>_0x30d825[_0x25776d(0x183)])throw Error('Excel\x20row\x20'+_0xcad06c[_0x25776d(0x15c)]+_0x25776d(0x1b2));}assertImportPaths(_0x42a948['checkpoint'],_0x42a948['report']);const _0x132942={'appCode':_0x42a948[_0x25776d(0x177)],'datasetCode':_0x42a948['datasetCode'],'runtimeDomain':_0x42a948[_0x25776d(0x174)],'actorId':_0x30d825[_0x25776d(0x1a3)],'fileHash':_0x1caa80[_0x25776d(0x17d)],'mappingHash':_0x1caa80['mappingHash'],'schemaHash':_0x1caa80['schemaHash'],'remoteSchemaHash':_0x30d825[_0x25776d(0x17b)],'batchSize':_0x42a948[_0x25776d(0x1a5)],'sheet':_0x1caa80[_0x25776d(0x19a)]},_0x29c3fb=await acquireLock(_0x42a948[_0x25776d(0x189)]);let _0x5e3409;const _0x40a7c9=Date[_0x25776d(0x17e)]();let _0x54f22d=0x0;const _0x5c4a0e=[],_0x1f3a1b=()=>({'importId':_0x5e3409?.['importId'],'sourceRows':_0x1caa80[_0x25776d(0x19f)][_0x25776d(0x176)],'emptyRows':_0x1caa80[_0x25776d(0x195)][_0x25776d(0x176)],'succeeded':_0x5e3409?.[_0x25776d(0x19f)][_0x25776d(0x17a)](_0x484936=>_0x484936['status']==='succeeded')[_0x25776d(0x176)]??0x0,'unknown':_0x5e3409?.[_0x25776d(0x19f)]['filter'](_0x7c13a9=>_0x7c13a9[_0x25776d(0x19d)]===_0x25776d(0x18e))[_0x25776d(0x176)]??0x0,'conflicts':_0x5e3409?.[_0x25776d(0x19f)][_0x25776d(0x17a)](_0x5b9d76=>_0x5b9d76[_0x25776d(0x19d)]===_0x25776d(0x173))[_0x25776d(0x176)]??0x0,'notAttempted':_0x5e3409?.[_0x25776d(0x19f)][_0x25776d(0x17a)](_0x11e776=>_0x11e776[_0x25776d(0x19d)]===_0x25776d(0x16f))['length']??_0x1caa80['rows'][_0x25776d(0x176)],'batches':_0x54f22d,'batchResults':_0x5c4a0e,'elapsedMs':Date['now']()-_0x40a7c9,'checkpoint':resolve(_0x42a948['checkpoint']),'report':resolve(_0x42a948[_0x25776d(0x182)]),'warnings':_0x1caa80[_0x25776d(0x159)]});try{await rejectSymlink(_0x42a948[_0x25776d(0x189)]);if(_0x42a948[_0x25776d(0x165)]){try{_0x5e3409=JSON[_0x25776d(0x191)](await readFile(_0x42a948['checkpoint'],'utf8'));}catch{throw Error('Cannot\x20read\x20the\x20import\x20checkpoint.');}if(!_0x5e3409||_0x5e3409[_0x25776d(0x1ba)]!==0x1||typeof _0x5e3409[_0x25776d(0x169)]!==_0x25776d(0x15b)||canonical(_0x5e3409['binding'])!==canonical(_0x132942)||!Array[_0x25776d(0x171)](_0x5e3409[_0x25776d(0x19f)])||_0x5e3409[_0x25776d(0x19f)][_0x25776d(0x176)]!==_0x1caa80[_0x25776d(0x19f)]['length']||new Set(_0x5e3409[_0x25776d(0x19f)][_0x25776d(0x194)](_0x469340=>_0x469340['id']))['size']!==_0x5e3409[_0x25776d(0x19f)][_0x25776d(0x176)]||_0x5e3409['rows']['some']((_0x3b47c2,_0x4601ad)=>!Number['isSafeInteger'](_0x3b47c2['id'])||_0x3b47c2['id']>=0x0||_0x3b47c2['rowNumber']!==_0x1caa80['rows'][_0x4601ad][_0x25776d(0x15c)]||![_0x25776d(0x16f),_0x25776d(0x18e),_0x25776d(0x175),_0x25776d(0x173)]['includes'](_0x3b47c2[_0x25776d(0x19d)])))throw Error(_0x25776d(0x1bb));}else{try{await lstat(_0x42a948[_0x25776d(0x189)]);throw Error(_0x25776d(0x17c));}catch(_0x46f5d){if(_0x46f5d[_0x25776d(0x1a1)]!==_0x25776d(0x156))throw _0x46f5d;}const _0x351910=new Set();_0x5e3409={'version':0x1,'importId':randomUUID(),'binding':_0x132942,'rows':_0x1caa80['rows'][_0x25776d(0x194)](_0x318629=>{const _0xf161fa=_0x25776d;let _0x261d53;do{_0x261d53=-(Number(BigInt('0x'+randomBytes(0x7)[_0xf161fa(0x1bc)](_0xf161fa(0x167)))&(0x1n<<0x34n)-0x1n)+0x1);}while(_0x351910[_0xf161fa(0x180)](_0x261d53));return _0x351910['add'](_0x261d53),{'id':_0x261d53,'rowNumber':_0x318629[_0xf161fa(0x15c)],'status':'unsent'};})},await saveImportJson(_0x42a948[_0x25776d(0x189)],_0x5e3409);}const _0x34f8db=_0x5e3409;if(_0x34f8db[_0x25776d(0x19f)][_0x25776d(0x187)](_0x37361a=>_0x37361a[_0x25776d(0x19d)]===_0x25776d(0x173)))throw Error(_0x25776d(0x164));const _0x3608e3=async _0x37fbb8=>{const _0x33bddb=_0x25776d,_0x27371f=await _0x37f297['readback'](_0x37fbb8[_0x33bddb(0x194)](_0x5b9663=>_0x34f8db[_0x33bddb(0x19f)][_0x5b9663]['id']));if(!Array[_0x33bddb(0x171)](_0x27371f))throw Error('Invalid\x20import\x20readback\x20response.');const _0x3520d0=new Set(_0x37fbb8[_0x33bddb(0x194)](_0x1f9415=>_0x34f8db[_0x33bddb(0x19f)][_0x1f9415]['id'])),_0x3fd105=new Map();for(const _0x6d2f9d of _0x27371f){const _0x5af785=Number(_0x6d2f9d?.['id']);if(!_0x3520d0[_0x33bddb(0x180)](_0x5af785)||_0x3fd105['has'](_0x5af785))throw Error('Invalid\x20or\x20duplicate\x20import\x20readback\x20ID.');_0x3fd105[_0x33bddb(0x198)](_0x5af785,_0x6d2f9d);}for(const _0x1fab5a of _0x37fbb8){const _0x21045b=_0x3fd105[_0x33bddb(0x192)](_0x34f8db[_0x33bddb(0x19f)][_0x1fab5a]['id']);if(!_0x21045b)continue;if(_0x34f8db['rows'][_0x1fab5a][_0x33bddb(0x19d)]===_0x33bddb(0x16f)){_0x34f8db[_0x33bddb(0x19f)][_0x1fab5a]['status']=_0x33bddb(0x173),await saveImportJson(_0x42a948[_0x33bddb(0x189)],_0x34f8db);throw Error('Import\x20primary\x20key\x20collision;\x20stop\x20without\x20replacing\x20the\x20fixed\x20IDs.');}const _0x45663c=_0x1caa80[_0x33bddb(0x19f)][_0x1fab5a][_0x33bddb(0x16d)];if(Object[_0x33bddb(0x18b)](_0x45663c)[_0x33bddb(0x187)](_0xb62dea=>!sameImportValue(_0x45663c[_0xb62dea],_0x21045b[_0xb62dea]))){_0x34f8db[_0x33bddb(0x19f)][_0x1fab5a][_0x33bddb(0x19d)]='conflict',await saveImportJson(_0x42a948[_0x33bddb(0x189)],_0x34f8db);throw Error(_0x33bddb(0x1a2)+_0x34f8db[_0x33bddb(0x19f)][_0x1fab5a][_0x33bddb(0x15c)]+'.');}_0x34f8db[_0x33bddb(0x19f)][_0x1fab5a]['status']=_0x33bddb(0x175);}return await saveImportJson(_0x42a948[_0x33bddb(0x189)],_0x34f8db),_0x3fd105;};if(_0x42a948['resume'])for(let _0x5217cd=0x0;_0x5217cd<_0x34f8db[_0x25776d(0x19f)][_0x25776d(0x176)];_0x5217cd+=_0x42a948[_0x25776d(0x1a5)]){const _0x2e42b3=_0x34f8db[_0x25776d(0x19f)][_0x25776d(0x179)](_0x5217cd,_0x5217cd+_0x42a948[_0x25776d(0x1a5)])[_0x25776d(0x194)]((_0x5683a9,_0x47cb6f)=>_0x5217cd+_0x47cb6f),_0x4b14b9=_0x2e42b3[_0x25776d(0x17a)](_0x52ac24=>_0x34f8db[_0x25776d(0x19f)][_0x52ac24][_0x25776d(0x19d)]===_0x25776d(0x175)),_0x104800=await _0x3608e3(_0x2e42b3),_0x3f310d=_0x4b14b9[_0x25776d(0x17a)](_0xa5e18a=>!_0x104800['has'](_0x34f8db[_0x25776d(0x19f)][_0xa5e18a]['id']));if(_0x3f310d[_0x25776d(0x176)]){_0x3f310d[_0x25776d(0x172)](_0xd7f7ba=>{const _0x244b69=_0x25776d;_0x34f8db[_0x244b69(0x19f)][_0xd7f7ba]['status']='conflict';}),await saveImportJson(_0x42a948[_0x25776d(0x189)],_0x34f8db);throw Error(_0x25776d(0x181));}}for(let _0x171ac7=0x0;_0x171ac7<_0x34f8db[_0x25776d(0x19f)][_0x25776d(0x176)];){const _0x3209ee=[],_0x178592=[];while(_0x171ac7<_0x34f8db[_0x25776d(0x19f)][_0x25776d(0x176)]&&_0x178592[_0x25776d(0x176)]<_0x42a948[_0x25776d(0x1a5)]){const _0x29cce2=_0x171ac7++;if(_0x34f8db[_0x25776d(0x19f)][_0x29cce2][_0x25776d(0x19d)]===_0x25776d(0x175))continue;const _0x48156e={..._0x1caa80[_0x25776d(0x19f)][_0x29cce2][_0x25776d(0x16d)],'id':_0x34f8db[_0x25776d(0x19f)][_0x29cce2]['id']};if(Buffer[_0x25776d(0x1b1)](JSON[_0x25776d(0x170)]({'schemaFingerprint':_0x30d825[_0x25776d(0x17b)],'items':[..._0x178592,_0x48156e]}),'utf8')>_0x30d825['maxBatchBytes']){if(!_0x178592[_0x25776d(0x176)])throw Error(_0x25776d(0x1b7)+_0x34f8db['rows'][_0x29cce2][_0x25776d(0x15c)]+'\x20exceeds\x20the\x20import\x20request\x20size\x20limit.');_0x171ac7--;break;}_0x3209ee['push'](_0x29cce2),_0x178592[_0x25776d(0x158)](_0x48156e);}if(!_0x178592[_0x25776d(0x176)])continue;const _0x1c8ebe=_0x3209ee[_0x25776d(0x17a)](_0x13d0fc=>_0x34f8db[_0x25776d(0x19f)][_0x13d0fc]['status']==='unsent');if(_0x1c8ebe[_0x25776d(0x176)]){const _0x4e2afe=await _0x37f297[_0x25776d(0x199)](_0x1c8ebe[_0x25776d(0x194)](_0x5a21c6=>_0x34f8db[_0x25776d(0x19f)][_0x5a21c6]['id']));if(!Array[_0x25776d(0x171)](_0x4e2afe))throw Error(_0x25776d(0x197));if(_0x4e2afe[_0x25776d(0x176)])throw Error(_0x25776d(0x163));}_0x3209ee[_0x25776d(0x172)](_0x2cb45f=>{const _0xb2cc34=_0x25776d;_0x34f8db[_0xb2cc34(0x19f)][_0x2cb45f][_0xb2cc34(0x19d)]=_0xb2cc34(0x18e);}),await saveImportJson(_0x42a948[_0x25776d(0x189)],_0x34f8db),_0x54f22d++;const _0x827e5a=Date[_0x25776d(0x17e)](),_0x553727={'batch':_0x54f22d,'rowStart':_0x34f8db['rows'][_0x3209ee[0x0]][_0x25776d(0x15c)],'rowEnd':_0x34f8db['rows'][_0x3209ee[_0x3209ee['length']-0x1]]['rowNumber'],'count':_0x178592[_0x25776d(0x176)],'bytes':Buffer[_0x25776d(0x1b1)](JSON['stringify']({'schemaFingerprint':_0x30d825['schemaFingerprint'],'items':_0x178592}),_0x25776d(0x18f)),'elapsedMs':0x0,'status':_0x25776d(0x161)};_0x5c4a0e[_0x25776d(0x158)](_0x553727);try{const _0x3069bc=await _0x37f297[_0x25776d(0x178)](_0x178592);if(!_0x3069bc||_0x3069bc[_0x25776d(0x1a9)]!==_0x178592[_0x25776d(0x176)]||!Array[_0x25776d(0x171)](_0x3069bc[_0x25776d(0x16c)])||_0x3069bc[_0x25776d(0x16c)][_0x25776d(0x176)]!==_0x178592[_0x25776d(0x176)]||_0x3069bc[_0x25776d(0x16c)][_0x25776d(0x187)]((_0x57f985,_0x567379)=>Number(_0x57f985)!==_0x34f8db[_0x25776d(0x19f)][_0x3209ee[_0x567379]]['id']))throw Error(_0x25776d(0x1ac));await _0x3608e3(_0x3209ee);if(_0x3209ee[_0x25776d(0x187)](_0x472f88=>_0x34f8db[_0x25776d(0x19f)][_0x472f88]['status']!=='succeeded'))throw Error(_0x25776d(0x18d));}catch(_0x5aedfb){if(_0x34f8db['rows'][_0x25776d(0x187)](_0x31cbcc=>_0x31cbcc[_0x25776d(0x19d)]==='conflict'))throw _0x5aedfb;try{await _0x3608e3(_0x3209ee);}catch(_0x1dbf10){if(_0x34f8db[_0x25776d(0x19f)][_0x25776d(0x187)](_0x2c6e6d=>_0x2c6e6d[_0x25776d(0x19d)]==='conflict'))throw _0x1dbf10;}if(_0x3209ee[_0x25776d(0x187)](_0x4b2deb=>_0x34f8db[_0x25776d(0x19f)][_0x4b2deb][_0x25776d(0x19d)]!==_0x25776d(0x175)))throw Error('The\x20import\x20write\x20outcome\x20is\x20unknown.\x20Resume\x20to\x20reconcile\x20the\x20fixed\x20IDs\x20before\x20continuing.');}finally{_0x553727['elapsedMs']=Date[_0x25776d(0x17e)]()-_0x827e5a;if(_0x3209ee['every'](_0x24c2bd=>_0x34f8db[_0x25776d(0x19f)][_0x24c2bd][_0x25776d(0x19d)]===_0x25776d(0x175)))_0x553727['status']=_0x25776d(0x175);else{if(_0x3209ee[_0x25776d(0x187)](_0x12cc68=>_0x34f8db[_0x25776d(0x19f)][_0x12cc68][_0x25776d(0x19d)]===_0x25776d(0x173)))_0x553727['status']='conflict';}}}const _0x470fc5={'status':_0x25776d(0x188),..._0x1f3a1b()};return await saveImportJson(_0x42a948[_0x25776d(0x182)],_0x470fc5),_0x470fc5;}catch(_0x27c91a){if(_0x5e3409)await saveImportJson(_0x42a948[_0x25776d(0x182)],{'status':_0x25776d(0x193),..._0x1f3a1b(),'message':_0x27c91a[_0x25776d(0x18a)]});throw _0x27c91a;}finally{await _0x29c3fb();}}
|
|
1
|
+
const a145_0x34202c=a145_0x48c5;(function(_0xddb386,_0x34f81c){const _0x3d0edb=a145_0x48c5,_0x5dcf14=_0xddb386();while(!![]){try{const _0x25da29=-parseInt(_0x3d0edb(0x18c))/0x1+parseInt(_0x3d0edb(0x1e3))/0x2+-parseInt(_0x3d0edb(0x1f1))/0x3*(-parseInt(_0x3d0edb(0x1f0))/0x4)+-parseInt(_0x3d0edb(0x1fc))/0x5+parseInt(_0x3d0edb(0x1ae))/0x6+-parseInt(_0x3d0edb(0x1a7))/0x7*(parseInt(_0x3d0edb(0x19e))/0x8)+-parseInt(_0x3d0edb(0x1aa))/0x9*(-parseInt(_0x3d0edb(0x186))/0xa);if(_0x25da29===_0x34f81c)break;else _0x5dcf14['push'](_0x5dcf14['shift']());}catch(_0x5efbbb){_0x5dcf14['push'](_0x5dcf14['shift']());}}}(a145_0x46aa,0x85d97));import{randomBytes,randomUUID}from'node:crypto';import{lstat,open,readFile,realpath,rename,unlink}from'node:fs/promises';import{resolve,dirname,basename}from'node:path';export function canonical(_0x74f9a0){const _0x478909=a145_0x48c5;if(Array[_0x478909(0x1ab)](_0x74f9a0))return'['+_0x74f9a0['map'](canonical)[_0x478909(0x1ef)](',')+']';if(_0x74f9a0&&typeof _0x74f9a0==='object')return'{'+Object[_0x478909(0x1ed)](_0x74f9a0)[_0x478909(0x1ad)]()[_0x478909(0x1a5)](_0x485bca=>JSON[_0x478909(0x1c3)](_0x485bca)+':'+canonical(_0x74f9a0[_0x485bca]))['join'](',')+'}';return JSON[_0x478909(0x1c3)](_0x74f9a0)??'undefined';}function a145_0x48c5(_0x2ca02b,_0x4a4b2c){_0x2ca02b=_0x2ca02b-0x181;const _0x46aa22=a145_0x46aa();let _0x48c509=_0x46aa22[_0x2ca02b];return _0x48c509;}const EMPTY_IMAGE_LOCATION_FIELDS=new Set([a145_0x34202c(0x1da),a145_0x34202c(0x184),'districtAdcode','district',a145_0x34202c(0x1b7),'road',a145_0x34202c(0x1c5),a145_0x34202c(0x1bc),'province','latitude',a145_0x34202c(0x189),a145_0x34202c(0x1d6),a145_0x34202c(0x19d),'streetNumber',a145_0x34202c(0x191),a145_0x34202c(0x197),a145_0x34202c(0x187),a145_0x34202c(0x183),'address','lbswuaCacheId']);export function sameImportValue(_0x171ff0,_0x7e2f24,_0x24fc19=![]){if(_0x24fc19){const _0x257455=_0x1bbdc2=>Array['isArray'](_0x1bbdc2)?_0x1bbdc2['map'](_0x3f7db8=>{const _0x446e82=a145_0x48c5;if(!_0x3f7db8||typeof _0x3f7db8!==_0x446e82(0x1cc)||Array['isArray'](_0x3f7db8))return _0x3f7db8;const _0x504d7e={..._0x3f7db8};delete _0x504d7e['url'],delete _0x504d7e[_0x446e82(0x1c7)];if(_0x504d7e[_0x446e82(0x1e7)]==='')delete _0x504d7e[_0x446e82(0x1e7)];if(_0x504d7e[_0x446e82(0x1d7)]==null)delete _0x504d7e[_0x446e82(0x1d7)];if(_0x504d7e[_0x446e82(0x1ba)]==null)delete _0x504d7e[_0x446e82(0x1ba)];if(_0x504d7e[_0x446e82(0x1cb)]==null||typeof _0x504d7e[_0x446e82(0x1cb)]===_0x446e82(0x1cc)&&!Array[_0x446e82(0x1ab)](_0x504d7e[_0x446e82(0x1cb)])&&Object[_0x446e82(0x1c9)](_0x504d7e['geolocation'])[_0x446e82(0x1b0)](([_0x360215,_0x563393])=>EMPTY_IMAGE_LOCATION_FIELDS[_0x446e82(0x1a6)](_0x360215)&&_0x563393===null))delete _0x504d7e[_0x446e82(0x1cb)];for(const _0x39d0fc of[_0x446e82(0x1ec),_0x446e82(0x1bb),_0x446e82(0x19c)])if(!(_0x39d0fc in _0x504d7e))_0x504d7e[_0x39d0fc]='';if(_0x504d7e[_0x446e82(0x1a9)]==null)_0x504d7e[_0x446e82(0x1a9)]=0x0;return _0x504d7e;}):_0x1bbdc2;return canonical(_0x257455(_0x171ff0))===canonical(_0x257455(_0x7e2f24));}return _0x171ff0===null?_0x7e2f24===null||_0x7e2f24===undefined:canonical(_0x7e2f24)===canonical(_0x171ff0);}async function rejectSymlink(_0x5d9e2a){const _0x32187f=a145_0x34202c;try{if((await lstat(_0x5d9e2a))[_0x32187f(0x18d)]())throw Error(_0x32187f(0x1fe));}catch(_0x39e73d){if(_0x39e73d[_0x32187f(0x1e2)]!==_0x32187f(0x1e4))throw _0x39e73d;}}export async function resolveImportOutputPath(_0x4bf68b){return await rejectSymlink(_0x4bf68b),resolve(await realpath(dirname(resolve(_0x4bf68b))),basename(_0x4bf68b));}export function assertImportPaths(_0x33600b,_0x16bd44,_0x5c72f2=[]){const _0x4511ba=a145_0x34202c,_0x5bfb0=[..._0x5c72f2,_0x33600b,_0x16bd44,_0x33600b+'.lock',_0x33600b+'.lock.recovery'][_0x4511ba(0x1a5)](_0xab1fd=>resolve(_0xab1fd));if(new Set(_0x5bfb0)[_0x4511ba(0x1a9)]!==_0x5bfb0['length'])throw Error('Import\x20input,\x20output\x20and\x20lock\x20paths\x20must\x20be\x20different\x20files.');}function a145_0x46aa(){const _0x50346a=['Import\x20checkpoint\x20contains\x20a\x20content\x20conflict.','The\x20import\x20checkpoint\x20is\x20locked\x20by\x20a\x20running\x20process.','version','close','netType','createUserId','kill','values','time','pid','Invalid\x20import\x20readback\x20response.','isSafeInteger','Import\x20lock\x20recovery\x20is\x20active\x20or\x20interrupted;\x20inspect\x20the\x20recovery\x20guard\x20before\x20retrying.','warnings','Previously\x20imported\x20records\x20are\x20no\x20longer\x20visible;\x20recovery\x20stopped.','Invalid\x20write\x20result.','code','1907558jnRmyT','ENOENT','writeFile','Invalid\x20import\x20lock;\x20inspect\x20it\x20before\x20recovery.','dingTalkUrl','actorId','unsent','Invalid\x20import\x20batch\x20size.','datasetCode','name','keys','The\x20server\x20import\x20contract\x20is\x20unsupported\x20or\x20incomplete.','join','8yppGoh','82107FamNDK','rowNumber','pending','schemaVersion','EEXIST','ids','utf8','mappingHash','get','byteLength','appCode','800940Jlrrdu','\x20exceeds\x20the\x20import\x20request\x20size\x20limit.','Import\x20output\x20must\x20not\x20be\x20a\x20symbolic\x20link.','add','rows','ESRCH','set','errorMessage','operatorType','.recovery','915440iAjbps','cityAdcode','string','city','succeeded','source','680162WQpWWI','isSymbolicLink','batchSize','Invalid\x20import\x20lock\x20owner.','length','accuracy','forEach','some','write','message','report','longitude','push','sync','uploadFields','now','key','resultCode','8CSuehs','includes','readback','schemaHash','Import\x20checkpoint\x20does\x20not\x20match\x20the\x20input,\x20target\x20or\x20identity.','Cannot\x20read\x20the\x20import\x20checkpoint.','parse','map','has','3604993VPHbUC','toString','size','54YqBQdD','isArray','count','sort','2074890IGAEVc','checkpoint','every','emptyRows','completed','The\x20fixed-ID\x20runner\x20requires\x20the\x20v1\x20import\x20contract.','fileHash','The\x20import\x20write\x20outcome\x20is\x20unknown.\x20Resume\x20to\x20reconcile\x20the\x20fixed\x20IDs\x20before\x20continuing.','binding','pois','importId','incomplete','createUserName','type','countryCode','token','conflict','status','schemaFingerprint','filter','hex','stringify','Excel\x20contains\x20no\x20valid\x20data\x20rows.','country','maxBatchBytes','previewUrl','maxBatchSize','entries','resume','geolocation','object','Import\x20lock\x20changed;\x20retry\x20recovery.','Import\x20primary\x20key\x20collision;\x20stop\x20without\x20replacing\x20the\x20fixed\x20IDs.','sheet','Excel\x20contains\x20invalid\x20rows;\x20no\x20data\x20was\x20written.','Excel\x20row\x20'];a145_0x46aa=function(){return _0x50346a;};return a145_0x46aa();}export async function saveImportJson(_0x4589df,_0x345e12){const _0x431702=a145_0x34202c;await rejectSymlink(_0x4589df);const _0x4ddd3a=_0x4589df+'.tmp-'+randomUUID(),_0x245094=await open(_0x4ddd3a,'wx',0x180);try{await _0x245094[_0x431702(0x1e5)](JSON['stringify'](_0x345e12,null,0x2)),await _0x245094['sync']();}finally{await _0x245094['close']();}try{await rename(_0x4ddd3a,_0x4589df);}catch(_0x18362c){await unlink(_0x4ddd3a)['catch'](()=>{});throw _0x18362c;}}export async function acquireLock(_0x5c89e8){const _0x3361ec=a145_0x34202c,_0x21cdb4=_0x5c89e8+'.lock',_0x26c297=randomUUID();await rejectSymlink(_0x21cdb4);const _0x40bf70=_0x21cdb4+_0x3361ec(0x185);let _0x426338,_0x489037;try{try{_0x426338=await open(_0x21cdb4,'wx',0x180);}catch(_0x3d111f){if(_0x3d111f[_0x3361ec(0x1e2)]!==_0x3361ec(0x1f5))throw _0x3d111f;try{_0x489037=await open(_0x40bf70,'wx',0x180);}catch(_0x2be616){if(_0x2be616[_0x3361ec(0x1e2)]===_0x3361ec(0x1f5))throw Error(_0x3361ec(0x1de));throw _0x2be616;}await _0x489037['writeFile'](JSON['stringify']({'pid':process[_0x3361ec(0x1db)],'token':_0x26c297})),await _0x489037[_0x3361ec(0x199)](),await rejectSymlink(_0x21cdb4);let _0x196654;try{_0x196654=await readFile(_0x21cdb4,_0x3361ec(0x1f7));}catch(_0x36a8e8){if(_0x36a8e8[_0x3361ec(0x1e2)]!==_0x3361ec(0x1e4))throw _0x36a8e8;}if(_0x196654!==undefined){let _0xfd89ff;try{_0xfd89ff=JSON[_0x3361ec(0x1a4)](_0x196654);}catch{throw Error(_0x3361ec(0x1e6));}if(!_0xfd89ff||!Number[_0x3361ec(0x1dd)](_0xfd89ff[_0x3361ec(0x1db)])||_0xfd89ff[_0x3361ec(0x1db)]<=0x0)throw Error(_0x3361ec(0x18f));try{process[_0x3361ec(0x1d8)](_0xfd89ff[_0x3361ec(0x1db)],0x0);throw Error(_0x3361ec(0x1d3));}catch(_0x47e667){if(_0x47e667[_0x3361ec(0x1e2)]!==_0x3361ec(0x181))throw _0x47e667;}if(await readFile(_0x21cdb4,_0x3361ec(0x1f7))!==_0x196654)throw Error(_0x3361ec(0x1cd));await unlink(_0x21cdb4);}_0x426338=await open(_0x21cdb4,'wx',0x180);}await _0x426338['writeFile'](JSON[_0x3361ec(0x1c3)]({'pid':process[_0x3361ec(0x1db)],'token':_0x26c297})),await _0x426338[_0x3361ec(0x199)]();}finally{try{await _0x426338?.[_0x3361ec(0x1d5)]();}finally{if(_0x489037)try{await _0x489037[_0x3361ec(0x1d5)]();}finally{await unlink(_0x40bf70);}}}return async()=>{const _0x553287=_0x3361ec;if(JSON[_0x553287(0x1a4)](await readFile(_0x21cdb4,_0x553287(0x1f7)))[_0x553287(0x1bd)]===_0x26c297)await unlink(_0x21cdb4);};}export function assertImportContract(_0x4b3eb5,_0x574759,_0x2714be){const _0x52a95a=a145_0x34202c;if(!_0x4b3eb5||!(_0x4b3eb5[_0x52a95a(0x1f4)]===0x1&&_0x4b3eb5['strategy']==='fixed-negative-id'||_0x4b3eb5[_0x52a95a(0x1f4)]===0x2&&_0x4b3eb5['strategy']==='auto-id-task-marker')||_0x4b3eb5[_0x52a95a(0x18b)]!=='METADATA'||_0x4b3eb5['appCode']!==_0x574759||_0x4b3eb5['datasetCode']!==_0x2714be||typeof _0x4b3eb5['actorId']!==_0x52a95a(0x188)||!_0x4b3eb5[_0x52a95a(0x1e8)]||typeof _0x4b3eb5[_0x52a95a(0x1c0)]!==_0x52a95a(0x188)||!_0x4b3eb5[_0x52a95a(0x1c0)]||!Number[_0x52a95a(0x1dd)](_0x4b3eb5[_0x52a95a(0x1c8)])||_0x4b3eb5[_0x52a95a(0x1c8)]<0x1||_0x4b3eb5[_0x52a95a(0x1c8)]>0x3e8||!Number[_0x52a95a(0x1dd)](_0x4b3eb5[_0x52a95a(0x1c6)])||_0x4b3eb5[_0x52a95a(0x1c6)]<0x1||_0x4b3eb5['maxBatchBytes']>0x14*0x400*0x400)throw Error(_0x52a95a(0x1ee));}export async function runExcelImport(_0x3d9364){const _0x3f7b9c=a145_0x34202c;_0x3d9364={..._0x3d9364,'checkpoint':await resolveImportOutputPath(_0x3d9364['checkpoint']),'report':await resolveImportOutputPath(_0x3d9364[_0x3f7b9c(0x196)])};const {manifest:_0x4a1180,contract:_0x51903d,api:_0x5bf7e0}=_0x3d9364;assertImportContract(_0x51903d,_0x3d9364[_0x3f7b9c(0x1fb)],_0x3d9364[_0x3f7b9c(0x1eb)]);if(_0x51903d[_0x3f7b9c(0x1f4)]!==0x1)throw Error(_0x3f7b9c(0x1b3));if(_0x4a1180['errors'][_0x3f7b9c(0x190)])throw Error(_0x3f7b9c(0x1d0));if(!_0x4a1180[_0x3f7b9c(0x200)]['length'])throw Error(_0x3f7b9c(0x1c4));if(!Number['isInteger'](_0x3d9364[_0x3f7b9c(0x18e)])||_0x3d9364[_0x3f7b9c(0x18e)]<0x1||_0x3d9364[_0x3f7b9c(0x18e)]>_0x51903d[_0x3f7b9c(0x1c8)])throw Error(_0x3f7b9c(0x1ea));for(const _0x4b9178 of _0x4a1180[_0x3f7b9c(0x200)]){if(Buffer[_0x3f7b9c(0x1fa)](JSON['stringify']({'schemaFingerprint':_0x51903d[_0x3f7b9c(0x1c0)],'items':[{..._0x4b9178['values'],'id':-0x1fffffffffffff}]}),'utf8')>_0x51903d[_0x3f7b9c(0x1c6)])throw Error(_0x3f7b9c(0x1d1)+_0x4b9178[_0x3f7b9c(0x1f2)]+_0x3f7b9c(0x1fd));}assertImportPaths(_0x3d9364[_0x3f7b9c(0x1af)],_0x3d9364[_0x3f7b9c(0x196)]);const _0x3eddc1={'appCode':_0x3d9364[_0x3f7b9c(0x1fb)],'datasetCode':_0x3d9364[_0x3f7b9c(0x1eb)],'runtimeDomain':_0x3d9364['runtimeDomain'],'actorId':_0x51903d[_0x3f7b9c(0x1e8)],'fileHash':_0x4a1180[_0x3f7b9c(0x1b4)],'mappingHash':_0x4a1180[_0x3f7b9c(0x1f8)],'schemaHash':_0x4a1180[_0x3f7b9c(0x1a1)],'remoteSchemaHash':_0x51903d['schemaFingerprint'],'batchSize':_0x3d9364[_0x3f7b9c(0x18e)],'sheet':_0x4a1180[_0x3f7b9c(0x1cf)]},_0x185c56=await acquireLock(_0x3d9364[_0x3f7b9c(0x1af)]);let _0x20e392;const _0x5300f2=Date[_0x3f7b9c(0x19b)]();let _0x302acd=0x0;const _0x1bf354=[],_0x69e92b=()=>({'importId':_0x20e392?.[_0x3f7b9c(0x1b8)],'sourceRows':_0x4a1180['rows']['length'],'emptyRows':_0x4a1180[_0x3f7b9c(0x1b1)][_0x3f7b9c(0x190)],'succeeded':_0x20e392?.[_0x3f7b9c(0x200)][_0x3f7b9c(0x1c1)](_0x4e4fd4=>_0x4e4fd4[_0x3f7b9c(0x1bf)]===_0x3f7b9c(0x18a))[_0x3f7b9c(0x190)]??0x0,'unknown':_0x20e392?.[_0x3f7b9c(0x200)][_0x3f7b9c(0x1c1)](_0x8a156b=>_0x8a156b[_0x3f7b9c(0x1bf)]===_0x3f7b9c(0x1f3))[_0x3f7b9c(0x190)]??0x0,'conflicts':_0x20e392?.['rows'][_0x3f7b9c(0x1c1)](_0x48a0ad=>_0x48a0ad[_0x3f7b9c(0x1bf)]==='conflict')['length']??0x0,'notAttempted':_0x20e392?.[_0x3f7b9c(0x200)][_0x3f7b9c(0x1c1)](_0x12a783=>_0x12a783[_0x3f7b9c(0x1bf)]==='unsent')[_0x3f7b9c(0x190)]??_0x4a1180[_0x3f7b9c(0x200)]['length'],'batches':_0x302acd,'batchResults':_0x1bf354,'elapsedMs':Date[_0x3f7b9c(0x19b)]()-_0x5300f2,'checkpoint':resolve(_0x3d9364[_0x3f7b9c(0x1af)]),'report':resolve(_0x3d9364[_0x3f7b9c(0x196)]),'warnings':_0x4a1180[_0x3f7b9c(0x1df)]});try{await rejectSymlink(_0x3d9364[_0x3f7b9c(0x1af)]);if(_0x3d9364['resume']){try{_0x20e392=JSON[_0x3f7b9c(0x1a4)](await readFile(_0x3d9364[_0x3f7b9c(0x1af)],'utf8'));}catch{throw Error(_0x3f7b9c(0x1a3));}if(!_0x20e392||_0x20e392[_0x3f7b9c(0x1d4)]!==0x1||typeof _0x20e392['importId']!==_0x3f7b9c(0x188)||canonical(_0x20e392[_0x3f7b9c(0x1b6)])!==canonical(_0x3eddc1)||!Array[_0x3f7b9c(0x1ab)](_0x20e392[_0x3f7b9c(0x200)])||_0x20e392[_0x3f7b9c(0x200)][_0x3f7b9c(0x190)]!==_0x4a1180[_0x3f7b9c(0x200)]['length']||new Set(_0x20e392['rows'][_0x3f7b9c(0x1a5)](_0x50ffcb=>_0x50ffcb['id']))[_0x3f7b9c(0x1a9)]!==_0x20e392[_0x3f7b9c(0x200)]['length']||_0x20e392[_0x3f7b9c(0x200)]['some']((_0x4020bc,_0x38d138)=>!Number['isSafeInteger'](_0x4020bc['id'])||_0x4020bc['id']>=0x0||_0x4020bc[_0x3f7b9c(0x1f2)]!==_0x4a1180[_0x3f7b9c(0x200)][_0x38d138][_0x3f7b9c(0x1f2)]||!['unsent','pending',_0x3f7b9c(0x18a),_0x3f7b9c(0x1be)][_0x3f7b9c(0x19f)](_0x4020bc[_0x3f7b9c(0x1bf)])))throw Error(_0x3f7b9c(0x1a2));}else{try{await lstat(_0x3d9364['checkpoint']);throw Error('Import\x20checkpoint\x20already\x20exists;\x20use\x20--resume.');}catch(_0x5c7f83){if(_0x5c7f83[_0x3f7b9c(0x1e2)]!==_0x3f7b9c(0x1e4))throw _0x5c7f83;}const _0x403c06=new Set();_0x20e392={'version':0x1,'importId':randomUUID(),'binding':_0x3eddc1,'rows':_0x4a1180[_0x3f7b9c(0x200)]['map'](_0x5cf589=>{const _0x42c84e=_0x3f7b9c;let _0x30ff14;do{_0x30ff14=-(Number(BigInt('0x'+randomBytes(0x7)[_0x42c84e(0x1a8)](_0x42c84e(0x1c2)))&(0x1n<<0x34n)-0x1n)+0x1);}while(_0x403c06[_0x42c84e(0x1a6)](_0x30ff14));return _0x403c06[_0x42c84e(0x1ff)](_0x30ff14),{'id':_0x30ff14,'rowNumber':_0x5cf589[_0x42c84e(0x1f2)],'status':_0x42c84e(0x1e9)};})},await saveImportJson(_0x3d9364[_0x3f7b9c(0x1af)],_0x20e392);}await _0x3d9364['onCheckpointReady']?.();const _0x23e198=_0x20e392;if(_0x23e198[_0x3f7b9c(0x200)][_0x3f7b9c(0x193)](_0x4001ac=>_0x4001ac[_0x3f7b9c(0x1bf)]===_0x3f7b9c(0x1be)))throw Error(_0x3f7b9c(0x1d2));const _0x509815=async _0x58be9b=>{const _0x10472e=_0x3f7b9c,_0x33bb32=await _0x5bf7e0[_0x10472e(0x1a0)](_0x58be9b[_0x10472e(0x1a5)](_0x15a927=>_0x23e198['rows'][_0x15a927]['id']));if(!Array[_0x10472e(0x1ab)](_0x33bb32))throw Error(_0x10472e(0x1dc));const _0x41c913=new Set(_0x58be9b[_0x10472e(0x1a5)](_0x1b396f=>_0x23e198[_0x10472e(0x200)][_0x1b396f]['id'])),_0x59e907=new Map();for(const _0x40a9e3 of _0x33bb32){const _0x537260=Number(_0x40a9e3?.['id']);if(!_0x41c913[_0x10472e(0x1a6)](_0x537260)||_0x59e907[_0x10472e(0x1a6)](_0x537260))throw Error('Invalid\x20or\x20duplicate\x20import\x20readback\x20ID.');_0x59e907[_0x10472e(0x182)](_0x537260,_0x40a9e3);}for(const _0x40ff2d of _0x58be9b){const _0x374aae=_0x59e907[_0x10472e(0x1f9)](_0x23e198['rows'][_0x40ff2d]['id']);if(!_0x374aae)continue;if(_0x23e198[_0x10472e(0x200)][_0x40ff2d][_0x10472e(0x1bf)]===_0x10472e(0x1e9)){_0x23e198[_0x10472e(0x200)][_0x40ff2d][_0x10472e(0x1bf)]='conflict',await saveImportJson(_0x3d9364['checkpoint'],_0x23e198);throw Error(_0x10472e(0x1ce));}const _0x101f6a=_0x4a1180[_0x10472e(0x200)][_0x40ff2d][_0x10472e(0x1d9)];if(Object[_0x10472e(0x1ed)](_0x101f6a)[_0x10472e(0x193)](_0x508068=>!sameImportValue(_0x101f6a[_0x508068],_0x374aae[_0x508068],_0x4a1180['imageFields']?.[_0x10472e(0x19f)](_0x508068)&&!_0x4a1180[_0x10472e(0x19a)]?.[_0x10472e(0x19f)](_0x508068)))){_0x23e198['rows'][_0x40ff2d]['status']=_0x10472e(0x1be),await saveImportJson(_0x3d9364['checkpoint'],_0x23e198);throw Error('Import\x20content\x20conflict\x20at\x20Excel\x20row\x20'+_0x23e198[_0x10472e(0x200)][_0x40ff2d][_0x10472e(0x1f2)]+'.');}_0x23e198[_0x10472e(0x200)][_0x40ff2d]['status']=_0x10472e(0x18a);}return await saveImportJson(_0x3d9364[_0x10472e(0x1af)],_0x23e198),_0x59e907;};if(_0x3d9364[_0x3f7b9c(0x1ca)])for(let _0xcde895=0x0;_0xcde895<_0x23e198[_0x3f7b9c(0x200)]['length'];_0xcde895+=_0x3d9364[_0x3f7b9c(0x18e)]){const _0x1b3664=_0x23e198['rows']['slice'](_0xcde895,_0xcde895+_0x3d9364[_0x3f7b9c(0x18e)])['map']((_0x2dcfa9,_0x3335eb)=>_0xcde895+_0x3335eb),_0x1035ec=_0x1b3664[_0x3f7b9c(0x1c1)](_0x1d3aff=>_0x23e198[_0x3f7b9c(0x200)][_0x1d3aff][_0x3f7b9c(0x1bf)]===_0x3f7b9c(0x18a)),_0x365166=await _0x509815(_0x1b3664),_0x1dd1cf=_0x1035ec[_0x3f7b9c(0x1c1)](_0x3971eb=>!_0x365166[_0x3f7b9c(0x1a6)](_0x23e198['rows'][_0x3971eb]['id']));if(_0x1dd1cf[_0x3f7b9c(0x190)]){_0x1dd1cf[_0x3f7b9c(0x192)](_0x403732=>{const _0x4d3514=_0x3f7b9c;_0x23e198['rows'][_0x403732][_0x4d3514(0x1bf)]='conflict';}),await saveImportJson(_0x3d9364['checkpoint'],_0x23e198);throw Error(_0x3f7b9c(0x1e0));}}for(let _0x5a2b44=0x0;_0x5a2b44<_0x23e198[_0x3f7b9c(0x200)][_0x3f7b9c(0x190)];){const _0x25c6b9=[],_0xfc0809=[];while(_0x5a2b44<_0x23e198['rows'][_0x3f7b9c(0x190)]&&_0xfc0809[_0x3f7b9c(0x190)]<_0x3d9364['batchSize']){const _0x3b6499=_0x5a2b44++;if(_0x23e198['rows'][_0x3b6499]['status']===_0x3f7b9c(0x18a))continue;const _0x2a2c69={..._0x4a1180['rows'][_0x3b6499][_0x3f7b9c(0x1d9)],'id':_0x23e198[_0x3f7b9c(0x200)][_0x3b6499]['id']};if(Buffer[_0x3f7b9c(0x1fa)](JSON['stringify']({'schemaFingerprint':_0x51903d[_0x3f7b9c(0x1c0)],'items':[..._0xfc0809,_0x2a2c69]}),'utf8')>_0x51903d[_0x3f7b9c(0x1c6)]){if(!_0xfc0809['length'])throw Error(_0x3f7b9c(0x1d1)+_0x23e198[_0x3f7b9c(0x200)][_0x3b6499][_0x3f7b9c(0x1f2)]+_0x3f7b9c(0x1fd));_0x5a2b44--;break;}_0x25c6b9[_0x3f7b9c(0x198)](_0x3b6499),_0xfc0809['push'](_0x2a2c69);}if(!_0xfc0809[_0x3f7b9c(0x190)])continue;const _0xde6176=_0x25c6b9['filter'](_0x53003b=>_0x23e198[_0x3f7b9c(0x200)][_0x53003b][_0x3f7b9c(0x1bf)]===_0x3f7b9c(0x1e9));if(_0xde6176['length']){const _0x46a43e=await _0x5bf7e0[_0x3f7b9c(0x1a0)](_0xde6176[_0x3f7b9c(0x1a5)](_0x52a8b1=>_0x23e198[_0x3f7b9c(0x200)][_0x52a8b1]['id']));if(!Array[_0x3f7b9c(0x1ab)](_0x46a43e))throw Error(_0x3f7b9c(0x1dc));if(_0x46a43e[_0x3f7b9c(0x190)])throw Error('Import\x20primary\x20key\x20collision;\x20stop\x20without\x20replacing\x20the\x20fixed\x20IDs.');}_0x25c6b9[_0x3f7b9c(0x192)](_0x5b5be9=>{const _0x4b768f=_0x3f7b9c;_0x23e198[_0x4b768f(0x200)][_0x5b5be9]['status']=_0x4b768f(0x1f3);}),await saveImportJson(_0x3d9364[_0x3f7b9c(0x1af)],_0x23e198),_0x302acd++;const _0x91bf76=Date['now'](),_0x284b4c={'batch':_0x302acd,'rowStart':_0x23e198[_0x3f7b9c(0x200)][_0x25c6b9[0x0]][_0x3f7b9c(0x1f2)],'rowEnd':_0x23e198[_0x3f7b9c(0x200)][_0x25c6b9[_0x25c6b9[_0x3f7b9c(0x190)]-0x1]][_0x3f7b9c(0x1f2)],'count':_0xfc0809[_0x3f7b9c(0x190)],'bytes':Buffer[_0x3f7b9c(0x1fa)](JSON['stringify']({'schemaFingerprint':_0x51903d[_0x3f7b9c(0x1c0)],'items':_0xfc0809}),_0x3f7b9c(0x1f7)),'elapsedMs':0x0,'status':'unknown'};_0x1bf354[_0x3f7b9c(0x198)](_0x284b4c);try{const _0x4332d6=await _0x5bf7e0[_0x3f7b9c(0x194)](_0xfc0809);if(!_0x4332d6||_0x4332d6[_0x3f7b9c(0x1ac)]!==_0xfc0809[_0x3f7b9c(0x190)]||!Array[_0x3f7b9c(0x1ab)](_0x4332d6[_0x3f7b9c(0x1f6)])||_0x4332d6[_0x3f7b9c(0x1f6)][_0x3f7b9c(0x190)]!==_0xfc0809[_0x3f7b9c(0x190)]||_0x4332d6[_0x3f7b9c(0x1f6)]['some']((_0xa93ae0,_0x12e110)=>Number(_0xa93ae0)!==_0x23e198[_0x3f7b9c(0x200)][_0x25c6b9[_0x12e110]]['id']))throw Error(_0x3f7b9c(0x1e1));await _0x509815(_0x25c6b9);if(_0x25c6b9[_0x3f7b9c(0x193)](_0x1ffd66=>_0x23e198[_0x3f7b9c(0x200)][_0x1ffd66]['status']!==_0x3f7b9c(0x18a)))throw Error('Incomplete\x20readback.');}catch(_0x3836b0){if(_0x23e198[_0x3f7b9c(0x200)][_0x3f7b9c(0x193)](_0x303405=>_0x303405[_0x3f7b9c(0x1bf)]===_0x3f7b9c(0x1be)))throw _0x3836b0;try{await _0x509815(_0x25c6b9);}catch(_0x70bfdf){if(_0x23e198['rows'][_0x3f7b9c(0x193)](_0x3a155c=>_0x3a155c['status']===_0x3f7b9c(0x1be)))throw _0x70bfdf;}if(_0x25c6b9['some'](_0x5d36b3=>_0x23e198[_0x3f7b9c(0x200)][_0x5d36b3][_0x3f7b9c(0x1bf)]!==_0x3f7b9c(0x18a)))throw Error(_0x3f7b9c(0x1b5));}finally{_0x284b4c['elapsedMs']=Date[_0x3f7b9c(0x19b)]()-_0x91bf76;if(_0x25c6b9['every'](_0x668fab=>_0x23e198['rows'][_0x668fab]['status']===_0x3f7b9c(0x18a)))_0x284b4c[_0x3f7b9c(0x1bf)]=_0x3f7b9c(0x18a);else{if(_0x25c6b9['some'](_0x21b8b8=>_0x23e198[_0x3f7b9c(0x200)][_0x21b8b8]['status']==='conflict'))_0x284b4c[_0x3f7b9c(0x1bf)]=_0x3f7b9c(0x1be);}}}const _0x25f053={'status':_0x3f7b9c(0x1b2),..._0x69e92b()};return await saveImportJson(_0x3d9364[_0x3f7b9c(0x196)],_0x25f053),_0x25f053;}catch(_0x550654){if(_0x20e392)await saveImportJson(_0x3d9364[_0x3f7b9c(0x196)],{'status':_0x3f7b9c(0x1b9),..._0x69e92b(),'message':_0x550654[_0x3f7b9c(0x195)]});throw _0x550654;}finally{await _0x185c56();}}
|
|
@@ -4,9 +4,30 @@ export interface ImportField {
|
|
|
4
4
|
required: boolean;
|
|
5
5
|
generated?: boolean;
|
|
6
6
|
}
|
|
7
|
+
export interface ImportImageValue {
|
|
8
|
+
name: string;
|
|
9
|
+
type: string;
|
|
10
|
+
key: string;
|
|
11
|
+
size: number;
|
|
12
|
+
}
|
|
13
|
+
export interface ImportUploadValue {
|
|
14
|
+
fileName: string;
|
|
15
|
+
filePath: string;
|
|
16
|
+
}
|
|
17
|
+
export interface ImportMedia {
|
|
18
|
+
contentHash: string;
|
|
19
|
+
type: string;
|
|
20
|
+
size: number;
|
|
21
|
+
bytes: Buffer;
|
|
22
|
+
}
|
|
23
|
+
export interface ImportImageCell {
|
|
24
|
+
rowNumber: number;
|
|
25
|
+
field: string;
|
|
26
|
+
hashes: string[];
|
|
27
|
+
}
|
|
7
28
|
export interface ImportRow {
|
|
8
29
|
rowNumber: number;
|
|
9
|
-
values: Record<string, string | number | boolean | null>;
|
|
30
|
+
values: Record<string, string | number | boolean | null | (ImportImageValue | ImportUploadValue)[]>;
|
|
10
31
|
}
|
|
11
32
|
export interface ImportValidationError {
|
|
12
33
|
rowNumber: number;
|
|
@@ -27,6 +48,12 @@ export interface ExcelManifest {
|
|
|
27
48
|
schemaHash: string;
|
|
28
49
|
sheet: string;
|
|
29
50
|
rows: ImportRow[];
|
|
51
|
+
imageFields?: string[];
|
|
52
|
+
media?: ImportMedia[];
|
|
53
|
+
imageCells?: ImportImageCell[];
|
|
54
|
+
parserVersion?: number;
|
|
55
|
+
/** 使用标准附件值的字段;缺省保持历史 IMAGE 检查点协议。 */
|
|
56
|
+
uploadFields?: string[];
|
|
30
57
|
emptyRows: number[];
|
|
31
58
|
errors: ImportValidationError[];
|
|
32
59
|
warnings: string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a144_0x3b29d2=a144_0x353a;(function(_0xd7df58,_0x1ad755){const _0x5aa542=a144_0x353a,_0x705027=_0xd7df58();while(!![]){try{const _0x10bdf8=-parseInt(_0x5aa542(0x1b3))/0x1+-parseInt(_0x5aa542(0x1a5))/0x2+parseInt(_0x5aa542(0x1bf))/0x3+-parseInt(_0x5aa542(0x1eb))/0x4+-parseInt(_0x5aa542(0x1b6))/0x5*(-parseInt(_0x5aa542(0x1c4))/0x6)+parseInt(_0x5aa542(0x1a7))/0x7*(-parseInt(_0x5aa542(0x1d0))/0x8)+parseInt(_0x5aa542(0x1ca))/0x9;if(_0x10bdf8===_0x1ad755)break;else _0x705027['push'](_0x705027['shift']());}catch(_0x418e8f){_0x705027['push'](_0x705027['shift']());}}}(a144_0x1edb,0x1c156));import{createHash}from'node:crypto';import{lstatSync,readFileSync,readdirSync}from'node:fs';import{homedir}from'node:os';import{dirname,join,relative,resolve,sep}from'node:path';function a144_0x1edb(){const _0x5bd7fd=['8PwWwub','path','pipe','Unsafe\x20manifest\x20path:\x20','version','content_mismatch','unverifiable','schemaVersion','length','SOURCE_INVALID','isFile','skills@latest\x20exited\x20','Installer\x20reported\x20partial\x20target\x20failures:\x0a%s','error','Built-in\x20Skill\x20source\x20does\x20not\x20match\x20its\x20package\x20manifest','split','SKILL.md','skills','state','skipped','Installed\x20Skill\x20state\x20is\x20','sha256','flatMap','skillVersion','join','output','files','620956FLgWnZ','parse','current','lovrabet-skills','444862HozKtH','isDirectory','1224811ZkmKST','stdio','version_mismatch','root','count','missing','home','Unsupported\x20Skill\x20entry:\x20','VERIFY_FAILED','installedPath','isSymbolicLink','present','184007OnKGBY','unknown','manifest','5pkzNCZ','Symbolic\x20link\x20is\x20not\x20allowed:\x20',':\x5cs*(.+)$','digest','sort','\x20verified;\x20','CLI\x20Built-in\x20Skill\x20','match','includes','133557qUDmmf','partialFailure','lovrabet\x20cli-skill\x20install','trim','absent','1066254pGtpQD','name','update','message','packageRoot','log','5665068PPsPBp','packageVersion','startsWith','utf8','\x20automatically\x20selected\x20installation\x20target(s)\x20could\x20not\x20be\x20installed.','reason'];a144_0x1edb=function(){return _0x5bd7fd;};return a144_0x1edb();}import{fileURLToPath}from'node:url';import{debuglog}from'node:util';import{runNpxSkillsAddGlobal}from'../skills/npx-skills-add.js';import{resolveInstalledSkill}from'../skills/skill-presence.js';const DEFAULT_PACKAGE_ROOT=resolve(dirname(fileURLToPath(import.meta.url)),'..','..'),REPAIR_COMMAND=a144_0x3b29d2(0x1c1),SKILL_NAME='lovrabet',debug=debuglog(a144_0x3b29d2(0x1a4));function frontmatterValue(_0x2a83af,_0x19ed9){const _0x54a413=a144_0x3b29d2;return _0x2a83af[_0x54a413(0x1bd)](new RegExp('^'+_0x19ed9+_0x54a413(0x1b8),'m'))?.[0x1]?.[_0x54a413(0x1c2)]()??'';}function listFiles(_0x31bb64,_0x453e89=_0x31bb64){const _0x6331ad=a144_0x3b29d2;return readdirSync(_0x453e89,{'withFileTypes':!![]})[_0x6331ad(0x1e6)](_0x51af1c=>{const _0x548cb2=_0x6331ad,_0x27b66e=join(_0x453e89,_0x51af1c[_0x548cb2(0x1c5)]),_0x37514e=lstatSync(_0x27b66e);if(_0x37514e[_0x548cb2(0x1b1)]())throw new Error(_0x548cb2(0x1b7)+_0x27b66e);if(_0x37514e[_0x548cb2(0x1a6)]())return listFiles(_0x31bb64,_0x27b66e);if(!_0x37514e[_0x548cb2(0x1da)]())throw new Error(_0x548cb2(0x1ae)+_0x27b66e);return[relative(_0x31bb64,_0x27b66e)['split'](sep)[_0x548cb2(0x1e8)]('/')];})[_0x6331ad(0x1ba)]((_0x46e90a,_0x5b899f)=>_0x46e90a<_0x5b899f?-0x1:_0x46e90a>_0x5b899f?0x1:0x0);}function digestFiles(_0x2e438c,_0x1d397d){const _0x25ef2c=a144_0x3b29d2,_0x2d813d=createHash(_0x25ef2c(0x1e5));for(const _0x1bb936 of _0x1d397d){if(_0x1bb936[_0x25ef2c(0x1cc)]('/')||_0x1bb936[_0x25ef2c(0x1df)]('/')[_0x25ef2c(0x1be)]('..')||_0x1bb936[_0x25ef2c(0x1be)]('\x5c'))throw new Error(_0x25ef2c(0x1d3)+_0x1bb936);_0x2d813d['update'](_0x1bb936),_0x2d813d[_0x25ef2c(0x1c6)]('\x00'),_0x2d813d[_0x25ef2c(0x1c6)](readFileSync(join(_0x2e438c,..._0x1bb936[_0x25ef2c(0x1df)]('/')))),_0x2d813d[_0x25ef2c(0x1c6)]('\x00');}return _0x2d813d[_0x25ef2c(0x1b9)]('hex');}function sameFiles(_0x4d1de8,_0x1b47a4){const _0x68ce90=a144_0x3b29d2;return _0x4d1de8['length']===_0x1b47a4[_0x68ce90(0x1d8)]&&_0x4d1de8['every']((_0x1af565,_0x2522f8)=>_0x1af565===_0x1b47a4[_0x2522f8]);}function a144_0x353a(_0x1d0963,_0x40dc54){_0x1d0963=_0x1d0963-0x1a2;const _0x1edb93=a144_0x1edb();let _0x353aa8=_0x1edb93[_0x1d0963];return _0x353aa8;}function readSource(_0x27d00d){const _0x1667f1=a144_0x3b29d2,_0x508ae9=JSON['parse'](readFileSync(join(_0x27d00d,'package.json'),_0x1667f1(0x1cd))),_0x52a5a7=JSON[_0x1667f1(0x1a2)](readFileSync(join(_0x27d00d,_0x1667f1(0x1e1),'lovrabet.manifest.json'),_0x1667f1(0x1cd))),_0x5aeeac=join(_0x27d00d,_0x1667f1(0x1e1),SKILL_NAME),_0x5f464f=frontmatterValue(readFileSync(join(_0x5aeeac,_0x1667f1(0x1e0)),_0x1667f1(0x1cd)),_0x1667f1(0x1d4)),_0x5f2a4e=listFiles(_0x5aeeac);if(_0x52a5a7[_0x1667f1(0x1d7)]!==0x1||_0x52a5a7['name']!==SKILL_NAME||!_0x508ae9[_0x1667f1(0x1d4)]||_0x52a5a7['packageVersion']!==_0x508ae9[_0x1667f1(0x1d4)]||_0x52a5a7[_0x1667f1(0x1e7)]!==_0x508ae9[_0x1667f1(0x1d4)]||_0x5f464f!==_0x508ae9[_0x1667f1(0x1d4)]||!sameFiles(_0x5f2a4e,_0x52a5a7[_0x1667f1(0x1ea)])||digestFiles(_0x5aeeac,_0x5f2a4e)!==_0x52a5a7[_0x1667f1(0x1b9)])throw new Error(_0x1667f1(0x1de));return{'packageVersion':_0x508ae9[_0x1667f1(0x1d4)],'skillVersion':_0x5f464f,'root':_0x5aeeac,'manifest':_0x52a5a7};}function installedSkillPath(_0x5e2712){const _0x7484bd=a144_0x3b29d2,_0x658be5=resolveInstalledSkill(SKILL_NAME,{'home':_0x5e2712});if(_0x658be5[_0x7484bd(0x1e2)]===_0x7484bd(0x1b2))return{'state':'present','path':dirname(_0x658be5[_0x7484bd(0x1d1)])};if(_0x658be5[_0x7484bd(0x1e2)]===_0x7484bd(0x1c3))return{'state':'missing'};return{'state':_0x7484bd(0x1d6),'reason':_0x658be5[_0x7484bd(0x1cf)]};}export function inspectInstalledBuiltinSkillVersion(_0x4486d5,_0x4ea67f={}){const _0x53dcf2=a144_0x3b29d2,_0x527d03=installedSkillPath(_0x4ea67f['home']??homedir());if(_0x527d03[_0x53dcf2(0x1e2)]==='missing')return{'state':'missing','expectedVersion':_0x4486d5,'repairCommand':REPAIR_COMMAND};if(_0x527d03[_0x53dcf2(0x1e2)]===_0x53dcf2(0x1d6))return{'state':_0x53dcf2(0x1d6),'expectedVersion':_0x4486d5,'reason':_0x527d03[_0x53dcf2(0x1cf)],'repairCommand':REPAIR_COMMAND};try{const _0x3c22ae=frontmatterValue(readFileSync(join(_0x527d03[_0x53dcf2(0x1d1)],'SKILL.md'),_0x53dcf2(0x1cd)),'version');return{'state':_0x3c22ae===_0x4486d5?_0x53dcf2(0x1a3):_0x53dcf2(0x1a9),'expectedVersion':_0x4486d5,'skillVersion':_0x3c22ae,'installedPath':_0x527d03[_0x53dcf2(0x1d1)],'repairCommand':REPAIR_COMMAND};}catch(_0x33c5d9){return{'state':_0x53dcf2(0x1d6),'expectedVersion':_0x4486d5,'installedPath':_0x527d03[_0x53dcf2(0x1d1)],'reason':_0x33c5d9 instanceof Error?_0x33c5d9[_0x53dcf2(0x1c7)]:String(_0x33c5d9),'repairCommand':REPAIR_COMMAND};}}export function inspectBuiltinSkill(_0x4959c9={}){const _0x38b31d=a144_0x3b29d2,_0x5aa104=_0x4959c9[_0x38b31d(0x1c8)]??DEFAULT_PACKAGE_ROOT;let _0x479965;try{_0x479965=readSource(_0x5aa104);}catch(_0xd0a3fc){return{'state':_0x38b31d(0x1d6),'packageVersion':_0x38b31d(0x1b4),'reason':_0xd0a3fc instanceof Error?_0xd0a3fc[_0x38b31d(0x1c7)]:String(_0xd0a3fc),'repairCommand':REPAIR_COMMAND};}const _0x1929d3=installedSkillPath(_0x4959c9[_0x38b31d(0x1ad)]??homedir());if(_0x1929d3[_0x38b31d(0x1e2)]===_0x38b31d(0x1ac))return{'state':_0x38b31d(0x1ac),'packageVersion':_0x479965[_0x38b31d(0x1cb)],'repairCommand':REPAIR_COMMAND};if(_0x1929d3['state']===_0x38b31d(0x1d6))return{'state':_0x38b31d(0x1d6),'packageVersion':_0x479965[_0x38b31d(0x1cb)],'reason':_0x1929d3[_0x38b31d(0x1cf)],'repairCommand':REPAIR_COMMAND};try{const _0x5ca735=frontmatterValue(readFileSync(join(_0x1929d3[_0x38b31d(0x1d1)],_0x38b31d(0x1e0)),_0x38b31d(0x1cd)),'version');if(_0x5ca735!==_0x479965['skillVersion'])return{'state':_0x38b31d(0x1a9),'packageVersion':_0x479965['packageVersion'],'skillVersion':_0x5ca735,'installedPath':_0x1929d3[_0x38b31d(0x1d1)],'repairCommand':REPAIR_COMMAND};const _0x12396f=listFiles(_0x1929d3[_0x38b31d(0x1d1)]),_0x1929b1=digestFiles(_0x1929d3[_0x38b31d(0x1d1)],_0x12396f);return{'state':sameFiles(_0x12396f,_0x479965[_0x38b31d(0x1b5)][_0x38b31d(0x1ea)])&&_0x1929b1===_0x479965['manifest'][_0x38b31d(0x1b9)]?_0x38b31d(0x1a3):_0x38b31d(0x1d5),'packageVersion':_0x479965[_0x38b31d(0x1cb)],'skillVersion':_0x5ca735,'installedPath':_0x1929d3[_0x38b31d(0x1d1)],'digest':_0x1929b1,'repairCommand':REPAIR_COMMAND};}catch(_0x27cfbc){return{'state':_0x38b31d(0x1d6),'packageVersion':_0x479965[_0x38b31d(0x1cb)],'installedPath':_0x1929d3[_0x38b31d(0x1d1)],'reason':_0x27cfbc instanceof Error?_0x27cfbc[_0x38b31d(0x1c7)]:String(_0x27cfbc),'repairCommand':REPAIR_COMMAND};}}function failure(_0x235e9d,_0x5badcd,_0xf3718f,_0x2c4eb0){const _0x115fd0=a144_0x3b29d2;return{'ok':![],'code':_0x235e9d,'packageVersion':_0x5badcd[_0x115fd0(0x1cb)],'skillVersion':_0x5badcd[_0x115fd0(0x1e7)],'installedPath':_0x2c4eb0,'changed':![],'repairCommand':REPAIR_COMMAND,'error':_0xf3718f instanceof Error?_0xf3718f['message']:String(_0xf3718f)};}export function installBuiltinSkill(_0x32b6d0={}){const _0xbfe1e9=a144_0x3b29d2,_0x2b7d53=_0x32b6d0[_0xbfe1e9(0x1c8)]??DEFAULT_PACKAGE_ROOT,_0x10e0e7=_0x32b6d0['home']??homedir();let _0x557dea;try{_0x557dea=readSource(_0x2b7d53);}catch(_0x51cc8f){return failure(_0xbfe1e9(0x1d9),{'packageVersion':_0xbfe1e9(0x1b4),'skillVersion':_0xbfe1e9(0x1b4)},_0x51cc8f);}const _0x4424d7=inspectBuiltinSkill({'packageRoot':_0x2b7d53,'home':_0x10e0e7}),_0x1ba7f3=runNpxSkillsAddGlobal(_0x2b7d53,_0x557dea[_0xbfe1e9(0x1aa)],{'stdio':_0x32b6d0[_0xbfe1e9(0x1a8)]??_0xbfe1e9(0x1d2),'expectedSkillName':SKILL_NAME,'presence':{'home':_0x10e0e7}});if(_0x1ba7f3[_0xbfe1e9(0x1e3)])return{'ok':!![],'packageVersion':_0x557dea[_0xbfe1e9(0x1cb)],'skillVersion':_0x557dea[_0xbfe1e9(0x1e7)],'installedPath':_0x4424d7[_0xbfe1e9(0x1b0)],'changed':![],'repairCommand':REPAIR_COMMAND};if(!_0x1ba7f3['ok'])return failure('INSTALL_FAILED',_0x557dea,_0x1ba7f3[_0xbfe1e9(0x1dd)]??_0xbfe1e9(0x1db)+_0x1ba7f3['status']);const _0x178ae7=inspectBuiltinSkill({'packageRoot':_0x2b7d53,'home':_0x10e0e7});if(_0x178ae7['state']!=='current'){const _0x4034d0=_0x178ae7[_0xbfe1e9(0x1cf)]??_0xbfe1e9(0x1e4)+_0x178ae7[_0xbfe1e9(0x1e2)];return failure(_0xbfe1e9(0x1af),_0x557dea,_0x1ba7f3[_0xbfe1e9(0x1c0)]?_0x4034d0+'\x0a'+_0x1ba7f3[_0xbfe1e9(0x1c0)][_0xbfe1e9(0x1e9)]:_0x4034d0,_0x178ae7[_0xbfe1e9(0x1b0)]);}return _0x1ba7f3[_0xbfe1e9(0x1c0)]&&(debug(_0xbfe1e9(0x1dc),_0x1ba7f3[_0xbfe1e9(0x1c0)]['output']),console[_0xbfe1e9(0x1c9)](_0xbfe1e9(0x1bc)+_0x557dea[_0xbfe1e9(0x1e7)]+_0xbfe1e9(0x1bb)+_0x1ba7f3[_0xbfe1e9(0x1c0)][_0xbfe1e9(0x1ab)]+_0xbfe1e9(0x1ce))),{'ok':!![],'packageVersion':_0x557dea['packageVersion'],'skillVersion':_0x557dea[_0xbfe1e9(0x1e7)],'installedPath':_0x178ae7[_0xbfe1e9(0x1b0)],'changed':_0x4424d7['state']!==_0xbfe1e9(0x1a3),'repairCommand':REPAIR_COMMAND};}
|
|
1
|
+
const a147_0x1d61b2=a147_0x2ef8;(function(_0x17dbee,_0x2eacee){const _0x9da1ab=a147_0x2ef8,_0x12b38a=_0x17dbee();while(!![]){try{const _0x510518=parseInt(_0x9da1ab(0x93))/0x1*(-parseInt(_0x9da1ab(0xa5))/0x2)+-parseInt(_0x9da1ab(0xa7))/0x3+parseInt(_0x9da1ab(0x7a))/0x4*(parseInt(_0x9da1ab(0xb3))/0x5)+parseInt(_0x9da1ab(0x9b))/0x6+parseInt(_0x9da1ab(0x81))/0x7*(parseInt(_0x9da1ab(0x6e))/0x8)+parseInt(_0x9da1ab(0xb1))/0x9+-parseInt(_0x9da1ab(0x86))/0xa*(parseInt(_0x9da1ab(0x92))/0xb);if(_0x510518===_0x2eacee)break;else _0x12b38a['push'](_0x12b38a['shift']());}catch(_0x542489){_0x12b38a['push'](_0x12b38a['shift']());}}}(a147_0x2dca,0x8ae11));import{createHash}from'node:crypto';import{lstatSync,readFileSync,readdirSync}from'node:fs';import{homedir}from'node:os';import{dirname,join,relative,resolve,sep}from'node:path';import{fileURLToPath}from'node:url';import{debuglog}from'node:util';import{runNpxSkillsAddGlobal}from'../skills/npx-skills-add.js';import{resolveInstalledSkill}from'../skills/skill-presence.js';const DEFAULT_PACKAGE_ROOT=resolve(dirname(fileURLToPath(import.meta.url)),'..','..'),REPAIR_COMMAND=a147_0x1d61b2(0x87),SKILL_NAME=a147_0x1d61b2(0x77),debug=debuglog(a147_0x1d61b2(0x84));function frontmatterValue(_0x34332c,_0x46cff3){const _0x1cc96b=a147_0x1d61b2;return _0x34332c[_0x1cc96b(0x8a)](new RegExp('^'+_0x46cff3+_0x1cc96b(0x78),'m'))?.[0x1]?.[_0x1cc96b(0xb4)]()??'';}function listFiles(_0x4413b5,_0x4723d6=_0x4413b5){const _0x87e554=a147_0x1d61b2;return readdirSync(_0x4723d6,{'withFileTypes':!![]})[_0x87e554(0xa8)](_0x2704c0=>{const _0x5b4344=_0x87e554,_0x45aa9e=join(_0x4723d6,_0x2704c0[_0x5b4344(0x94)]),_0x4eb8bc=lstatSync(_0x45aa9e);if(_0x4eb8bc['isSymbolicLink']())throw new Error(_0x5b4344(0xa9)+_0x45aa9e);if(_0x4eb8bc['isDirectory']())return listFiles(_0x4413b5,_0x45aa9e);if(!_0x4eb8bc[_0x5b4344(0x85)]())throw new Error(_0x5b4344(0x7f)+_0x45aa9e);return[relative(_0x4413b5,_0x45aa9e)[_0x5b4344(0xa6)](sep)[_0x5b4344(0x8f)]('/')];})[_0x87e554(0x97)]((_0x32a7a1,_0x5c6ce6)=>_0x32a7a1<_0x5c6ce6?-0x1:_0x32a7a1>_0x5c6ce6?0x1:0x0);}function digestFiles(_0x3d6a6b,_0x5a072b){const _0x41980b=a147_0x1d61b2,_0x7baafb=createHash('sha256');for(const _0x1ff60e of _0x5a072b){if(_0x1ff60e[_0x41980b(0x91)]('/')||_0x1ff60e[_0x41980b(0xa6)]('/')[_0x41980b(0x95)]('..')||_0x1ff60e['includes']('\x5c'))throw new Error(_0x41980b(0x80)+_0x1ff60e);_0x7baafb[_0x41980b(0xaa)](_0x1ff60e),_0x7baafb[_0x41980b(0xaa)]('\x00'),_0x7baafb[_0x41980b(0xaa)](readFileSync(join(_0x3d6a6b,..._0x1ff60e[_0x41980b(0xa6)]('/')))),_0x7baafb[_0x41980b(0xaa)]('\x00');}return _0x7baafb['digest'](_0x41980b(0x82));}function sameFiles(_0x142db1,_0x3c4043){const _0x20013c=a147_0x1d61b2;return _0x142db1[_0x20013c(0x7c)]===_0x3c4043['length']&&_0x142db1[_0x20013c(0xad)]((_0x4680f0,_0x2a34c4)=>_0x4680f0===_0x3c4043[_0x2a34c4]);}function readSource(_0x449de6){const _0x5c731c=a147_0x1d61b2,_0x282bc7=JSON[_0x5c731c(0x88)](readFileSync(join(_0x449de6,_0x5c731c(0xab)),'utf8')),_0x1f1a0a=JSON[_0x5c731c(0x88)](readFileSync(join(_0x449de6,'skills',_0x5c731c(0x89)),_0x5c731c(0x96))),_0xb0a426=join(_0x449de6,_0x5c731c(0x8e),SKILL_NAME),_0x2cfe7f=frontmatterValue(readFileSync(join(_0xb0a426,_0x5c731c(0x79)),'utf8'),_0x5c731c(0xaf)),_0x59f6d3=listFiles(_0xb0a426);if(_0x1f1a0a[_0x5c731c(0xb0)]!==0x1||_0x1f1a0a[_0x5c731c(0x94)]!==SKILL_NAME||!_0x282bc7[_0x5c731c(0xaf)]||_0x1f1a0a[_0x5c731c(0x9f)]!==_0x282bc7[_0x5c731c(0xaf)]||_0x1f1a0a[_0x5c731c(0x7b)]!==_0x282bc7[_0x5c731c(0xaf)]||_0x2cfe7f!==_0x282bc7[_0x5c731c(0xaf)]||!sameFiles(_0x59f6d3,_0x1f1a0a[_0x5c731c(0x70)])||digestFiles(_0xb0a426,_0x59f6d3)!==_0x1f1a0a[_0x5c731c(0xa0)])throw new Error('Built-in\x20Skill\x20source\x20does\x20not\x20match\x20its\x20package\x20manifest');return{'packageVersion':_0x282bc7['version'],'skillVersion':_0x2cfe7f,'root':_0xb0a426,'manifest':_0x1f1a0a};}function installedSkillPath(_0x161d30){const _0xd42b8e=a147_0x1d61b2,_0x1585d0=resolveInstalledSkill(SKILL_NAME,{'home':_0x161d30});if(_0x1585d0['state']===_0xd42b8e(0xb2))return{'state':_0xd42b8e(0xb2),'path':dirname(_0x1585d0[_0xd42b8e(0xa1)])};if(_0x1585d0[_0xd42b8e(0x83)]==='absent')return{'state':_0xd42b8e(0x7d)};return{'state':'unverifiable','reason':_0x1585d0['reason']};}function a147_0x2dca(){const _0xf8ce07=['name','includes','utf8','sort','installedPath','\x20verified;\x20','CLI\x20Built-in\x20Skill\x20','2454180WqzGLE','packageRoot','stdio','current','packageVersion','digest','path','home','root','version_mismatch','14yvhhEn','split','346614ZqlVzm','flatMap','Symbolic\x20link\x20is\x20not\x20allowed:\x20','update','package.json','content_mismatch','every','status','version','schemaVersion','8431443NvPTiE','present','2263950FAJCMC','trim','Installer\x20reported\x20partial\x20target\x20failures:\x0a%s','72056pzvGdC','unverifiable','files','\x20automatically\x20selected\x20installation\x20target(s)\x20could\x20not\x20be\x20installed.','error','VERIFY_FAILED','skills@latest\x20exited\x20','partialFailure','unknown','lovrabet',':\x5cs*(.+)$','SKILL.md','8zWeYbB','skillVersion','length','missing','output','Unsupported\x20Skill\x20entry:\x20','Unsafe\x20manifest\x20path:\x20','91DDutpC','hex','state','lovrabet-skills','isFile','3365610mdbvyM','lovrabet\x20cli-skill\x20install','parse','lovrabet.manifest.json','match','Installed\x20Skill\x20state\x20is\x20','reason','message','skills','join','INSTALL_FAILED','startsWith','44reZGRP','48271HZBFJu'];a147_0x2dca=function(){return _0xf8ce07;};return a147_0x2dca();}export function inspectInstalledBuiltinSkillVersion(_0x4bd91b,_0x424e64={}){const _0x44880b=a147_0x1d61b2,_0x1b4a87=installedSkillPath(_0x424e64[_0x44880b(0xa2)]??homedir());if(_0x1b4a87[_0x44880b(0x83)]===_0x44880b(0x7d))return{'state':'missing','expectedVersion':_0x4bd91b,'repairCommand':REPAIR_COMMAND};if(_0x1b4a87[_0x44880b(0x83)]===_0x44880b(0x6f))return{'state':_0x44880b(0x6f),'expectedVersion':_0x4bd91b,'reason':_0x1b4a87[_0x44880b(0x8c)],'repairCommand':REPAIR_COMMAND};try{const _0x35c251=frontmatterValue(readFileSync(join(_0x1b4a87['path'],_0x44880b(0x79)),_0x44880b(0x96)),'version');return{'state':_0x35c251===_0x4bd91b?'current':_0x44880b(0xa4),'expectedVersion':_0x4bd91b,'skillVersion':_0x35c251,'installedPath':_0x1b4a87[_0x44880b(0xa1)],'repairCommand':REPAIR_COMMAND};}catch(_0x104cbe){return{'state':_0x44880b(0x6f),'expectedVersion':_0x4bd91b,'installedPath':_0x1b4a87[_0x44880b(0xa1)],'reason':_0x104cbe instanceof Error?_0x104cbe['message']:String(_0x104cbe),'repairCommand':REPAIR_COMMAND};}}export function inspectBuiltinSkill(_0x44e119={}){const _0x5857ff=a147_0x1d61b2,_0x10d3c5=_0x44e119[_0x5857ff(0x9c)]??DEFAULT_PACKAGE_ROOT;let _0x54eec4;try{_0x54eec4=readSource(_0x10d3c5);}catch(_0x2ebc40){return{'state':'unverifiable','packageVersion':_0x5857ff(0x76),'reason':_0x2ebc40 instanceof Error?_0x2ebc40['message']:String(_0x2ebc40),'repairCommand':REPAIR_COMMAND};}const _0x315968=installedSkillPath(_0x44e119[_0x5857ff(0xa2)]??homedir());if(_0x315968[_0x5857ff(0x83)]==='missing')return{'state':_0x5857ff(0x7d),'packageVersion':_0x54eec4[_0x5857ff(0x9f)],'repairCommand':REPAIR_COMMAND};if(_0x315968['state']===_0x5857ff(0x6f))return{'state':_0x5857ff(0x6f),'packageVersion':_0x54eec4[_0x5857ff(0x9f)],'reason':_0x315968[_0x5857ff(0x8c)],'repairCommand':REPAIR_COMMAND};try{const _0x10bd17=frontmatterValue(readFileSync(join(_0x315968['path'],_0x5857ff(0x79)),_0x5857ff(0x96)),'version');if(_0x10bd17!==_0x54eec4[_0x5857ff(0x7b)])return{'state':_0x5857ff(0xa4),'packageVersion':_0x54eec4[_0x5857ff(0x9f)],'skillVersion':_0x10bd17,'installedPath':_0x315968[_0x5857ff(0xa1)],'repairCommand':REPAIR_COMMAND};const _0x282a83=listFiles(_0x315968[_0x5857ff(0xa1)]),_0x39829c=digestFiles(_0x315968[_0x5857ff(0xa1)],_0x282a83);return{'state':sameFiles(_0x282a83,_0x54eec4['manifest'][_0x5857ff(0x70)])&&_0x39829c===_0x54eec4['manifest'][_0x5857ff(0xa0)]?'current':_0x5857ff(0xac),'packageVersion':_0x54eec4[_0x5857ff(0x9f)],'skillVersion':_0x10bd17,'installedPath':_0x315968[_0x5857ff(0xa1)],'digest':_0x39829c,'repairCommand':REPAIR_COMMAND};}catch(_0x58bfe0){return{'state':_0x5857ff(0x6f),'packageVersion':_0x54eec4[_0x5857ff(0x9f)],'installedPath':_0x315968[_0x5857ff(0xa1)],'reason':_0x58bfe0 instanceof Error?_0x58bfe0[_0x5857ff(0x8d)]:String(_0x58bfe0),'repairCommand':REPAIR_COMMAND};}}function failure(_0x35a8db,_0x489d7e,_0x4b1df2,_0x42ac4b){const _0xc85b96=a147_0x1d61b2;return{'ok':![],'code':_0x35a8db,'packageVersion':_0x489d7e['packageVersion'],'skillVersion':_0x489d7e[_0xc85b96(0x7b)],'installedPath':_0x42ac4b,'changed':![],'repairCommand':REPAIR_COMMAND,'error':_0x4b1df2 instanceof Error?_0x4b1df2[_0xc85b96(0x8d)]:String(_0x4b1df2)};}function a147_0x2ef8(_0x54b7b0,_0x4b88e1){_0x54b7b0=_0x54b7b0-0x6e;const _0x2dca61=a147_0x2dca();let _0x2ef889=_0x2dca61[_0x54b7b0];return _0x2ef889;}export function installBuiltinSkill(_0x137eb8={}){const _0x34202f=a147_0x1d61b2,_0x1781ff=_0x137eb8['packageRoot']??DEFAULT_PACKAGE_ROOT,_0xc71b4b=_0x137eb8['home']??homedir();let _0x5d302f;try{_0x5d302f=readSource(_0x1781ff);}catch(_0x826695){return failure('SOURCE_INVALID',{'packageVersion':'unknown','skillVersion':'unknown'},_0x826695);}const _0x336663=inspectBuiltinSkill({'packageRoot':_0x1781ff,'home':_0xc71b4b}),_0xfb3ec=runNpxSkillsAddGlobal(_0x1781ff,_0x5d302f[_0x34202f(0xa3)],{'stdio':_0x137eb8[_0x34202f(0x9d)]??'pipe','expectedSkillName':SKILL_NAME,'presence':{'home':_0xc71b4b}});if(_0xfb3ec['skipped'])return{'ok':!![],'packageVersion':_0x5d302f['packageVersion'],'skillVersion':_0x5d302f[_0x34202f(0x7b)],'installedPath':_0x336663[_0x34202f(0x98)],'changed':![],'repairCommand':REPAIR_COMMAND};if(!_0xfb3ec['ok'])return failure(_0x34202f(0x90),_0x5d302f,_0xfb3ec[_0x34202f(0x72)]??_0x34202f(0x74)+_0xfb3ec[_0x34202f(0xae)]);const _0x50b84a=inspectBuiltinSkill({'packageRoot':_0x1781ff,'home':_0xc71b4b});if(_0x50b84a[_0x34202f(0x83)]!==_0x34202f(0x9e)){const _0x2fe24d=_0x50b84a['reason']??_0x34202f(0x8b)+_0x50b84a['state'];return failure(_0x34202f(0x73),_0x5d302f,_0xfb3ec[_0x34202f(0x75)]?_0x2fe24d+'\x0a'+_0xfb3ec['partialFailure']['output']:_0x2fe24d,_0x50b84a[_0x34202f(0x98)]);}return _0xfb3ec[_0x34202f(0x75)]&&(debug(_0x34202f(0xb5),_0xfb3ec[_0x34202f(0x75)][_0x34202f(0x7e)]),console['log'](_0x34202f(0x9a)+_0x5d302f['skillVersion']+_0x34202f(0x99)+_0xfb3ec['partialFailure']['count']+_0x34202f(0x71))),{'ok':!![],'packageVersion':_0x5d302f[_0x34202f(0x9f)],'skillVersion':_0x5d302f[_0x34202f(0x7b)],'installedPath':_0x50b84a[_0x34202f(0x98)],'changed':_0x336663[_0x34202f(0x83)]!==_0x34202f(0x9e),'repairCommand':REPAIR_COMMAND};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a148_0x44f727=a148_0x3a86;function a148_0x3a86(_0x17f982,_0x4916cd){_0x17f982=_0x17f982-0x10b;const _0x3b58cc=a148_0x3b58();let _0x3a86c6=_0x3b58cc[_0x17f982];return _0x3a86c6;}(function(_0xc80974,_0x345a9a){const _0x4f3a89=a148_0x3a86,_0x1b4e9f=_0xc80974();while(!![]){try{const _0x50fb50=parseInt(_0x4f3a89(0x130))/0x1+-parseInt(_0x4f3a89(0x10e))/0x2+parseInt(_0x4f3a89(0x133))/0x3*(-parseInt(_0x4f3a89(0x119))/0x4)+parseInt(_0x4f3a89(0x10b))/0x5+parseInt(_0x4f3a89(0x12c))/0x6*(parseInt(_0x4f3a89(0x138))/0x7)+-parseInt(_0x4f3a89(0x128))/0x8*(-parseInt(_0x4f3a89(0x117))/0x9)+parseInt(_0x4f3a89(0x134))/0xa*(-parseInt(_0x4f3a89(0x111))/0xb);if(_0x50fb50===_0x345a9a)break;else _0x1b4e9f['push'](_0x1b4e9f['shift']());}catch(_0x560cde){_0x1b4e9f['push'](_0x1b4e9f['shift']());}}}(a148_0x3b58,0xd2082));import{execaSync}from'execa';import{LOVRABET_SKILL_SOURCE as a148_0x24993}from'../constant/distribution.js';import{PRODUCT_CONFIG,productEnvName}from'../constant/product.js';import{resolveInstalledSkill}from'../skills/skill-presence.js';export const LOVRABET_SKILL_SOURCE=a148_0x24993;export const LOVRABET_SKILL_GIT_SOURCE=PRODUCT_CONFIG[a148_0x44f727(0x12e)];export const LOVRABET_GLOBAL_SKILL_NAME=PRODUCT_CONFIG[a148_0x44f727(0x120)];export function resolveGlobalSkillName(_0x2344af){const _0x3f570b=a148_0x44f727;switch(_0x2344af[_0x3f570b(0x11e)]()){case LOVRABET_SKILL_SOURCE:case LOVRABET_SKILL_GIT_SOURCE:return LOVRABET_GLOBAL_SKILL_NAME;default:return undefined;}}export const LOVRABET_SKIP_NPX_SKILLS_ENV=productEnvName(PRODUCT_CONFIG[a148_0x44f727(0x10c)]);const CHILD_OUTPUT_MAX_BUFFER=0x10*0x400*0x400;function failure(_0x48970b,_0x22fd1f,_0x3d7401){return{'ok':![],'status':_0x22fd1f,'code':_0x48970b,'error':'['+_0x48970b+']\x20'+_0x3d7401};}export function shouldSkipNpxSkillsAdd(){return process.env[LOVRABET_SKIP_NPX_SKILLS_ENV]==='1';}function a148_0x3b58(){const _0x33a069=['partialFailure','stdout','present','message','pipe','112005oRPGZM','log','1355244BGghXh','absent','\x22\x20install\x20state:\x20','warn','presence','trim','exitCode','globalSkillName','NPM_CONFIG_GLOBAL','CHILD_EXIT_NONZERO','npx\x20failed\x20to\x20start','npx\x20terminated\x20by\x20signal\x20','code','unverifiable','Installer\x20reported\x20','96xOCTrc','filter','SKILL_NOT_INSTALLED','\x22\x20not\x20found\x20after\x20install\x20(checked\x20','707466buFQUg','expectedSkillName','internalSkillSource','signal','533481eSoYip','\x20failed\x20target(s)','join','3cSoHlv','810FUCVMA','shortMessage','failed','match','77DlbuYP','exit\x20','stdio','5332560gtPyBE','skipNpxSkillsEnvSuffix','stderr','1847868VHubBi','PERMISSION_DENIED','state','125389jxpSgK'];a148_0x3b58=function(){return _0x33a069;};return a148_0x3b58();}export function runNpxSkillsAddGlobal(_0x1d4848,_0x31c368=LOVRABET_SKILL_SOURCE,_0x4b31cf){const _0x11a2cd=a148_0x44f727;if(shouldSkipNpxSkillsAdd())return{'ok':!![],'status':0x0,'skipped':!![]};const _0x5082aa=['-y','skills@latest','add',_0x31c368,'-g','-y'],_0x270f83=['npx',..._0x5082aa][_0x11a2cd(0x132)]('\x20');console[_0x11a2cd(0x118)]('*\x20'+_0x270f83);const _0x193c28={...process.env};delete _0x193c28['npm_config_global'],delete _0x193c28[_0x11a2cd(0x121)];const _0x1a34bd=execaSync('npx',_0x5082aa,{'cwd':_0x1d4848,'stdio':_0x11a2cd(0x116),'env':_0x193c28,'extendEnv':![],'shell':![],'reject':![],'maxBuffer':CHILD_OUTPUT_MAX_BUFFER}),_0x458c3c=[_0x1a34bd[_0x11a2cd(0x113)]?String(_0x1a34bd['stdout']):'',_0x1a34bd[_0x11a2cd(0x10d)]?String(_0x1a34bd['stderr']):''][_0x11a2cd(0x129)](Boolean)[_0x11a2cd(0x132)]('\x0a')[_0x11a2cd(0x11e)](),_0x21bd27=_0x1a34bd[_0x11a2cd(0x11f)]??null,_0x28e134=_0x18e787=>{const _0x5c1ac7=_0x11a2cd;return _0x4b31cf?.[_0x5c1ac7(0x13a)]!==_0x5c1ac7(0x116)&&!_0x18e787[_0x5c1ac7(0x112)]&&_0x458c3c&&console['log'](_0x458c3c),_0x18e787;};if(_0x1a34bd[_0x11a2cd(0x125)]){const _0x4ceeda=_0x1a34bd[_0x11a2cd(0x125)]==='ENOENT'?'NPX_NOT_FOUND':_0x1a34bd[_0x11a2cd(0x125)]==='EPERM'||_0x1a34bd[_0x11a2cd(0x125)]==='EACCES'?_0x11a2cd(0x10f):'SPAWN_FAILED';return _0x28e134(failure(_0x4ceeda,_0x21bd27,_0x1a34bd['shortMessage']??_0x1a34bd[_0x11a2cd(0x115)]??_0x1a34bd[_0x11a2cd(0x125)]));}if(_0x1a34bd[_0x11a2cd(0x12f)])return _0x28e134(failure('CHILD_TERMINATED',_0x21bd27,_0x11a2cd(0x124)+_0x1a34bd['signal']));if(_0x1a34bd[_0x11a2cd(0x136)]&&_0x21bd27===null)return _0x28e134(failure('SPAWN_FAILED',_0x21bd27,_0x1a34bd[_0x11a2cd(0x135)]??_0x1a34bd[_0x11a2cd(0x115)]??_0x11a2cd(0x123)));if(_0x21bd27!==0x0)return _0x28e134(failure(_0x11a2cd(0x122),_0x21bd27,_0x458c3c||_0x1a34bd[_0x11a2cd(0x135)]||_0x11a2cd(0x139)+(_0x21bd27??'unknown')));const _0x2a686a=_0x4b31cf?.[_0x11a2cd(0x12d)]??resolveGlobalSkillName(_0x31c368),_0x20e442=_0x2a686a?resolveInstalledSkill(_0x2a686a,_0x4b31cf?.[_0x11a2cd(0x11d)]):undefined,_0xe9b3cc=_0x458c3c[_0x11a2cd(0x137)](/Failed to install\s+(\d+)/i);if(_0xe9b3cc&&Number(_0xe9b3cc[0x1])>0x0){const _0x29db8e=_0x11a2cd(0x127)+_0xe9b3cc[0x1]+_0x11a2cd(0x131)+(_0x458c3c?':\x0a'+_0x458c3c:'');if(_0x20e442?.[_0x11a2cd(0x110)]===_0x11a2cd(0x114))return{'ok':!![],'status':0x0,'partialFailure':{'count':Number(_0xe9b3cc[0x1]),'output':_0x458c3c}};return _0x28e134(failure('INSTALL_PARTIAL',0x0,_0x29db8e));}if(_0x2a686a&&_0x20e442){if(_0x20e442['state']===_0x11a2cd(0x11a))return _0x28e134(failure(_0x11a2cd(0x12a),0x0,'Skill\x20\x22'+_0x2a686a+_0x11a2cd(0x12b)+_0x20e442['checked'][_0x11a2cd(0x132)](',\x20')+')'));_0x20e442[_0x11a2cd(0x110)]===_0x11a2cd(0x126)&&console[_0x11a2cd(0x11c)]('!\x20Could\x20not\x20verify\x20\x22'+_0x2a686a+_0x11a2cd(0x11b)+_0x20e442['reason']);}return _0x28e134({'ok':!![],'status':0x0});}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
const a149_0x5d8c65=a149_0x116a;function a149_0x116a(_0x2a8fdb,_0x34f75c){_0x2a8fdb=_0x2a8fdb-0x149;const _0x175896=a149_0x1758();let _0x116a48=_0x175896[_0x2a8fdb];return _0x116a48;}(function(_0x47705c,_0x2e678a){const _0x837297=a149_0x116a,_0x5e9c81=_0x47705c();while(!![]){try{const _0x2d009d=-parseInt(_0x837297(0x15e))/0x1+-parseInt(_0x837297(0x155))/0x2*(-parseInt(_0x837297(0x14e))/0x3)+-parseInt(_0x837297(0x15b))/0x4+-parseInt(_0x837297(0x14a))/0x5*(parseInt(_0x837297(0x15a))/0x6)+parseInt(_0x837297(0x14c))/0x7*(parseInt(_0x837297(0x150))/0x8)+-parseInt(_0x837297(0x157))/0x9+parseInt(_0x837297(0x15f))/0xa*(parseInt(_0x837297(0x14d))/0xb);if(_0x2d009d===_0x2e678a)break;else _0x5e9c81['push'](_0x5e9c81['shift']());}catch(_0x597e27){_0x5e9c81['push'](_0x5e9c81['shift']());}}}(a149_0x1758,0x99fb4));export const METADATA_FILE=a149_0x5d8c65(0x14b);export const SKILL_FILE=a149_0x5d8c65(0x153);export const IGNORED_FILE_NAMES=new Set([METADATA_FILE,'.DS_Store']);function a149_0x1758(){const _0x3a6aa7=['8KMMiiB','.turbo','.hg','SKILL.md','.next','882MwgkHL','.git','10754298OfJSze','.cache','.svn','150tUrMcE','1228992mOIofY','coverage','build','152265PbwURe','116750bnqGjN','dist','81885DsSIBC','lovrabet.skill.json','9219UPvdBq','1837qiMsTA','5058lwmJcO','node_modules'];a149_0x1758=function(){return _0x3a6aa7;};return a149_0x1758();}export const IGNORED_DIR_NAMES=new Set([a149_0x5d8c65(0x156),a149_0x5d8c65(0x152),a149_0x5d8c65(0x159),a149_0x5d8c65(0x14f),a149_0x5d8c65(0x154),a149_0x5d8c65(0x149),a149_0x5d8c65(0x15d),a149_0x5d8c65(0x15c),a149_0x5d8c65(0x151),a149_0x5d8c65(0x158)]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a150_0x28da(){const _0x50407c=['Refusing\x20to\x20write\x20through\x20Skill\x20symlink\x20path:\x20','3YvSVMH','3106985QqgHvy','782772iKoWzr','27qteDHo','7430lGzOft','validation','10tLkTPR','425502nqbCzg','isSymbolicLink','from','17088bHayuS','utf8','endsWith','721384RXPeYS','402483igRCXb','startsWith','split','.tmp'];a150_0x28da=function(){return _0x50407c;};return a150_0x28da();}(function(_0xe9219,_0x1b499d){const _0x4910e2=a150_0x4a5b,_0xdae1c2=_0xe9219();while(!![]){try{const _0x41dfb9=parseInt(_0x4910e2(0x12d))/0x1+parseInt(_0x4910e2(0x126))/0x2+parseInt(_0x4910e2(0x132))/0x3*(-parseInt(_0x4910e2(0x121))/0x4)+parseInt(_0x4910e2(0x125))/0x5*(-parseInt(_0x4910e2(0x129))/0x6)+-parseInt(_0x4910e2(0x120))/0x7+parseInt(_0x4910e2(0x12c))/0x8*(parseInt(_0x4910e2(0x122))/0x9)+parseInt(_0x4910e2(0x123))/0xa;if(_0x41dfb9===_0x1b499d)break;else _0xdae1c2['push'](_0xdae1c2['shift']());}catch(_0x49f250){_0xdae1c2['push'](_0xdae1c2['shift']());}}}(a150_0x28da,0x3ae64));import{lstatSync,readlinkSync,realpathSync,renameSync,rmSync,writeFileSync}from'node:fs';import{dirname,isAbsolute,resolve,sep}from'node:path';import{CliErrors}from'../../errors.js';import{normalizeSkillRelativePath}from'./local-files.js';export function resolveManagedFilePath(_0x19a09e,_0x8ae57){const _0x5095f0=a150_0x4a5b,_0x2dc2d6=normalizeSkillRelativePath(_0x8ae57),_0x153750=realOrResolved(_0x19a09e),_0xcbb7ce=resolve(_0x153750,..._0x2dc2d6[_0x5095f0(0x12f)]('/'));if(!isPathInside(_0xcbb7ce,_0x153750))throw CliErrors[_0x5095f0(0x124)]('Unsafe\x20Skill\x20file\x20path:\x20'+_0x8ae57);return ensureNoSymlinkInManagedPath(_0x153750,_0x2dc2d6),_0xcbb7ce;}export function ensureNoSymlinkInManagedPath(_0x42838c,_0x59df85){const _0x1317e8=a150_0x4a5b;let _0x488988=_0x42838c;for(const _0x177502 of _0x59df85['split']('/')){_0x488988=resolve(_0x488988,_0x177502);const _0x1c156d=lstatIfPresent(_0x488988);if(_0x1c156d?.[_0x1317e8(0x127)]())throw CliErrors['validation'](_0x1317e8(0x131)+_0x59df85);}}export function isDanglingSymlink(_0x27ae45){try{return lstatSync(_0x27ae45)['isSymbolicLink']();}catch{return![];}}export function resolveSymlinkTarget(_0x4f931b){const _0xbc3362=readlinkSync(_0x4f931b);return isAbsolute(_0xbc3362)?_0xbc3362:resolve(dirname(_0x4f931b),_0xbc3362);}export function isPathInside(_0x236aa9,_0x9b7648){const _0x4c115a=a150_0x4a5b,_0x335f75=_0x236aa9[_0x4c115a(0x12b)](sep)?_0x236aa9:''+_0x236aa9+sep,_0x43bd17=_0x9b7648[_0x4c115a(0x12b)](sep)?_0x9b7648:''+_0x9b7648+sep;return _0x236aa9===_0x9b7648||_0x335f75[_0x4c115a(0x12e)](_0x43bd17);}export function realOrResolved(_0x5c6bdd){try{return realpathSync(_0x5c6bdd);}catch{return resolve(_0x5c6bdd);}}export function lstatIfPresent(_0x4204d6){try{return lstatSync(_0x4204d6);}catch{return undefined;}}export function writeTextAtomic(_0x149eb5,_0x426fb9,_0x486554){const _0x28682e=a150_0x4a5b;writeBytesAtomic(_0x149eb5,Buffer[_0x28682e(0x128)](_0x426fb9,_0x28682e(0x12a)),_0x486554);}export function writeBytesAtomic(_0x5945c2,_0x4da095,_0x40f5cd){const _0x4ecb10=a150_0x4a5b,_0x5d2ff9=_0x5945c2+_0x4ecb10(0x130);try{writeFileSync(_0x5d2ff9,_0x4da095,{'mode':_0x40f5cd}),renameSync(_0x5d2ff9,_0x5945c2);}catch(_0x36b567){try{rmSync(_0x5d2ff9,{'force':!![]});}catch{}throw _0x36b567;}}function a150_0x4a5b(_0x3314f8,_0x109c87){_0x3314f8=_0x3314f8-0x120;const _0x28da51=a150_0x28da();let _0x4a5bfa=_0x28da51[_0x3314f8];return _0x4a5bfa;}export function writeJsonAtomic(_0x5d8fee,_0x3214ee){writeTextAtomic(_0x5d8fee,JSON['stringify'](_0x3214ee,null,0x2)+'\x0a',0x180);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x3315f9,_0x3a346e){const _0x5a4523=a151_0x1091,_0x5cadeb=_0x3315f9();while(!![]){try{const _0x2d4d67=parseInt(_0x5a4523(0x17e))/0x1*(parseInt(_0x5a4523(0x17c))/0x2)+parseInt(_0x5a4523(0x17d))/0x3*(parseInt(_0x5a4523(0x17a))/0x4)+parseInt(_0x5a4523(0x180))/0x5+-parseInt(_0x5a4523(0x177))/0x6+parseInt(_0x5a4523(0x182))/0x7+parseInt(_0x5a4523(0x17f))/0x8*(parseInt(_0x5a4523(0x184))/0x9)+parseInt(_0x5a4523(0x181))/0xa*(-parseInt(_0x5a4523(0x178))/0xb);if(_0x2d4d67===_0x3a346e)break;else _0x5cadeb['push'](_0x5cadeb['shift']());}catch(_0x16f524){_0x5cadeb['push'](_0x5cadeb['shift']());}}}(a151_0x20bd,0xc558d));import{createHash}from'node:crypto';import{fileContent,normalizeManifestFiles}from'./local-files.js';export function contentHash(_0x2e7134){const _0x19b337=a151_0x1091;return createHash(_0x19b337(0x186))[_0x19b337(0x17b)](_0x2e7134)[_0x19b337(0x187)]('hex');}export function fileHash(_0x395b36){return bufferSha256(fileContent(_0x395b36));}function a151_0x20bd(){const _0x2dca1f=['update','46zwVetb','3ODBzDF','41091onHRbS','188608qSnMGS','1725505IjDZdp','10XbZekF','1707328SskOsz','size','27COFhIx','hex','sha256','digest','440886muapHq','8593145lLkqdh','path','232732hyRRWM'];a151_0x20bd=function(){return _0x2dca1f;};return a151_0x20bd();}export function bufferSha256(_0x2ff7d9){return createHash('sha256')['update'](_0x2ff7d9)['digest']('hex');}function a151_0x1091(_0x38d93f,_0x583e48){_0x38d93f=_0x38d93f-0x177;const _0x20bd5b=a151_0x20bd();let _0x109130=_0x20bd5b[_0x38d93f];return _0x109130;}export function fileTreeHash(_0x5286f4){const _0x3c954e=a151_0x1091,_0x19fe98=createHash(_0x3c954e(0x186));for(const _0x5a7dad of normalizeManifestFiles(_0x5286f4)){_0x19fe98[_0x3c954e(0x17b)](_0x5a7dad[_0x3c954e(0x179)]),_0x19fe98[_0x3c954e(0x17b)]('\x00'),_0x19fe98[_0x3c954e(0x17b)](_0x5a7dad['sha256']),_0x19fe98[_0x3c954e(0x17b)]('\x00'),_0x19fe98[_0x3c954e(0x17b)](String(_0x5a7dad[_0x3c954e(0x183)])),_0x19fe98[_0x3c954e(0x17b)]('\x00');}return _0x19fe98[_0x3c954e(0x187)](_0x3c954e(0x185));}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a152_0x405c6d=a152_0x582c;function a152_0x582c(_0x1a87ec,_0x1a1534){_0x1a87ec=_0x1a87ec-0x1b7;const _0x5ebe75=a152_0x5ebe();let _0x582c4f=_0x5ebe75[_0x1a87ec];return _0x582c4f;}function a152_0x5ebe(){const _0x3f411b=['6342720KvelcC','cwd','651QiWetv','21LHxvnF','project','6262cucYSd','146008volvgQ','286uKbDvM','9459024GGVhFY','7130598imBAhp','freeze','736DOURta','appCode','skills','.agents','global','10107lzBjrB','6360ALvxTh','44yWigmI'];a152_0x5ebe=function(){return _0x3f411b;};return a152_0x5ebe();}(function(_0x128484,_0x404953){const _0x2a10e0=a152_0x582c,_0x4690cd=_0x128484();while(!![]){try{const _0x3d999b=parseInt(_0x2a10e0(0x1c4))/0x1*(parseInt(_0x2a10e0(0x1c6))/0x2)+-parseInt(_0x2a10e0(0x1c2))/0x3*(parseInt(_0x2a10e0(0x1c5))/0x4)+parseInt(_0x2a10e0(0x1bf))/0x5+parseInt(_0x2a10e0(0x1c8))/0x6+parseInt(_0x2a10e0(0x1c1))/0x7*(-parseInt(_0x2a10e0(0x1b7))/0x8)+parseInt(_0x2a10e0(0x1bc))/0x9*(parseInt(_0x2a10e0(0x1bd))/0xa)+-parseInt(_0x2a10e0(0x1be))/0xb*(parseInt(_0x2a10e0(0x1c7))/0xc);if(_0x3d999b===_0x404953)break;else _0x4690cd['push'](_0x4690cd['shift']());}catch(_0x2f2828){_0x4690cd['push'](_0x4690cd['shift']());}}}(a152_0x5ebe,0x9e979));import{resolve}from'node:path';import{resolveSkillSyncPaths,runtimeAgentSkillRoots,safePathSegment}from'./paths.js';export function resolveRuntimeSkillInstallTarget(_0x5a68d0,_0x1c587c=a152_0x405c6d(0x1bb),_0x358e97={}){const _0x17ac15=a152_0x405c6d,_0x193126=resolveSkillSyncPaths(_0x358e97),_0x28d1bd=safePathSegment(_0x5a68d0,_0x17ac15(0x1b8)),_0x91eaf1=_0x1c587c===_0x17ac15(0x1c3)?[resolve(_0x358e97[_0x17ac15(0x1c0)]??process[_0x17ac15(0x1c0)](),_0x17ac15(0x1ba),_0x17ac15(0x1b9))]:runtimeAgentSkillRoots(_0x193126);return Object[_0x17ac15(0x1c9)]({'scope':_0x1c587c,'appCode':_0x28d1bd,'skillRoots':Object['freeze'](_0x91eaf1),'managedRoot':_0x193126['managedRoot']});}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function a150_0x129e(_0x31ed2b,_0x150bd1){_0x31ed2b=_0x31ed2b-0x73;const _0x71b9cd=a150_0x71b9();let _0x129ee3=_0x71b9cd[_0x31ed2b];return _0x129ee3;}const a150_0x5e53cf=a150_0x129e;(function(_0x3695f3,_0x3073b5){const _0x2ed0dc=a150_0x129e,_0x2cc945=_0x3695f3();while(!![]){try{const _0x54d9fa=-parseInt(_0x2ed0dc(0xa7))/0x1+-parseInt(_0x2ed0dc(0x8b))/0x2*(-parseInt(_0x2ed0dc(0xad))/0x3)+parseInt(_0x2ed0dc(0xa8))/0x4*(-parseInt(_0x2ed0dc(0x9a))/0x5)+parseInt(_0x2ed0dc(0x98))/0x6+-parseInt(_0x2ed0dc(0x79))/0x7+parseInt(_0x2ed0dc(0xa3))/0x8+parseInt(_0x2ed0dc(0x93))/0x9;if(_0x54d9fa===_0x3073b5)break;else _0x2cc945['push'](_0x2cc945['shift']());}catch(_0x4f847d){_0x2cc945['push'](_0x2cc945['shift']());}}}(a150_0x71b9,0x442b5));import{existsSync,lstatSync,mkdirSync,readdirSync,symlinkSync,unlinkSync}from'node:fs';import{basename,dirname,resolve}from'node:path';import a150_0x51c6ba from'fs-extra';import{CliErrors}from'../../errors.js';import{METADATA_FILE}from'./constants.js';import{isDanglingSymlink,isPathInside,lstatIfPresent,realOrResolved,resolveSymlinkTarget}from'./fs-utils.js';import{readMetadataIfPresent,requireSkillCode}from'./metadata.js';import{getRuntimeSkillCacheRoot,resolveSkillSyncPaths,safePathSegment}from'./paths.js';const {copySync,ensureDirSync,removeSync}=a150_0x51c6ba,RESERVED_PROJECT_SKILL_CODES=new Set([a150_0x5e53cf(0xaa),'runtime-observe','secret-retriever']);export function linkEffectiveRuntimeSkills(_0x1a8038,_0x1fe487){const _0x746d7f=a150_0x5e53cf,_0xc6cf92=new Map();for(const _0x569db0 of _0x1a8038){const _0x19605e=_0x569db0[_0x746d7f(0xa5)][_0x746d7f(0xa1)];if(!_0x19605e)continue;const _0xdd3be2=_0xc6cf92[_0x746d7f(0x99)](_0x19605e);(!_0xdd3be2||_0x569db0[_0x746d7f(0x77)]==='personal')&&_0xc6cf92[_0x746d7f(0xa9)](_0x19605e,_0x569db0);}const _0x5bd7bd=[];for(const _0x207920 of _0xc6cf92[_0x746d7f(0x94)]()){const _0x390cfa=requireSkillCode(_0x207920[_0x746d7f(0xa5)]),_0x70339c=readMetadataIfPresent(_0x207920['metadataPath']);if(_0x70339c?.[_0x746d7f(0x9f)]!==_0x1fe487['appCode']||_0x70339c[_0x746d7f(0xa1)]!==_0x390cfa)throw CliErrors[_0x746d7f(0x86)]('Refusing\x20to\x20link\x20Skill\x20metadata\x20outside\x20target\x20'+_0x1fe487['appCode']+':\x20'+_0x207920[_0x746d7f(0x7a)]);const _0x599983=runtimeSkillLinkName(_0x1fe487,_0x390cfa);for(const _0x10ded4 of _0x1fe487[_0x746d7f(0x9c)]){_0x5bd7bd[_0x746d7f(0x88)](ensureManagedSymlink(resolve(_0x10ded4,_0x599983),_0x207920[_0x746d7f(0x89)],_0x1fe487,_0x390cfa));}}return _0x5bd7bd;}export function pruneStaleRuntimeSkillLinks(_0x35601f,_0x4d5bdc,_0xf962ba){const _0x3e443e=a150_0x5e53cf,_0x592d07=new Set([..._0x4d5bdc]['map'](_0x214670=>_0x214670['trim']())['filter'](Boolean)),_0x120709=_0xf962ba?new Set([..._0xf962ba][_0x3e443e(0x83)](_0x3e7fae=>_0x3e7fae[_0x3e443e(0x7e)]())['filter'](Boolean)):undefined,_0x3821c4=[];for(const _0x158980 of _0x35601f[_0x3e443e(0x9c)]){for(const _0x359122 of managedTargetSkillLinkPaths(_0x158980,_0x35601f)){const _0x222b7c=runtimeSkillCodeFromLink(_0x35601f,_0x359122);if(_0x120709&&!_0x120709[_0x3e443e(0x8d)](_0x222b7c))continue;if(_0x592d07[_0x3e443e(0x8d)](_0x222b7c))continue;_0x3821c4[_0x3e443e(0x88)](removeManagedSkillLink(_0x359122,_0x35601f,_0x222b7c));}}return _0x3821c4;}export function pruneStaleRuntimeSkillCache(_0x33b0ea,_0x3e385c={}){const _0x4ad17a=a150_0x5e53cf,_0x41a931=new Set([..._0x33b0ea['activeSkillCodes']][_0x4ad17a(0x83)](_0x16ab00=>_0x16ab00[_0x4ad17a(0x7e)]())[_0x4ad17a(0x9e)](Boolean)),_0x11a125=_0x33b0ea[_0x4ad17a(0x91)]?new Set([..._0x33b0ea[_0x4ad17a(0x91)]][_0x4ad17a(0x83)](_0x6417e2=>_0x6417e2[_0x4ad17a(0x7e)]())[_0x4ad17a(0x9e)](Boolean)):undefined,_0x14431c=_0x33b0ea['scopes']??[_0x4ad17a(0x7f),_0x4ad17a(0xa4)],_0x1155b8=resolve(getRuntimeSkillCacheRoot(_0x33b0ea[_0x4ad17a(0x87)],_0x33b0ea[_0x4ad17a(0x8c)],_0x3e385c),safePathSegment(_0x33b0ea[_0x4ad17a(0x9f)],_0x4ad17a(0x9f))),_0xf1dd77=[];for(const _0x216c8c of _0x14431c){const _0x3db252=resolve(_0x1155b8,_0x216c8c);if(!existsSync(_0x3db252))continue;for(const _0x1341c0 of readdirSync(_0x3db252,{'withFileTypes':!![]})){if(!_0x1341c0['isDirectory']())continue;const _0x260bdd=_0x1341c0['name'];if(_0x11a125&&!_0x11a125[_0x4ad17a(0x8d)](_0x260bdd))continue;if(_0x41a931[_0x4ad17a(0x8d)](_0x260bdd))continue;const _0x3fecbe=resolve(_0x3db252,_0x260bdd),_0x2562de=readMetadataIfPresent(resolve(_0x3fecbe,METADATA_FILE));if(_0x2562de?.['appCode']!==_0x33b0ea[_0x4ad17a(0x9f)]||_0x2562de['scope']!==_0x216c8c||_0x2562de[_0x4ad17a(0xa1)]!==_0x260bdd){_0xf1dd77[_0x4ad17a(0x88)]({'path':_0x3fecbe,'action':_0x4ad17a(0x90),'reason':_0x4ad17a(0x76)});continue;}if(isLinkedFromAnyRoot(_0x3fecbe,_0x33b0ea[_0x4ad17a(0x73)]??[])){_0xf1dd77['push']({'path':_0x3fecbe,'action':_0x4ad17a(0x90),'reason':_0x4ad17a(0x9b)});continue;}removeSync(_0x3fecbe),_0xf1dd77[_0x4ad17a(0x88)]({'path':_0x3fecbe,'action':_0x4ad17a(0x75)});}}return _0xf1dd77;}export function linkGlobalRuntimeSkills(_0xc7477b,_0x49b36e={}){const _0x2348bb=a150_0x5e53cf,_0x452ce7=resolveSkillSyncPaths(_0x49b36e),_0x45d86c=[];for(const _0x48b852 of _0xc7477b){if(_0x48b852[_0x2348bb(0x77)]!==_0x2348bb(0x92))throw CliErrors[_0x2348bb(0x86)](_0x2348bb(0xac)+_0x48b852[_0x2348bb(0x77)]);const _0x38b843=requireSkillCode(_0x48b852[_0x2348bb(0xa5)]),_0x1b1ab9=copyManagedSkillDirectory(_0x48b852[_0x2348bb(0x89)],resolve(_0x452ce7[_0x2348bb(0x97)],_0x38b843));_0x45d86c['push']({..._0x1b1ab9,'contentHash':_0x48b852[_0x2348bb(0x8e)]});}return _0x45d86c;}function ensureManagedSymlink(_0x416a53,_0x46ba5b,_0x1db66d,_0x184245){const _0x36426e=a150_0x5e53cf;mkdirSync(dirname(_0x416a53),{'recursive':!![],'mode':0x1c0});if(existsSync(_0x416a53)||isDanglingSymlink(_0x416a53)){const _0x40b2f4=lstatSync(_0x416a53);if(!_0x40b2f4[_0x36426e(0x80)]())throw CliErrors[_0x36426e(0x86)](_0x36426e(0x7c)+_0x416a53);const _0x369182=resolveSymlinkTarget(_0x416a53);if(!isPathInside(realOrResolved(_0x369182),realOrResolved(_0x1db66d[_0x36426e(0x85)])))throw CliErrors['validation'](_0x36426e(0x9d)+_0x416a53);if(realOrResolved(_0x369182)===realOrResolved(_0x46ba5b))return{'path':_0x416a53,'target':_0x46ba5b,'action':_0x36426e(0xa2)};const _0xe0950e=readMetadataIfPresent(resolve(_0x369182,METADATA_FILE));if(_0x1db66d['scope']===_0x36426e(0x95)&&(_0xe0950e?.[_0x36426e(0x9f)]!==_0x1db66d[_0x36426e(0x9f)]||_0xe0950e['skillCode']!==_0x184245))throw CliErrors[_0x36426e(0x86)](_0x36426e(0x78)+_0x416a53);return unlinkSync(_0x416a53),symlinkSync(_0x46ba5b,_0x416a53,_0x36426e(0x89)),{'path':_0x416a53,'target':_0x46ba5b,'action':_0x36426e(0x84)};}return symlinkSync(_0x46ba5b,_0x416a53,'dir'),{'path':_0x416a53,'target':_0x46ba5b,'action':_0x36426e(0xab)};}function managedTargetSkillLinkPaths(_0x563bd7,_0x346dd2){const _0x3cd64f=a150_0x5e53cf;if(!existsSync(_0x563bd7))return[];const _0x20b369=_0x346dd2[_0x3cd64f(0x9f)]+'--';return readdirSync(_0x563bd7,{'withFileTypes':!![]})[_0x3cd64f(0x9e)](_0x5d3619=>_0x346dd2[_0x3cd64f(0x77)]===_0x3cd64f(0x95)||_0x5d3619['name'][_0x3cd64f(0x74)](_0x20b369))[_0x3cd64f(0x83)](_0xb6a79f=>resolve(_0x563bd7,_0xb6a79f[_0x3cd64f(0x82)]));}function removeManagedSkillLink(_0x5407df,_0x2ffdd8,_0x39ed6b){const _0x4ab44b=a150_0x5e53cf,_0x23256a=lstatIfPresent(_0x5407df);if(!_0x23256a?.[_0x4ab44b(0x80)]())return{'path':_0x5407df,'action':'skipped','reason':_0x4ab44b(0x7b)};const _0x4da80b=resolveSymlinkTarget(_0x5407df);if(!isPathInside(realOrResolved(_0x4da80b),realOrResolved(_0x2ffdd8[_0x4ab44b(0x85)])))return{'path':_0x5407df,'action':_0x4ab44b(0x90),'reason':'external-symlink'};const _0x4a6f17=readMetadataIfPresent(resolve(_0x4da80b,METADATA_FILE));if(_0x2ffdd8[_0x4ab44b(0x77)]===_0x4ab44b(0x95)&&(_0x4a6f17?.[_0x4ab44b(0x9f)]!==_0x2ffdd8['appCode']||_0x4a6f17[_0x4ab44b(0xa1)]!==_0x39ed6b))return{'path':_0x5407df,'action':_0x4ab44b(0x90),'reason':_0x4ab44b(0x76)};return unlinkSync(_0x5407df),{'path':_0x5407df,'action':_0x4ab44b(0x75)};}function isLinkedFromAnyRoot(_0x5d359c,_0x21db66){const _0x5b7548=a150_0x5e53cf,_0x355dd1=realOrResolved(_0x5d359c);for(const _0x3f2e6d of _0x21db66){if(!existsSync(_0x3f2e6d))continue;for(const _0xfb812e of readdirSync(_0x3f2e6d,{'withFileTypes':!![]})){if(!_0xfb812e[_0x5b7548(0x80)]())continue;const _0x178638=resolve(_0x3f2e6d,_0xfb812e[_0x5b7548(0x82)]);if(realOrResolved(resolveSymlinkTarget(_0x178638))===_0x355dd1)return!![];}}return![];}function runtimeSkillLinkName(_0x169ada,_0x47ac12){const _0xf61f4c=a150_0x5e53cf,_0x1175a9=safePathSegment(_0x47ac12,_0xf61f4c(0xa1));if(_0x169ada[_0xf61f4c(0x77)]===_0xf61f4c(0x95)&&RESERVED_PROJECT_SKILL_CODES['has'](_0x1175a9))throw CliErrors[_0xf61f4c(0x86)](_0xf61f4c(0xa0)+_0x1175a9);return _0x169ada[_0xf61f4c(0x77)]==='project'?_0x1175a9:_0x169ada[_0xf61f4c(0x9f)]+'--'+_0x1175a9;}function a150_0x71b9(){const _0x3a29c7=['appCode','Refusing\x20to\x20shadow\x20reserved\x20Agent\x20Skill\x20in\x20project\x20scope:\x20','skillCode','unchanged','1543688JLOOeV','company','skill','Refusing\x20to\x20copy\x20Skill\x20symlink:\x20','226262dTmipA','289924FIxlbS','set','lovrabet','created','Only\x20builtin\x20Skills\x20can\x20be\x20linked\x20into\x20the\x20global\x20Skill\x20root:\x20','360CAiJVS','isDirectory','protectedLinkRoots','startsWith','removed','metadata-mismatch','scope','Refusing\x20to\x20overwrite\x20managed\x20Skill\x20link\x20owned\x20by\x20another\x20app\x20or\x20code:\x20','2958228yNHtyq','metadataPath','not-managed-symlink','Refusing\x20to\x20overwrite\x20unmanaged\x20path:\x20','Refusing\x20to\x20overwrite\x20unmanaged\x20global\x20Skill\x20directory:\x20','trim','personal','isSymbolicLink','Refusing\x20to\x20overwrite\x20global\x20Skill\x20path:\x20','name','map','updated','managedRoot','validation','env','push','dir','Refusing\x20to\x20overwrite\x20global\x20Skill\x20symlink:\x20','6060ZRjlSN','accessKey','has','contentHash','length','skipped','pruneSkillCodes','builtin','1509390GnOGPm','values','project','slice','agentsSkillsDir','1657782hOClwa','get','5LNsbfb','linked-from-protected-root','skillRoots','Refusing\x20to\x20overwrite\x20unmanaged\x20symlink:\x20','filter'];a150_0x71b9=function(){return _0x3a29c7;};return a150_0x71b9();}function runtimeSkillCodeFromLink(_0x2ac5e9,_0x32c237){const _0x7a348b=a150_0x5e53cf,_0x1395ba=basename(_0x32c237);return _0x2ac5e9[_0x7a348b(0x77)]==='project'?_0x1395ba:_0x1395ba[_0x7a348b(0x96)]((_0x2ac5e9['appCode']+'--')[_0x7a348b(0x8f)]);}export function copyManagedSkillDirectory(_0x52a753,_0x389f30){const _0x2088f8=a150_0x5e53cf,_0x5118e0=resolve(_0x389f30,METADATA_FILE),_0x1ab6f5=existsSync(_0x389f30);if(_0x1ab6f5){const _0x17274d=lstatSync(_0x389f30);if(_0x17274d[_0x2088f8(0x80)]())throw CliErrors[_0x2088f8(0x86)](_0x2088f8(0x8a)+_0x389f30);if(!_0x17274d[_0x2088f8(0xae)]())throw CliErrors[_0x2088f8(0x86)](_0x2088f8(0x81)+_0x389f30);const _0x459d2f=readMetadataIfPresent(_0x5118e0);if(_0x459d2f?.[_0x2088f8(0x77)]!==_0x2088f8(0x92))throw CliErrors[_0x2088f8(0x86)](_0x2088f8(0x7d)+_0x389f30);}ensureDirSync(dirname(_0x389f30));const _0x4ee5df=_0x1ab6f5?readMetadataIfPresent(_0x5118e0)?.[_0x2088f8(0x8e)]:undefined,_0x3bebaf=readMetadataIfPresent(resolve(_0x52a753,METADATA_FILE))?.[_0x2088f8(0x8e)];return _0x1ab6f5&&removeSync(_0x389f30),copySkillDirectory(_0x52a753,_0x389f30),{'path':_0x389f30,'target':_0x52a753,'action':!_0x1ab6f5?_0x2088f8(0xab):_0x4ee5df===_0x3bebaf?_0x2088f8(0xa2):_0x2088f8(0x84)};}function copySkillDirectory(_0x15c090,_0x384db5){copySync(_0x15c090,_0x384db5,{'dereference':![],'overwrite':!![],'filter'(_0x30bc67){const _0x48da94=a150_0x129e;if(lstatSync(_0x30bc67)[_0x48da94(0x80)]())throw CliErrors[_0x48da94(0x86)](_0x48da94(0xa6)+_0x30bc67);return!![];}});}
|
|
1
|
+
function a153_0x51f9(_0x4752fc,_0x33dbaf){_0x4752fc=_0x4752fc-0x138;const _0x26ad3b=a153_0x26ad();let _0x51f94c=_0x26ad3b[_0x4752fc];return _0x51f94c;}(function(_0x4af788,_0x51fade){const _0x438772=a153_0x51f9,_0x3b5797=_0x4af788();while(!![]){try{const _0x5900b5=-parseInt(_0x438772(0x141))/0x1+parseInt(_0x438772(0x15c))/0x2*(parseInt(_0x438772(0x14d))/0x3)+parseInt(_0x438772(0x151))/0x4*(-parseInt(_0x438772(0x146))/0x5)+parseInt(_0x438772(0x148))/0x6*(-parseInt(_0x438772(0x16a))/0x7)+-parseInt(_0x438772(0x166))/0x8+parseInt(_0x438772(0x13f))/0x9+parseInt(_0x438772(0x14f))/0xa;if(_0x5900b5===_0x51fade)break;else _0x3b5797['push'](_0x3b5797['shift']());}catch(_0x32e5cd){_0x3b5797['push'](_0x3b5797['shift']());}}}(a153_0x26ad,0x63ff9));import{existsSync,lstatSync,mkdirSync,readdirSync,symlinkSync,unlinkSync}from'node:fs';function a153_0x26ad(){const _0x224f64=['isSymbolicLink','push','validation','name','isDirectory','managedRoot','values','personal','skill','2XAouio','updated','metadata-mismatch','scope','external-symlink','Refusing\x20to\x20shadow\x20reserved\x20Agent\x20Skill\x20in\x20project\x20scope:\x20','dir','not-managed-symlink','metadataPath','has','3081592uqHhtN','set','project','env','7ufiTct','scopes','Refusing\x20to\x20link\x20Skill\x20metadata\x20outside\x20target\x20','appCode','startsWith','skipped','Refusing\x20to\x20overwrite\x20unmanaged\x20symlink:\x20','accessKey','Refusing\x20to\x20overwrite\x20global\x20Skill\x20path:\x20','company','Refusing\x20to\x20copy\x20Skill\x20symlink:\x20','activeSkillCodes','Only\x20builtin\x20Skills\x20can\x20be\x20linked\x20into\x20the\x20global\x20Skill\x20root:\x20','map','skillRoots','2904291EjJJVr','builtin','83502ClYKuH','length','Refusing\x20to\x20overwrite\x20global\x20Skill\x20symlink:\x20','filter','unchanged','3415GTImVp','pruneSkillCodes','2268924iwqHYg','contentHash','Refusing\x20to\x20overwrite\x20unmanaged\x20path:\x20','get','trim','152157pVIcjw','created','11213970rlQJcZ','protectedLinkRoots','1396iEnTtw','skillCode'];a153_0x26ad=function(){return _0x224f64;};return a153_0x26ad();}import{basename,dirname,resolve}from'node:path';import a153_0x609949 from'fs-extra';import{CliErrors}from'../../errors.js';import{METADATA_FILE}from'./constants.js';import{isDanglingSymlink,isPathInside,lstatIfPresent,realOrResolved,resolveSymlinkTarget}from'./fs-utils.js';import{readMetadataIfPresent,requireSkillCode}from'./metadata.js';import{getRuntimeSkillCacheRoot,resolveSkillSyncPaths,safePathSegment}from'./paths.js';const {copySync,ensureDirSync,removeSync}=a153_0x609949,RESERVED_PROJECT_SKILL_CODES=new Set(['lovrabet','runtime-observe','secret-retriever']);export function linkEffectiveRuntimeSkills(_0x255057,_0x2370ef){const _0x3a497d=a153_0x51f9,_0x1ad881=new Map();for(const _0x438609 of _0x255057){const _0x7d0b14=_0x438609[_0x3a497d(0x15b)][_0x3a497d(0x152)];if(!_0x7d0b14)continue;const _0x4c90e3=_0x1ad881[_0x3a497d(0x14b)](_0x7d0b14);(!_0x4c90e3||_0x438609['scope']===_0x3a497d(0x15a))&&_0x1ad881[_0x3a497d(0x167)](_0x7d0b14,_0x438609);}const _0x1e471b=[];for(const _0x800dc4 of _0x1ad881[_0x3a497d(0x159)]()){const _0x529931=requireSkillCode(_0x800dc4[_0x3a497d(0x15b)]),_0x36eb07=readMetadataIfPresent(_0x800dc4['metadataPath']);if(_0x36eb07?.[_0x3a497d(0x16d)]!==_0x2370ef[_0x3a497d(0x16d)]||_0x36eb07[_0x3a497d(0x152)]!==_0x529931)throw CliErrors['validation'](_0x3a497d(0x16c)+_0x2370ef[_0x3a497d(0x16d)]+':\x20'+_0x800dc4[_0x3a497d(0x164)]);const _0x325c10=runtimeSkillLinkName(_0x2370ef,_0x529931);for(const _0x1f5ae8 of _0x2370ef[_0x3a497d(0x13e)]){_0x1e471b['push'](ensureManagedSymlink(resolve(_0x1f5ae8,_0x325c10),_0x800dc4[_0x3a497d(0x162)],_0x2370ef,_0x529931));}}return _0x1e471b;}export function pruneStaleRuntimeSkillLinks(_0x2878b1,_0x30172a,_0x51be02){const _0x2600ff=a153_0x51f9,_0x1dcacd=new Set([..._0x30172a][_0x2600ff(0x13d)](_0x241302=>_0x241302[_0x2600ff(0x14c)]())[_0x2600ff(0x144)](Boolean)),_0x194384=_0x51be02?new Set([..._0x51be02][_0x2600ff(0x13d)](_0x2197de=>_0x2197de[_0x2600ff(0x14c)]())[_0x2600ff(0x144)](Boolean)):undefined,_0x332939=[];for(const _0x413520 of _0x2878b1[_0x2600ff(0x13e)]){for(const _0x517a94 of managedTargetSkillLinkPaths(_0x413520,_0x2878b1)){const _0x1b2522=runtimeSkillCodeFromLink(_0x2878b1,_0x517a94);if(_0x194384&&!_0x194384[_0x2600ff(0x165)](_0x1b2522))continue;if(_0x1dcacd[_0x2600ff(0x165)](_0x1b2522))continue;_0x332939[_0x2600ff(0x154)](removeManagedSkillLink(_0x517a94,_0x2878b1,_0x1b2522));}}return _0x332939;}export function pruneStaleRuntimeSkillCache(_0xc235ec,_0x1afbf0={}){const _0x6047bf=a153_0x51f9,_0x3a2a44=new Set([..._0xc235ec[_0x6047bf(0x13b)]]['map'](_0x5f566c=>_0x5f566c[_0x6047bf(0x14c)]())[_0x6047bf(0x144)](Boolean)),_0x1d2375=_0xc235ec[_0x6047bf(0x147)]?new Set([..._0xc235ec[_0x6047bf(0x147)]][_0x6047bf(0x13d)](_0x3991eb=>_0x3991eb[_0x6047bf(0x14c)]())['filter'](Boolean)):undefined,_0x4ad6bd=_0xc235ec[_0x6047bf(0x16b)]??[_0x6047bf(0x15a),_0x6047bf(0x139)],_0x8870b2=resolve(getRuntimeSkillCacheRoot(_0xc235ec[_0x6047bf(0x169)],_0xc235ec[_0x6047bf(0x171)],_0x1afbf0),safePathSegment(_0xc235ec[_0x6047bf(0x16d)],_0x6047bf(0x16d))),_0x4226fe=[];for(const _0x1ea0c8 of _0x4ad6bd){const _0x328e0c=resolve(_0x8870b2,_0x1ea0c8);if(!existsSync(_0x328e0c))continue;for(const _0x2b1e8f of readdirSync(_0x328e0c,{'withFileTypes':!![]})){if(!_0x2b1e8f[_0x6047bf(0x157)]())continue;const _0x5a5e96=_0x2b1e8f[_0x6047bf(0x156)];if(_0x1d2375&&!_0x1d2375[_0x6047bf(0x165)](_0x5a5e96))continue;if(_0x3a2a44['has'](_0x5a5e96))continue;const _0x39cd4f=resolve(_0x328e0c,_0x5a5e96),_0x1daea7=readMetadataIfPresent(resolve(_0x39cd4f,METADATA_FILE));if(_0x1daea7?.['appCode']!==_0xc235ec[_0x6047bf(0x16d)]||_0x1daea7[_0x6047bf(0x15f)]!==_0x1ea0c8||_0x1daea7[_0x6047bf(0x152)]!==_0x5a5e96){_0x4226fe['push']({'path':_0x39cd4f,'action':_0x6047bf(0x16f),'reason':_0x6047bf(0x15e)});continue;}if(isLinkedFromAnyRoot(_0x39cd4f,_0xc235ec[_0x6047bf(0x150)]??[])){_0x4226fe['push']({'path':_0x39cd4f,'action':'skipped','reason':'linked-from-protected-root'});continue;}removeSync(_0x39cd4f),_0x4226fe['push']({'path':_0x39cd4f,'action':'removed'});}}return _0x4226fe;}export function linkGlobalRuntimeSkills(_0x277ce0,_0x3135d9={}){const _0x3dbef9=a153_0x51f9,_0x2c86ad=resolveSkillSyncPaths(_0x3135d9),_0xd4371b=[];for(const _0x4bed66 of _0x277ce0){if(_0x4bed66[_0x3dbef9(0x15f)]!=='builtin')throw CliErrors[_0x3dbef9(0x155)](_0x3dbef9(0x13c)+_0x4bed66[_0x3dbef9(0x15f)]);const _0x5f05ef=requireSkillCode(_0x4bed66[_0x3dbef9(0x15b)]),_0x3988c2=copyManagedSkillDirectory(_0x4bed66[_0x3dbef9(0x162)],resolve(_0x2c86ad['agentsSkillsDir'],_0x5f05ef));_0xd4371b[_0x3dbef9(0x154)]({..._0x3988c2,'contentHash':_0x4bed66[_0x3dbef9(0x149)]});}return _0xd4371b;}function ensureManagedSymlink(_0x65f586,_0x3a4d37,_0x314b21,_0xaf4571){const _0x2f9f5b=a153_0x51f9;mkdirSync(dirname(_0x65f586),{'recursive':!![],'mode':0x1c0});if(existsSync(_0x65f586)||isDanglingSymlink(_0x65f586)){const _0x50d761=lstatSync(_0x65f586);if(!_0x50d761[_0x2f9f5b(0x153)]())throw CliErrors[_0x2f9f5b(0x155)](_0x2f9f5b(0x14a)+_0x65f586);const _0x6cd575=resolveSymlinkTarget(_0x65f586);if(!isPathInside(realOrResolved(_0x6cd575),realOrResolved(_0x314b21[_0x2f9f5b(0x158)])))throw CliErrors[_0x2f9f5b(0x155)](_0x2f9f5b(0x170)+_0x65f586);if(realOrResolved(_0x6cd575)===realOrResolved(_0x3a4d37))return{'path':_0x65f586,'target':_0x3a4d37,'action':_0x2f9f5b(0x145)};const _0x27c59c=readMetadataIfPresent(resolve(_0x6cd575,METADATA_FILE));if(_0x314b21[_0x2f9f5b(0x15f)]===_0x2f9f5b(0x168)&&(_0x27c59c?.[_0x2f9f5b(0x16d)]!==_0x314b21[_0x2f9f5b(0x16d)]||_0x27c59c[_0x2f9f5b(0x152)]!==_0xaf4571))throw CliErrors[_0x2f9f5b(0x155)]('Refusing\x20to\x20overwrite\x20managed\x20Skill\x20link\x20owned\x20by\x20another\x20app\x20or\x20code:\x20'+_0x65f586);return unlinkSync(_0x65f586),symlinkSync(_0x3a4d37,_0x65f586,_0x2f9f5b(0x162)),{'path':_0x65f586,'target':_0x3a4d37,'action':_0x2f9f5b(0x15d)};}return symlinkSync(_0x3a4d37,_0x65f586,_0x2f9f5b(0x162)),{'path':_0x65f586,'target':_0x3a4d37,'action':_0x2f9f5b(0x14e)};}function managedTargetSkillLinkPaths(_0x3b6a29,_0x4fd073){const _0x525f57=a153_0x51f9;if(!existsSync(_0x3b6a29))return[];const _0xc279dc=_0x4fd073[_0x525f57(0x16d)]+'--';return readdirSync(_0x3b6a29,{'withFileTypes':!![]})['filter'](_0x1158f2=>_0x4fd073[_0x525f57(0x15f)]===_0x525f57(0x168)||_0x1158f2[_0x525f57(0x156)][_0x525f57(0x16e)](_0xc279dc))[_0x525f57(0x13d)](_0x33f590=>resolve(_0x3b6a29,_0x33f590['name']));}function removeManagedSkillLink(_0x407149,_0x1be8f3,_0x8e2b67){const _0x15ab48=a153_0x51f9,_0x2123e1=lstatIfPresent(_0x407149);if(!_0x2123e1?.[_0x15ab48(0x153)]())return{'path':_0x407149,'action':_0x15ab48(0x16f),'reason':_0x15ab48(0x163)};const _0xa9dbd5=resolveSymlinkTarget(_0x407149);if(!isPathInside(realOrResolved(_0xa9dbd5),realOrResolved(_0x1be8f3[_0x15ab48(0x158)])))return{'path':_0x407149,'action':_0x15ab48(0x16f),'reason':_0x15ab48(0x160)};const _0x583495=readMetadataIfPresent(resolve(_0xa9dbd5,METADATA_FILE));if(_0x1be8f3[_0x15ab48(0x15f)]===_0x15ab48(0x168)&&(_0x583495?.[_0x15ab48(0x16d)]!==_0x1be8f3[_0x15ab48(0x16d)]||_0x583495[_0x15ab48(0x152)]!==_0x8e2b67))return{'path':_0x407149,'action':_0x15ab48(0x16f),'reason':_0x15ab48(0x15e)};return unlinkSync(_0x407149),{'path':_0x407149,'action':'removed'};}function isLinkedFromAnyRoot(_0x4c8d46,_0x16afe9){const _0x3b1b4c=a153_0x51f9,_0x2b941c=realOrResolved(_0x4c8d46);for(const _0x35987d of _0x16afe9){if(!existsSync(_0x35987d))continue;for(const _0xd0ab06 of readdirSync(_0x35987d,{'withFileTypes':!![]})){if(!_0xd0ab06[_0x3b1b4c(0x153)]())continue;const _0x4bc0ff=resolve(_0x35987d,_0xd0ab06[_0x3b1b4c(0x156)]);if(realOrResolved(resolveSymlinkTarget(_0x4bc0ff))===_0x2b941c)return!![];}}return![];}function runtimeSkillLinkName(_0x4961d8,_0x1d30d9){const _0x4d80fe=a153_0x51f9,_0x5c8651=safePathSegment(_0x1d30d9,_0x4d80fe(0x152));if(_0x4961d8[_0x4d80fe(0x15f)]===_0x4d80fe(0x168)&&RESERVED_PROJECT_SKILL_CODES['has'](_0x5c8651))throw CliErrors[_0x4d80fe(0x155)](_0x4d80fe(0x161)+_0x5c8651);return _0x4961d8['scope']===_0x4d80fe(0x168)?_0x5c8651:_0x4961d8[_0x4d80fe(0x16d)]+'--'+_0x5c8651;}function runtimeSkillCodeFromLink(_0x5b1450,_0x53e875){const _0x34e42d=a153_0x51f9,_0x15a2ef=basename(_0x53e875);return _0x5b1450['scope']===_0x34e42d(0x168)?_0x15a2ef:_0x15a2ef['slice']((_0x5b1450[_0x34e42d(0x16d)]+'--')[_0x34e42d(0x142)]);}export function copyManagedSkillDirectory(_0x27a8fb,_0xda3db7){const _0x189e11=a153_0x51f9,_0x3d52a0=resolve(_0xda3db7,METADATA_FILE),_0x4adb64=existsSync(_0xda3db7);if(_0x4adb64){const _0x291ac2=lstatSync(_0xda3db7);if(_0x291ac2[_0x189e11(0x153)]())throw CliErrors[_0x189e11(0x155)](_0x189e11(0x143)+_0xda3db7);if(!_0x291ac2[_0x189e11(0x157)]())throw CliErrors[_0x189e11(0x155)](_0x189e11(0x138)+_0xda3db7);const _0xaa82bf=readMetadataIfPresent(_0x3d52a0);if(_0xaa82bf?.[_0x189e11(0x15f)]!==_0x189e11(0x140))throw CliErrors[_0x189e11(0x155)]('Refusing\x20to\x20overwrite\x20unmanaged\x20global\x20Skill\x20directory:\x20'+_0xda3db7);}ensureDirSync(dirname(_0xda3db7));const _0x174c22=_0x4adb64?readMetadataIfPresent(_0x3d52a0)?.['contentHash']:undefined,_0x4dcf85=readMetadataIfPresent(resolve(_0x27a8fb,METADATA_FILE))?.['contentHash'];return _0x4adb64&&removeSync(_0xda3db7),copySkillDirectory(_0x27a8fb,_0xda3db7),{'path':_0xda3db7,'target':_0x27a8fb,'action':!_0x4adb64?'created':_0x174c22===_0x4dcf85?_0x189e11(0x145):_0x189e11(0x15d)};}function copySkillDirectory(_0x28c7e4,_0x1d3eeb){copySync(_0x28c7e4,_0x1d3eeb,{'dereference':![],'overwrite':!![],'filter'(_0x2157bd){const _0x4f30e3=a153_0x51f9;if(lstatSync(_0x2157bd)[_0x4f30e3(0x153)]())throw CliErrors['validation'](_0x4f30e3(0x13a)+_0x2157bd);return!![];}});}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x2364c,_0x29819d){const _0x9b8d4d=a154_0x238d,_0x49205b=_0x2364c();while(!![]){try{const _0x3b86ed=parseInt(_0x9b8d4d(0x1cc))/0x1+-parseInt(_0x9b8d4d(0x1ce))/0x2*(-parseInt(_0x9b8d4d(0x1b3))/0x3)+parseInt(_0x9b8d4d(0x1a4))/0x4*(parseInt(_0x9b8d4d(0x1bb))/0x5)+-parseInt(_0x9b8d4d(0x1a9))/0x6*(-parseInt(_0x9b8d4d(0x1b9))/0x7)+-parseInt(_0x9b8d4d(0x1a5))/0x8+parseInt(_0x9b8d4d(0x1a1))/0x9+-parseInt(_0x9b8d4d(0x1b6))/0xa*(-parseInt(_0x9b8d4d(0x1a8))/0xb);if(_0x3b86ed===_0x29819d)break;else _0x49205b['push'](_0x49205b['shift']());}catch(_0x3deedf){_0x49205b['push'](_0x49205b['shift']());}}}(a154_0x4b32,0x8d110));import{existsSync,readdirSync}from'node:fs';function a154_0x4b32(){const _0x1dd5c6=['from','38300XUPQmU','6734624Ruhzrk','isArray','isSymbolicLink','3018169fbMOvN','1146WvTZIl','env','get','scope','builtin','scopes','link','skillRoots','dir','map','8241axhETJ','appCode','skillCode','10lnyBFL','isDirectory','set','1687jEapRl','Runtime\x20Skill\x20install\x20target\x20app\x20mismatch:\x20','235fleDqH','skillMdPath','trim','name','startsWith','code','tags','sort','source','cache','push','localeCompare','values','filter','includes','linkedPath','\x20!=\x20','17768uVxSOc','has','328wSinsa','1628325uUpEpQ','linkedPaths'];a154_0x4b32=function(){return _0x1dd5c6;};return a154_0x4b32();}import{resolve}from'node:path';function a154_0x238d(_0x297e19,_0xa86be2){_0x297e19=_0x297e19-0x1a1;const _0x4b3279=a154_0x4b32();let _0x238d71=_0x4b3279[_0x297e19];return _0x238d71;}import{CliErrors}from'../../errors.js';import{METADATA_FILE,SKILL_FILE}from'./constants.js';import{readMetadataIfPresent}from'./metadata.js';import{getRuntimeSkillCacheRoot,safePathSegment}from'./paths.js';import{isRuntimeSkillScope,normalizeRuntimeSkillScopes}from'./scopes.js';export function listLocalRuntimeSkills(_0x2bfe5c,_0x179ce7,_0x37d4c1={}){const _0x238ae0=a154_0x238d,_0x44e12f=safePathSegment(_0x2bfe5c[_0x238ae0(0x1b4)],_0x238ae0(0x1b4));if(_0x179ce7[_0x238ae0(0x1b4)]!==_0x44e12f)throw CliErrors['validation'](_0x238ae0(0x1ba)+_0x179ce7['appCode']+_0x238ae0(0x1cb)+_0x44e12f);const _0x371c46=normalizeRuntimeSkillScopes(_0x2bfe5c[_0x238ae0(0x1ae)]),_0x14c2a5=new Set(_0x371c46),_0x5ba057=_0x2bfe5c['code']?.[_0x238ae0(0x1bd)](),_0x37bbfa=new Map(),_0x528cfc=resolve(getRuntimeSkillCacheRoot(_0x2bfe5c[_0x238ae0(0x1aa)],_0x2bfe5c['accessKey'],_0x37d4c1),_0x44e12f);for(const _0x550520 of _0x371c46){for(const _0x3d865b of localSkillEntryDirs(resolve(_0x528cfc,_0x550520))){collectLocalRuntimeSkill(_0x37bbfa,_0x3d865b,{'appCode':_0x44e12f,'scopes':_0x14c2a5,'code':_0x5ba057,'source':_0x238ae0(0x1c4)});}}for(const _0x274f2f of _0x179ce7[_0x238ae0(0x1b0)]){for(const _0x4f5d7b of localSkillLinkCandidates(_0x274f2f,_0x179ce7,_0x14c2a5)){collectLocalRuntimeSkill(_0x37bbfa,_0x4f5d7b,{'appCode':_0x44e12f,'scopes':_0x14c2a5,'code':_0x5ba057,'source':_0x238ae0(0x1af),'linkedPath':_0x4f5d7b});}}return Array[_0x238ae0(0x1a3)](_0x37bbfa[_0x238ae0(0x1c7)]())[_0x238ae0(0x1c2)](compareLocalRuntimeSkills);}function localSkillEntryDirs(_0x13b92b){const _0x624e93=a154_0x238d;if(!existsSync(_0x13b92b))return[];return readdirSync(_0x13b92b,{'withFileTypes':!![]})[_0x624e93(0x1c8)](_0x3e860c=>_0x3e860c[_0x624e93(0x1b7)]()||_0x3e860c[_0x624e93(0x1a7)]())[_0x624e93(0x1b2)](_0x2a2159=>resolve(_0x13b92b,_0x2a2159[_0x624e93(0x1be)]));}function localSkillLinkCandidates(_0x364ab9,_0x53a760,_0xc16e74){const _0x5737d8=a154_0x238d;if(!existsSync(_0x364ab9))return[];const _0x2750cf=_0x53a760[_0x5737d8(0x1b4)]+'--';return readdirSync(_0x364ab9,{'withFileTypes':!![]})[_0x5737d8(0x1c8)](_0x47969b=>_0x47969b[_0x5737d8(0x1b7)]()||_0x47969b['isSymbolicLink']())[_0x5737d8(0x1c8)](_0x1a572d=>_0x53a760[_0x5737d8(0x1ac)]==='project'||_0x1a572d[_0x5737d8(0x1be)][_0x5737d8(0x1bf)](_0x2750cf)||_0xc16e74['has'](_0x5737d8(0x1ad)))[_0x5737d8(0x1b2)](_0x3341c1=>resolve(_0x364ab9,_0x3341c1[_0x5737d8(0x1be)]));}function collectLocalRuntimeSkill(_0x510fa9,_0x351ebc,_0x485fc4){const _0x5521b8=a154_0x238d,_0x518300=resolve(_0x351ebc,METADATA_FILE),_0x2a9853=readMetadataIfPresent(_0x518300);if(!_0x2a9853)return;if(_0x2a9853[_0x5521b8(0x1b4)]!==_0x485fc4[_0x5521b8(0x1b4)])return;if(!isRuntimeSkillScope(_0x2a9853['scope'])||!_0x485fc4['scopes'][_0x5521b8(0x1cd)](_0x2a9853[_0x5521b8(0x1ac)]))return;const _0x368e97=_0x2a9853[_0x5521b8(0x1b5)]?.[_0x5521b8(0x1bd)]();if(!_0x368e97)return;if(_0x485fc4[_0x5521b8(0x1c0)]&&_0x368e97!==_0x485fc4['code'])return;const _0x432e41=_0x2a9853[_0x5521b8(0x1ac)]+':'+_0x368e97,_0x391265=_0x485fc4[_0x5521b8(0x1ca)]?[_0x485fc4[_0x5521b8(0x1ca)]]:[],_0x325b06=_0x510fa9[_0x5521b8(0x1ab)](_0x432e41);if(_0x325b06){_0x485fc4['source']===_0x5521b8(0x1c4)&&(_0x325b06['dir']=_0x351ebc,_0x325b06['cacheDir']=_0x351ebc,_0x325b06[_0x5521b8(0x1bc)]=resolve(_0x351ebc,SKILL_FILE),_0x325b06['metadataPath']=_0x518300);for(const _0x23ee10 of _0x391265){!_0x325b06['linkedPaths'][_0x5521b8(0x1c9)](_0x23ee10)&&_0x325b06[_0x5521b8(0x1a2)][_0x5521b8(0x1c5)](_0x23ee10);}_0x325b06[_0x5521b8(0x1a2)]['sort']();return;}_0x510fa9[_0x5521b8(0x1b8)](_0x432e41,{..._0x2a9853,'tags':Array[_0x5521b8(0x1a6)](_0x2a9853[_0x5521b8(0x1c1)])?_0x2a9853[_0x5521b8(0x1c1)]:[],'scope':_0x2a9853['scope'],'source':'local','dir':_0x351ebc,'cacheDir':_0x485fc4[_0x5521b8(0x1c3)]===_0x5521b8(0x1c4)?_0x351ebc:undefined,'skillMdPath':resolve(_0x351ebc,SKILL_FILE),'metadataPath':_0x518300,'linkedPaths':_0x391265});}function compareLocalRuntimeSkills(_0x5d31dd,_0x510c66){const _0x29e1f8=a154_0x238d,_0xe6c169={'personal':0x0,'company':0x1,'builtin':0x2};return _0xe6c169[_0x5d31dd[_0x29e1f8(0x1ac)]]-_0xe6c169[_0x510c66[_0x29e1f8(0x1ac)]]||_0x5d31dd['skillCode'][_0x29e1f8(0x1c6)](_0x510c66[_0x29e1f8(0x1b5)])||_0x5d31dd[_0x29e1f8(0x1b1)][_0x29e1f8(0x1c6)](_0x510c66[_0x29e1f8(0x1b1)]);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0xf0da54,_0xb9f9c9){const _0x4e4953=a155_0x4cc9,_0xf7efb5=_0xf0da54();while(!![]){try{const _0x500338=-parseInt(_0x4e4953(0x80))/0x1*(-parseInt(_0x4e4953(0x95))/0x2)+-parseInt(_0x4e4953(0x7b))/0x3*(-parseInt(_0x4e4953(0x8b))/0x4)+-parseInt(_0x4e4953(0x7e))/0x5+parseInt(_0x4e4953(0x81))/0x6*(parseInt(_0x4e4953(0x91))/0x7)+parseInt(_0x4e4953(0x83))/0x8*(parseInt(_0x4e4953(0x98))/0x9)+parseInt(_0x4e4953(0x8a))/0xa*(-parseInt(_0x4e4953(0x74))/0xb)+parseInt(_0x4e4953(0x77))/0xc*(parseInt(_0x4e4953(0x85))/0xd);if(_0x500338===_0xb9f9c9)break;else _0xf7efb5['push'](_0xf7efb5['shift']());}catch(_0x2d8e5b){_0xf7efb5['push'](_0xf7efb5['shift']());}}}(a155_0x4fd6,0x53916));import{readFileSync,readdirSync,realpathSync}from'node:fs';import{relative,resolve}from'node:path';import{CliErrors}from'../../errors.js';import{IGNORED_DIR_NAMES,IGNORED_FILE_NAMES,SKILL_FILE}from'./constants.js';export function fileContent(_0x3bccad){const _0x2287bd=a155_0x4cc9;return _0x3bccad[_0x2287bd(0x93)]??Buffer['from'](_0x3bccad[_0x2287bd(0x87)]??'','utf8');}function a155_0x4cc9(_0x2547cd,_0x54ff84){_0x2547cd=_0x2547cd-0x74;const _0x4fd625=a155_0x4fd6();let _0x4cc905=_0x4fd625[_0x2547cd];return _0x4cc905;}export function fileText(_0x571301){const _0x10e122=a155_0x4cc9;return fileContent(_0x571301)['toString'](_0x10e122(0xa0));}export function normalizeLocalFiles(_0x5b7067){const _0x1906c0=a155_0x4cc9;if(!Array['isArray'](_0x5b7067)||_0x5b7067['length']===0x0)return[];const _0x59bd4f=new Map();for(const _0x144605 of _0x5b7067){if(!_0x144605||typeof _0x144605!==_0x1906c0(0x8e)||typeof _0x144605[_0x1906c0(0x96)]!=='string')throw CliErrors[_0x1906c0(0x97)]('Skill\x20file\x20path\x20must\x20be\x20text.');const _0x1be04a=normalizeSkillRelativePath(_0x144605[_0x1906c0(0x96)]);if(_0x59bd4f[_0x1906c0(0x7c)](_0x1be04a))throw CliErrors[_0x1906c0(0x97)](_0x1906c0(0x9c)+_0x1be04a);if(_0x144605['bytes']!==undefined&&!Buffer[_0x1906c0(0x9d)](_0x144605[_0x1906c0(0x93)]))throw CliErrors[_0x1906c0(0x97)](_0x1906c0(0x99)+_0x1be04a);if(_0x144605[_0x1906c0(0x93)]===undefined&&typeof _0x144605[_0x1906c0(0x87)]!==_0x1906c0(0x75))throw CliErrors[_0x1906c0(0x97)](_0x1906c0(0x90)+_0x1be04a);const _0x5ec9e7=fileContent(_0x144605);_0x59bd4f['set'](_0x1be04a,{'path':_0x1be04a,'bytes':_0x5ec9e7});}return Array[_0x1906c0(0x8d)](_0x59bd4f[_0x1906c0(0x7d)]())['sort'](compareSkillFiles);}export function normalizeManifestFiles(_0x5d2128){const _0x4f58a4=a155_0x4cc9;if(!Array['isArray'](_0x5d2128)||_0x5d2128[_0x4f58a4(0x8f)]===0x0)return[];const _0xec047b=new Map();for(const _0x5efbe1 of _0x5d2128){if(!_0x5efbe1||typeof _0x5efbe1!==_0x4f58a4(0x8e)||typeof _0x5efbe1[_0x4f58a4(0x96)]!==_0x4f58a4(0x75))throw CliErrors[_0x4f58a4(0x97)]('Skill\x20file\x20path\x20must\x20be\x20text.');const _0x30a363=normalizeSkillRelativePath(_0x5efbe1[_0x4f58a4(0x96)]);if(_0xec047b['has'](_0x30a363))throw CliErrors[_0x4f58a4(0x97)](_0x4f58a4(0x9c)+_0x30a363);if(!isSha256Hex(_0x5efbe1[_0x4f58a4(0xa1)]))throw CliErrors[_0x4f58a4(0x97)](_0x4f58a4(0x7f)+_0x30a363);if(!Number[_0x4f58a4(0x7a)](_0x5efbe1['size'])||_0x5efbe1['size']<0x0)throw CliErrors[_0x4f58a4(0x97)]('Skill\x20file\x20size\x20is\x20invalid:\x20'+_0x30a363);_0xec047b[_0x4f58a4(0x86)](_0x30a363,{'path':_0x30a363,'sha256':_0x5efbe1['sha256']['toLowerCase'](),'size':_0x5efbe1[_0x4f58a4(0x92)]});}return Array[_0x4f58a4(0x8d)](_0xec047b['values']())[_0x4f58a4(0x79)](compareSkillFiles);}export function scanSkillDirectory(_0xab2310,_0x5c58d7={}){const _0x5e2a37=a155_0x4cc9,_0x575601=realpathSync(_0xab2310),_0xc7eb97=canonicalExcludedFilePaths(_0x5c58d7[_0x5e2a37(0x9f)]),_0x956c82=[];function _0x4cb614(_0x2a3e37){const _0x4ed3d9=_0x5e2a37,_0x132843=readdirSync(_0x2a3e37,{'withFileTypes':!![]})['sort']((_0xd84e88,_0x15bc37)=>_0xd84e88[_0x4ed3d9(0x82)]['localeCompare'](_0x15bc37[_0x4ed3d9(0x82)]));for(const _0x1cee63 of _0x132843){if(_0x1cee63['isDirectory']()&&IGNORED_DIR_NAMES[_0x4ed3d9(0x7c)](_0x1cee63[_0x4ed3d9(0x82)]))continue;if(IGNORED_FILE_NAMES[_0x4ed3d9(0x7c)](_0x1cee63[_0x4ed3d9(0x82)]))continue;const _0x169a87=resolve(_0x2a3e37,_0x1cee63[_0x4ed3d9(0x82)]);if(isExcludedFilePath(_0x169a87,_0xc7eb97))continue;if(_0x1cee63[_0x4ed3d9(0x9e)]())throw CliErrors['validation'](_0x4ed3d9(0x94)+_0x169a87);const _0x22db87=toPosixPath(relative(_0x575601,_0x169a87));if(_0x1cee63[_0x4ed3d9(0x84)]()){_0x4cb614(_0x169a87);continue;}if(!_0x1cee63[_0x4ed3d9(0x76)]())continue;validateSkillRelativePath(_0x22db87);const _0x5b02fc=readFileSync(_0x169a87);_0x956c82[_0x4ed3d9(0x9a)]({'path':_0x22db87,'bytes':_0x5b02fc});}}return _0x4cb614(_0x575601),normalizeLocalFiles(_0x956c82);}function canonicalExcludedFilePaths(_0x15adc2){const _0x4314b6=a155_0x4cc9,_0x31ec14=new Set();for(const _0x8fc049 of _0x15adc2??[]){const _0x43fef9=resolve(_0x8fc049);_0x31ec14['add'](_0x43fef9);try{_0x31ec14[_0x4314b6(0x78)](realpathSync(_0x43fef9));}catch{}}return _0x31ec14;}function isExcludedFilePath(_0x1b35c7,_0xe68571){const _0xdf6ec9=a155_0x4cc9;if(_0xe68571[_0xdf6ec9(0x7c)](_0x1b35c7))return!![];if(_0xe68571[_0xdf6ec9(0x92)]===0x0)return![];try{return _0xe68571['has'](realpathSync(_0x1b35c7));}catch{return![];}}export function compareSkillFiles(_0x49dd4a,_0x1a5ebb){const _0x773f76=a155_0x4cc9;if(_0x49dd4a[_0x773f76(0x96)]===SKILL_FILE)return _0x1a5ebb[_0x773f76(0x96)]===SKILL_FILE?0x0:-0x1;if(_0x1a5ebb[_0x773f76(0x96)]===SKILL_FILE)return 0x1;return Buffer['compare'](Buffer[_0x773f76(0x8d)](_0x49dd4a[_0x773f76(0x96)],'utf8'),Buffer[_0x773f76(0x8d)](_0x1a5ebb[_0x773f76(0x96)],_0x773f76(0xa0)));}export function normalizeSkillRelativePath(_0x284ee8){const _0x30b8ba=toPosixPath(_0x284ee8['trim']());return validateSkillRelativePath(_0x30b8ba),_0x30b8ba;}export function validateSkillRelativePath(_0x209e48){const _0x26c40a=a155_0x4cc9;if(!_0x209e48||_0x209e48[_0x26c40a(0x9b)]('/')||_0x209e48[_0x26c40a(0x88)]('//'))throw CliErrors[_0x26c40a(0x97)](_0x26c40a(0xa2)+_0x209e48);for(const _0x46c1f3 of _0x209e48[_0x26c40a(0x8c)]('/')){if(!_0x46c1f3||_0x46c1f3==='.'||_0x46c1f3==='..')throw CliErrors['validation'](_0x26c40a(0xa2)+_0x209e48);}}function a155_0x4fd6(){const _0xa2ea3a=['isFile','298092kzSxMf','add','sort','isSafeInteger','68271xImEfQ','has','values','2055075vQFewr','Skill\x20file\x20sha256\x20is\x20invalid:\x20','682XgyQMN','30wiqVUU','name','809808mPMgQn','isDirectory','221DuVUPB','set','content','includes','replace','1040EXSBEp','4SylGxw','split','from','object','length','Skill\x20file\x20content\x20must\x20be\x20text\x20or\x20bytes:\x20','320341VtlBjW','size','bytes','Skill\x20directory\x20contains\x20unsupported\x20symlink:\x20','388lURcsJ','path','validation','18gDkMEC','Skill\x20file\x20bytes\x20must\x20be\x20a\x20Buffer:\x20','push','startsWith','Duplicate\x20Skill\x20file\x20path:\x20','isBuffer','isSymbolicLink','excludedFilePaths','utf8','sha256','Unsafe\x20Skill\x20file\x20path:\x20','27005LzbxpW','string'];a155_0x4fd6=function(){return _0xa2ea3a;};return a155_0x4fd6();}export function toPosixPath(_0x2f89bd){const _0x537082=a155_0x4cc9;return _0x2f89bd[_0x537082(0x89)](/\\/g,'/');}export function isSha256Hex(_0x159049){const _0x126fd8=a155_0x4cc9;return typeof _0x159049===_0x126fd8(0x75)&&/^[a-fA-F0-9]{64}$/['test'](_0x159049);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(_0xea2750,_0xd68719){const _0x404dc6=a153_0x4eb2,_0x3e1dd3=_0xea2750();while(!![]){try{const _0x39b2b8=-parseInt(_0x404dc6(0x120))/0x1+parseInt(_0x404dc6(0x153))/0x2+parseInt(_0x404dc6(0x155))/0x3*(-parseInt(_0x404dc6(0x124))/0x4)+parseInt(_0x404dc6(0x11a))/0x5*(-parseInt(_0x404dc6(0x14b))/0x6)+parseInt(_0x404dc6(0x149))/0x7+parseInt(_0x404dc6(0x139))/0x8*(-parseInt(_0x404dc6(0x143))/0x9)+parseInt(_0x404dc6(0x11f))/0xa*(parseInt(_0x404dc6(0x14f))/0xb);if(_0x39b2b8===_0xd68719)break;else _0x3e1dd3['push'](_0x3e1dd3['shift']());}catch(_0x13f76c){_0x3e1dd3['push'](_0x3e1dd3['shift']());}}}(a153_0xbfba,0x75748));function a153_0x4eb2(_0x5fb2bd,_0x4f11d7){_0x5fb2bd=_0x5fb2bd-0x118;const _0xbfba2c=a153_0xbfba();let _0x4eb27b=_0xbfba2c[_0x5fb2bd];return _0x4eb27b;}import{existsSync,lstatSync,mkdirSync,readFileSync,rmSync}from'node:fs';import{dirname,resolve}from'node:path';import{isCollection,isMap,isNode,parseDocument,visit}from'yaml';import{CliErrors}from'../../errors.js';import{METADATA_FILE,SKILL_FILE}from'./constants.js';import{resolveManagedFilePath,writeBytesAtomic,writeJsonAtomic}from'./fs-utils.js';import{bufferSha256,contentHash,fileHash}from'./hashing.js';function a153_0xbfba(){const _0x1b0673=['---','has','4800607RREjzb','utf8','74130IXAkIa','paths','slice','Remote\x20Skill\x20would\x20overwrite\x20an\x20unmanaged\x20local\x20file:\x20','165XMXGuI','env','force','status','193828VspcZS','scope','30ygdBSe','example','skillCode','displayName:\x20','Local\x20Skill\x20files\x20have\x20unpushed\x20edits:\x20','.\x20Changed\x20file:\x20','Local\x20SKILL.md\x20has\x20unpushed\x20edits:\x20','map','25SNBHPv','pulledAt','filter','length','appCode','808150kqqOUO','289069hEolsl','hasOwn','Push\x20the\x20directory\x20first,\x20then\x20rerun\x20skill\x20install.','skillName','123724tbsIHD','trimEnd','name','Push\x20the\x20directory\x20first,\x20then\x20rerun\x20skill\x20install.\x20Changed\x20file:\x20','join','accessKey','entries','match','replace','version','displayName','description:\x20','delete','path','fileHashes','set','schemaVersion','packageBytes','---\x0a','errors','validation','6829520fhoSEb','contentHash','keys','Remote\x20Skill\x20would\x20overwrite\x20a\x20local\x20non-file\x20path:\x20','isFile','test','trim','stringify','flow','find','9RKwoUb','\x0a---\x0a\x0a','contents','description'];a153_0xbfba=function(){return _0x1b0673;};return a153_0xbfba();}import{fileContent,fileText,normalizeLocalFiles}from'./local-files.js';import{buildMetadata,readMetadataIfPresent,requireSkillCode}from'./metadata.js';import{getRuntimeSkillDir}from'./paths.js';import{extractDownloadedPackage,requirePackageBytes}from'./zip-package.js';export function materializeRuntimeSkill(_0xe1c3d4,_0x5cabc7,_0x2f3ea6){const _0x1ce67c=a153_0x4eb2,_0x18a012=requireSkillCode(_0xe1c3d4),_0x17e8a4=requirePackageBytes(_0x18a012,_0x2f3ea6[_0x1ce67c(0x135)]),_0x3b5a38=extractDownloadedPackage(_0x17e8a4),_0x383e4d=_0x3b5a38[_0x1ce67c(0x142)](_0x204a30=>_0x204a30[_0x1ce67c(0x131)]===SKILL_FILE);if(!_0x383e4d)throw CliErrors[_0x1ce67c(0x138)]('Runtime\x20Skill\x20package\x20is\x20missing\x20'+SKILL_FILE+':\x20'+_0x18a012);const _0x5c3d6b=withMaterializedSkillFrontmatter(_0x3b5a38,_0xe1c3d4,_0x18a012),_0x233de3=_0x5c3d6b[_0x1ce67c(0x142)](_0x4ad228=>_0x4ad228[_0x1ce67c(0x131)]===SKILL_FILE),_0x38715e=fileText(_0x233de3),_0xf1fd61=getRuntimeSkillDir(_0x2f3ea6['env'],_0x2f3ea6[_0x1ce67c(0x129)],_0x2f3ea6[_0x1ce67c(0x11e)],_0x5cabc7,_0x18a012,_0x2f3ea6['paths']),_0x50b2a0=resolve(_0xf1fd61,SKILL_FILE),_0x40285e=resolve(_0xf1fd61,METADATA_FILE),_0x1fa755=contentHash(_0x38715e),_0x2a62dd=readMetadataIfPresent(_0x40285e)?.[_0x1ce67c(0x132)];ensurePulledFilesCanBeOverwritten(_0xf1fd61,_0x40285e,_0x5c3d6b,_0x2f3ea6[_0x1ce67c(0x151)]===!![]),mkdirSync(_0xf1fd61,{'recursive':!![],'mode':0x1c0});const _0x72af07=existsSync(_0x50b2a0)?readFileSync(_0x50b2a0,'utf8'):undefined;return materializeFiles(_0xf1fd61,_0x5c3d6b),removeStaleManagedFiles(_0xf1fd61,_0x2a62dd,_0x5c3d6b),writeJsonAtomic(_0x40285e,buildMetadata(_0xe1c3d4,_0x5cabc7,_0x2f3ea6[_0x1ce67c(0x11e)],_0x1fa755,_0x2f3ea6[_0x1ce67c(0x11b)],_0x5c3d6b,_0x17e8a4)),{'skill':_0xe1c3d4,'scope':_0x5cabc7,'dir':_0xf1fd61,'skillMdPath':_0x50b2a0,'metadataPath':_0x40285e,'contentHash':_0x1fa755,'changed':_0x72af07!==_0x38715e};}export function reuseMaterializedRuntimeSkill(_0x4cef15,_0xf8870d,_0x2fb37f){const _0x39926a=a153_0x4eb2,_0xbf7808=_0x4cef15['version']?.[_0x39926a(0x13f)]();if(!_0xbf7808)return undefined;const _0x1c9d48=requireSkillCode(_0x4cef15),_0x1a9497=getRuntimeSkillDir(_0x2fb37f[_0x39926a(0x150)],_0x2fb37f[_0x39926a(0x129)],_0x2fb37f[_0x39926a(0x11e)],_0xf8870d,_0x1c9d48,_0x2fb37f[_0x39926a(0x14c)]),_0x3d22df=resolve(_0x1a9497,SKILL_FILE),_0x44afa9=resolve(_0x1a9497,METADATA_FILE),_0x3fde93=readMetadataIfPresent(_0x44afa9);if(!_0x3fde93||_0x3fde93[_0x39926a(0x134)]!==0x2||_0x3fde93[_0x39926a(0x11e)]!==_0x2fb37f[_0x39926a(0x11e)]||_0x3fde93[_0x39926a(0x154)]!==_0xf8870d||_0x3fde93[_0x39926a(0x157)]!==_0x1c9d48||_0x3fde93[_0x39926a(0x12d)]!==_0xbf7808||_0x3fde93['id']!==_0x4cef15['id']||_0x3fde93[_0x39926a(0x123)]!==_0x4cef15['skillName']||_0x3fde93[_0x39926a(0x146)]!==_0x4cef15[_0x39926a(0x146)]||_0x3fde93[_0x39926a(0x156)]!==_0x4cef15[_0x39926a(0x156)]||_0x3fde93[_0x39926a(0x152)]!==_0x4cef15[_0x39926a(0x152)]||!_0x3fde93[_0x39926a(0x13a)]||!_0x3fde93['fileHashes']||!Object[_0x39926a(0x121)](_0x3fde93['fileHashes'],SKILL_FILE))return undefined;for(const [_0x4f81dc,_0x23618d]of Object[_0x39926a(0x12a)](_0x3fde93[_0x39926a(0x132)])){if(!/^[a-f0-9]{64}$/['test'](_0x23618d))return undefined;const _0x57ec47=resolveManagedFilePath(_0x1a9497,_0x4f81dc);if(!existsSync(_0x57ec47)||!lstatSync(_0x57ec47)[_0x39926a(0x13d)]())return undefined;if(bufferSha256(readFileSync(_0x57ec47))!==_0x23618d)return undefined;}return{'skill':_0x4cef15,'scope':_0xf8870d,'dir':_0x1a9497,'skillMdPath':_0x3d22df,'metadataPath':_0x44afa9,'contentHash':_0x3fde93[_0x39926a(0x13a)],'changed':![]};}function withMaterializedSkillFrontmatter(_0x16b45d,_0x550d11,_0x5b6fa3){const _0x548b4d=a153_0x4eb2,_0x316232=skillDisplayName(_0x550d11,_0x5b6fa3),_0x30c67d=_0x550d11[_0x548b4d(0x146)]?.['trim']()||_0x316232||_0x5b6fa3;return normalizeLocalFiles(_0x16b45d)[_0x548b4d(0x119)](_0x887a08=>{const _0x13a0d6=_0x548b4d,_0x52bdfb=fileText(_0x887a08);if(_0x887a08[_0x13a0d6(0x131)]!==SKILL_FILE)return _0x887a08;if(hasYamlFrontmatter(_0x52bdfb))return{'path':_0x887a08['path'],'content':withSyncedDisplayName(_0x52bdfb,_0x316232)};return{'path':_0x887a08[_0x13a0d6(0x131)],'content':prependSkillFrontmatter(_0x52bdfb,{'name':_0x5b6fa3,'displayName':_0x316232,'description':_0x30c67d})};});}function hasYamlFrontmatter(_0x12bbc){const _0x4bf3b7=a153_0x4eb2;return/^\uFEFF?---\s*\r?\n/[_0x4bf3b7(0x13e)](_0x12bbc);}function prependSkillFrontmatter(_0x75841f,_0x5cacfa){const _0x508b75=a153_0x4eb2,_0x1b71ab=_0x75841f[_0x508b75(0x12c)](/^\uFEFF/,'');return['---','name:\x20'+yamlString(_0x5cacfa[_0x508b75(0x126)]),_0x5cacfa[_0x508b75(0x12e)]?_0x508b75(0x158)+yamlString(_0x5cacfa[_0x508b75(0x12e)]):undefined,_0x508b75(0x12f)+yamlString(_0x5cacfa[_0x508b75(0x146)]),_0x508b75(0x147),'',_0x1b71ab][_0x508b75(0x11c)](_0x5dc249=>_0x5dc249!==undefined)[_0x508b75(0x128)]('\x0a');}function yamlString(_0x1f359c){const _0x1dfa6e=a153_0x4eb2;return JSON[_0x1dfa6e(0x140)](_0x1f359c[_0x1dfa6e(0x12c)](/\r/g,'')[_0x1dfa6e(0x13f)]());}function skillDisplayName(_0x388adb,_0x15891a){const _0x2028ef=_0x388adb['skillName']?.['trim']();return _0x2028ef||_0x15891a;}function withSyncedDisplayName(_0x4e1cff,_0xce287f){const _0x1ed1a2=a153_0x4eb2,_0x11848c=_0x4e1cff[_0x1ed1a2(0x12b)](/^(\uFEFF?)---\s*\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/);if(!_0x11848c)return _0x4e1cff;const _0x417793=_0x11848c[0x1]??'',_0x45b387=_0x11848c[0x2]??'',_0x562ad5=parseDocument(_0x45b387);if(_0x562ad5[_0x1ed1a2(0x137)][_0x1ed1a2(0x11d)]>0x0||!isMap(_0x562ad5['contents']))return _0x4e1cff;if(_0xce287f)_0x562ad5[_0x1ed1a2(0x133)](_0x1ed1a2(0x12e),_0xce287f);else{if(_0x562ad5[_0x1ed1a2(0x148)](_0x1ed1a2(0x12e)))_0x562ad5[_0x1ed1a2(0x130)]('displayName');else return _0x4e1cff;}forceBlockCollections(_0x562ad5[_0x1ed1a2(0x145)]);const _0x213724=_0x562ad5['toString']({'lineWidth':0x0})[_0x1ed1a2(0x125)](),_0x44b1f4=_0x4e1cff[_0x1ed1a2(0x14d)](_0x11848c[0x0][_0x1ed1a2(0x11d)])[_0x1ed1a2(0x12c)](/^\r?\n/,'');return _0x417793+_0x1ed1a2(0x136)+_0x213724+_0x1ed1a2(0x144)+_0x44b1f4;}function forceBlockCollections(_0x368bba){if(!isNode(_0x368bba))return;visit(_0x368bba,(_0x453df4,_0x32651d)=>{const _0x4ade92=a153_0x4eb2;isCollection(_0x32651d)&&(_0x32651d[_0x4ade92(0x141)]=![]);});}function ensurePulledFilesCanBeOverwritten(_0x215c5b,_0x2cdce0,_0x54313f,_0x31f7d1){const _0x26001b=a153_0x4eb2;if(_0x31f7d1||!existsSync(_0x2cdce0))return;const _0x1752e8=readMetadataIfPresent(_0x2cdce0);if(!_0x1752e8)return;const _0x2b7ea3=_0x1752e8['fileHashes']&&Object[_0x26001b(0x13b)](_0x1752e8[_0x26001b(0x132)])[_0x26001b(0x11d)]>0x0?_0x1752e8['fileHashes']:undefined;if(_0x2b7ea3)for(const [_0x242184,_0x328612]of Object[_0x26001b(0x12a)](_0x2b7ea3)){const _0x21b191=resolveManagedFilePath(_0x215c5b,_0x242184);if(!existsSync(_0x21b191))throw CliErrors[_0x26001b(0x138)](_0x26001b(0x159)+_0x215c5b,'Managed\x20file\x20was\x20removed\x20locally:\x20'+_0x242184);const _0x3addf8=lstatSync(_0x21b191);if(!_0x3addf8[_0x26001b(0x13d)]())throw CliErrors[_0x26001b(0x138)](_0x26001b(0x159)+_0x215c5b,'Managed\x20file\x20is\x20no\x20longer\x20a\x20regular\x20file:\x20'+_0x242184);const _0x448d3c=bufferSha256(readFileSync(_0x21b191));if(_0x448d3c!==_0x328612)throw CliErrors[_0x26001b(0x138)](_0x26001b(0x159)+_0x215c5b+_0x26001b(0x15a)+_0x242184,_0x26001b(0x127)+_0x242184);}else{const _0x2b5bd5=resolve(_0x215c5b,SKILL_FILE);if(existsSync(_0x2b5bd5)&&_0x1752e8['contentHash']){const _0x43f87b=contentHash(readFileSync(_0x2b5bd5,_0x26001b(0x14a)));if(_0x43f87b!==_0x1752e8[_0x26001b(0x13a)])throw CliErrors['validation'](_0x26001b(0x118)+_0x2b5bd5,_0x26001b(0x122));}}for(const _0x1e2b1a of normalizeLocalFiles(_0x54313f)){if(_0x2b7ea3?.[_0x1e2b1a['path']])continue;if(!_0x2b7ea3&&_0x1e2b1a[_0x26001b(0x131)]===SKILL_FILE)continue;const _0x38bc3d=resolveManagedFilePath(_0x215c5b,_0x1e2b1a[_0x26001b(0x131)]);if(!existsSync(_0x38bc3d))continue;const _0xf4bdd8=lstatSync(_0x38bc3d);if(!_0xf4bdd8[_0x26001b(0x13d)]())throw CliErrors['validation'](_0x26001b(0x159)+_0x215c5b,_0x26001b(0x13c)+_0x1e2b1a['path']);const _0x31c924=bufferSha256(readFileSync(_0x38bc3d));if(_0x31c924!==fileHash(_0x1e2b1a))throw CliErrors[_0x26001b(0x138)](_0x26001b(0x159)+_0x215c5b,_0x26001b(0x14e)+_0x1e2b1a[_0x26001b(0x131)]);}}function materializeFiles(_0x2f6ebe,_0x4ab20d){const _0x3eb682=a153_0x4eb2;for(const _0x2ba57f of normalizeLocalFiles(_0x4ab20d)){const _0x280089=resolveManagedFilePath(_0x2f6ebe,_0x2ba57f[_0x3eb682(0x131)]);mkdirSync(dirname(_0x280089),{'recursive':!![],'mode':0x1c0}),writeBytesAtomic(_0x280089,fileContent(_0x2ba57f),0x180);}}function removeStaleManagedFiles(_0x3476c6,_0x436667,_0x57bd4a){const _0x49b146=a153_0x4eb2;if(!_0x436667)return;const _0x9a7004=new Set(normalizeLocalFiles(_0x57bd4a)['map'](_0x31cf6c=>_0x31cf6c[_0x49b146(0x131)]));for(const _0x308dfb of Object[_0x49b146(0x13b)](_0x436667)){if(_0x9a7004['has'](_0x308dfb))continue;const _0x1c175c=resolveManagedFilePath(_0x3476c6,_0x308dfb);existsSync(_0x1c175c)&&lstatSync(_0x1c175c)['isFile']()&&rmSync(_0x1c175c,{'force':!![]});}}
|
|
1
|
+
(function(_0x17b248,_0x539082){const _0x2f08e9=a156_0x15ca,_0x5164de=_0x17b248();while(!![]){try{const _0x3cce1d=parseInt(_0x2f08e9(0xb7))/0x1*(-parseInt(_0x2f08e9(0xc5))/0x2)+-parseInt(_0x2f08e9(0xa8))/0x3*(-parseInt(_0x2f08e9(0xaf))/0x4)+-parseInt(_0x2f08e9(0xbb))/0x5+-parseInt(_0x2f08e9(0xab))/0x6+parseInt(_0x2f08e9(0xd6))/0x7+parseInt(_0x2f08e9(0xd3))/0x8*(parseInt(_0x2f08e9(0xbe))/0x9)+-parseInt(_0x2f08e9(0xcd))/0xa*(-parseInt(_0x2f08e9(0xc4))/0xb);if(_0x3cce1d===_0x539082)break;else _0x5164de['push'](_0x5164de['shift']());}catch(_0x53fa9f){_0x5164de['push'](_0x5164de['shift']());}}}(a156_0x4cd1,0xe8f29));function a156_0x4cd1(){const _0x19d5fc=['appCode','displayName','join','keys','Managed\x20file\x20is\x20no\x20longer\x20a\x20regular\x20file:\x20','name:\x20','name','accessKey','---','replace','toString','slice','Push\x20the\x20directory\x20first,\x20then\x20rerun\x20skill\x20install.\x20Changed\x20file:\x20','798ugMIMr','status','schemaVersion','8621076nLtTuE','example','.\x20Changed\x20file:\x20','flow','10932RITqpT','validation','Local\x20SKILL.md\x20has\x20unpushed\x20edits:\x20','trimEnd','map','paths','description','isFile','1gNskas','force','hasOwn','length','5220975NDSjQy','skillCode','contentHash','860193lZjAbn','test','set','packageBytes','path','contents','517tOAdsV','2069338fVwbTZ','match','displayName:\x20','find','skillName','Push\x20the\x20directory\x20first,\x20then\x20rerun\x20skill\x20install.','has','Remote\x20Skill\x20would\x20overwrite\x20a\x20local\x20non-file\x20path:\x20','132670ffLLEF','stringify','entries','Managed\x20file\x20was\x20removed\x20locally:\x20','fileHashes','filter','120OrAKlx','pulledAt','Local\x20Skill\x20files\x20have\x20unpushed\x20edits:\x20','11799767JzpRQM','trim','scope','Runtime\x20Skill\x20package\x20is\x20missing\x20','env'];a156_0x4cd1=function(){return _0x19d5fc;};return a156_0x4cd1();}import{existsSync,lstatSync,mkdirSync,readFileSync,rmSync}from'node:fs';import{dirname,resolve}from'node:path';import{isCollection,isMap,isNode,parseDocument,visit}from'yaml';import{CliErrors}from'../../errors.js';import{METADATA_FILE,SKILL_FILE}from'./constants.js';import{resolveManagedFilePath,writeBytesAtomic,writeJsonAtomic}from'./fs-utils.js';import{bufferSha256,contentHash,fileHash}from'./hashing.js';import{fileContent,fileText,normalizeLocalFiles}from'./local-files.js';import{buildMetadata,readMetadataIfPresent,requireSkillCode}from'./metadata.js';function a156_0x15ca(_0x4833ff,_0x35bac1){_0x4833ff=_0x4833ff-0xa7;const _0x4cd1c8=a156_0x4cd1();let _0x15ca9c=_0x4cd1c8[_0x4833ff];return _0x15ca9c;}import{getRuntimeSkillDir}from'./paths.js';import{extractDownloadedPackage,requirePackageBytes}from'./zip-package.js';export function materializeRuntimeSkill(_0x23845c,_0x3dd9d2,_0x5e6479){const _0x25a6d2=a156_0x15ca,_0x568d15=requireSkillCode(_0x23845c),_0x610ef3=requirePackageBytes(_0x568d15,_0x5e6479[_0x25a6d2(0xc1)]),_0x43441a=extractDownloadedPackage(_0x610ef3),_0x302201=_0x43441a[_0x25a6d2(0xc8)](_0x958fd6=>_0x958fd6[_0x25a6d2(0xc2)]===SKILL_FILE);if(!_0x302201)throw CliErrors[_0x25a6d2(0xb0)](_0x25a6d2(0xd9)+SKILL_FILE+':\x20'+_0x568d15);const _0xec96c4=withMaterializedSkillFrontmatter(_0x43441a,_0x23845c,_0x568d15),_0x4a796d=_0xec96c4[_0x25a6d2(0xc8)](_0x22deb1=>_0x22deb1['path']===SKILL_FILE),_0x4a2073=fileText(_0x4a796d),_0x4d9383=getRuntimeSkillDir(_0x5e6479['env'],_0x5e6479[_0x25a6d2(0xe2)],_0x5e6479['appCode'],_0x3dd9d2,_0x568d15,_0x5e6479[_0x25a6d2(0xb4)]),_0x2c3420=resolve(_0x4d9383,SKILL_FILE),_0x1d89ec=resolve(_0x4d9383,METADATA_FILE),_0x7f0b8c=contentHash(_0x4a2073),_0x482996=readMetadataIfPresent(_0x1d89ec)?.[_0x25a6d2(0xd1)];ensurePulledFilesCanBeOverwritten(_0x4d9383,_0x1d89ec,_0xec96c4,_0x5e6479[_0x25a6d2(0xb8)]===!![]),mkdirSync(_0x4d9383,{'recursive':!![],'mode':0x1c0});const _0x23dd68=existsSync(_0x2c3420)?readFileSync(_0x2c3420,'utf8'):undefined;return materializeFiles(_0x4d9383,_0xec96c4),removeStaleManagedFiles(_0x4d9383,_0x482996,_0xec96c4),writeJsonAtomic(_0x1d89ec,buildMetadata(_0x23845c,_0x3dd9d2,_0x5e6479['appCode'],_0x7f0b8c,_0x5e6479[_0x25a6d2(0xd4)],_0xec96c4,_0x610ef3)),{'skill':_0x23845c,'scope':_0x3dd9d2,'dir':_0x4d9383,'skillMdPath':_0x2c3420,'metadataPath':_0x1d89ec,'contentHash':_0x7f0b8c,'changed':_0x23dd68!==_0x4a2073};}export function reuseMaterializedRuntimeSkill(_0x31447a,_0x5b6960,_0x349e4b){const _0x1d3e44=a156_0x15ca,_0x499aba=_0x31447a['version']?.['trim']();if(!_0x499aba)return undefined;const _0x43e380=requireSkillCode(_0x31447a),_0x2879d0=getRuntimeSkillDir(_0x349e4b[_0x1d3e44(0xda)],_0x349e4b[_0x1d3e44(0xe2)],_0x349e4b['appCode'],_0x5b6960,_0x43e380,_0x349e4b['paths']),_0x2cf032=resolve(_0x2879d0,SKILL_FILE),_0x59ccd0=resolve(_0x2879d0,METADATA_FILE),_0x4a6bd4=readMetadataIfPresent(_0x59ccd0);if(!_0x4a6bd4||_0x4a6bd4[_0x1d3e44(0xaa)]!==0x2||_0x4a6bd4['appCode']!==_0x349e4b[_0x1d3e44(0xdb)]||_0x4a6bd4[_0x1d3e44(0xd8)]!==_0x5b6960||_0x4a6bd4[_0x1d3e44(0xbc)]!==_0x43e380||_0x4a6bd4['version']!==_0x499aba||_0x4a6bd4['id']!==_0x31447a['id']||_0x4a6bd4['skillName']!==_0x31447a['skillName']||_0x4a6bd4[_0x1d3e44(0xb5)]!==_0x31447a[_0x1d3e44(0xb5)]||_0x4a6bd4[_0x1d3e44(0xac)]!==_0x31447a['example']||_0x4a6bd4[_0x1d3e44(0xa9)]!==_0x31447a[_0x1d3e44(0xa9)]||!_0x4a6bd4[_0x1d3e44(0xbd)]||!_0x4a6bd4[_0x1d3e44(0xd1)]||!Object[_0x1d3e44(0xb9)](_0x4a6bd4[_0x1d3e44(0xd1)],SKILL_FILE))return undefined;for(const [_0x240b39,_0x29de40]of Object[_0x1d3e44(0xcf)](_0x4a6bd4[_0x1d3e44(0xd1)])){if(!/^[a-f0-9]{64}$/[_0x1d3e44(0xbf)](_0x29de40))return undefined;const _0x547c2b=resolveManagedFilePath(_0x2879d0,_0x240b39);if(!existsSync(_0x547c2b)||!lstatSync(_0x547c2b)[_0x1d3e44(0xb6)]())return undefined;if(bufferSha256(readFileSync(_0x547c2b))!==_0x29de40)return undefined;}return{'skill':_0x31447a,'scope':_0x5b6960,'dir':_0x2879d0,'skillMdPath':_0x2cf032,'metadataPath':_0x59ccd0,'contentHash':_0x4a6bd4[_0x1d3e44(0xbd)],'changed':![]};}function withMaterializedSkillFrontmatter(_0x39e686,_0x30495a,_0x45277c){const _0x2c49cf=a156_0x15ca,_0x592630=skillDisplayName(_0x30495a,_0x45277c),_0x5368b7=_0x30495a[_0x2c49cf(0xb5)]?.[_0x2c49cf(0xd7)]()||_0x592630||_0x45277c;return normalizeLocalFiles(_0x39e686)[_0x2c49cf(0xb3)](_0x1f765d=>{const _0x217dbc=_0x2c49cf,_0x389895=fileText(_0x1f765d);if(_0x1f765d[_0x217dbc(0xc2)]!==SKILL_FILE)return _0x1f765d;if(hasYamlFrontmatter(_0x389895))return{'path':_0x1f765d['path'],'content':withSyncedDisplayName(_0x389895,_0x592630)};return{'path':_0x1f765d[_0x217dbc(0xc2)],'content':prependSkillFrontmatter(_0x389895,{'name':_0x45277c,'displayName':_0x592630,'description':_0x5368b7})};});}function hasYamlFrontmatter(_0x2a9c8a){const _0x518f2c=a156_0x15ca;return/^\uFEFF?---\s*\r?\n/[_0x518f2c(0xbf)](_0x2a9c8a);}function prependSkillFrontmatter(_0x1ddc40,_0xac208f){const _0x1ec6e4=a156_0x15ca,_0x438b29=_0x1ddc40[_0x1ec6e4(0xe4)](/^\uFEFF/,'');return[_0x1ec6e4(0xe3),_0x1ec6e4(0xe0)+yamlString(_0xac208f[_0x1ec6e4(0xe1)]),_0xac208f['displayName']?_0x1ec6e4(0xc7)+yamlString(_0xac208f[_0x1ec6e4(0xdc)]):undefined,'description:\x20'+yamlString(_0xac208f[_0x1ec6e4(0xb5)]),_0x1ec6e4(0xe3),'',_0x438b29][_0x1ec6e4(0xd2)](_0x3285d7=>_0x3285d7!==undefined)[_0x1ec6e4(0xdd)]('\x0a');}function yamlString(_0x58306f){const _0xe943dd=a156_0x15ca;return JSON[_0xe943dd(0xce)](_0x58306f[_0xe943dd(0xe4)](/\r/g,'')[_0xe943dd(0xd7)]());}function skillDisplayName(_0x380765,_0x5c6bc5){const _0x443112=a156_0x15ca,_0x47b7b0=_0x380765[_0x443112(0xc9)]?.['trim']();return _0x47b7b0||_0x5c6bc5;}function withSyncedDisplayName(_0x3cb360,_0x48a4aa){const _0x523a65=a156_0x15ca,_0x5202c0=_0x3cb360[_0x523a65(0xc6)](/^(\uFEFF?)---\s*\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/);if(!_0x5202c0)return _0x3cb360;const _0x3aa49b=_0x5202c0[0x1]??'',_0x1fa895=_0x5202c0[0x2]??'',_0x1da62d=parseDocument(_0x1fa895);if(_0x1da62d['errors'][_0x523a65(0xba)]>0x0||!isMap(_0x1da62d[_0x523a65(0xc3)]))return _0x3cb360;if(_0x48a4aa)_0x1da62d[_0x523a65(0xc0)](_0x523a65(0xdc),_0x48a4aa);else{if(_0x1da62d['has'](_0x523a65(0xdc)))_0x1da62d['delete']('displayName');else return _0x3cb360;}forceBlockCollections(_0x1da62d[_0x523a65(0xc3)]);const _0x49ca28=_0x1da62d[_0x523a65(0xe5)]({'lineWidth':0x0})[_0x523a65(0xb2)](),_0x2116c9=_0x3cb360[_0x523a65(0xe6)](_0x5202c0[0x0][_0x523a65(0xba)])[_0x523a65(0xe4)](/^\r?\n/,'');return _0x3aa49b+'---\x0a'+_0x49ca28+'\x0a---\x0a\x0a'+_0x2116c9;}function forceBlockCollections(_0x4f271f){if(!isNode(_0x4f271f))return;visit(_0x4f271f,(_0x4b3baa,_0x243139)=>{const _0x2d4697=a156_0x15ca;isCollection(_0x243139)&&(_0x243139[_0x2d4697(0xae)]=![]);});}function ensurePulledFilesCanBeOverwritten(_0x1d8fdb,_0x477c0e,_0x5cb99c,_0x146414){const _0x154965=a156_0x15ca;if(_0x146414||!existsSync(_0x477c0e))return;const _0xd3d91=readMetadataIfPresent(_0x477c0e);if(!_0xd3d91)return;const _0x2dbd50=_0xd3d91[_0x154965(0xd1)]&&Object[_0x154965(0xde)](_0xd3d91[_0x154965(0xd1)])[_0x154965(0xba)]>0x0?_0xd3d91[_0x154965(0xd1)]:undefined;if(_0x2dbd50)for(const [_0x4fea05,_0x577879]of Object[_0x154965(0xcf)](_0x2dbd50)){const _0x3f69d2=resolveManagedFilePath(_0x1d8fdb,_0x4fea05);if(!existsSync(_0x3f69d2))throw CliErrors['validation']('Local\x20Skill\x20files\x20have\x20unpushed\x20edits:\x20'+_0x1d8fdb,_0x154965(0xd0)+_0x4fea05);const _0x2ab7bc=lstatSync(_0x3f69d2);if(!_0x2ab7bc[_0x154965(0xb6)]())throw CliErrors[_0x154965(0xb0)](_0x154965(0xd5)+_0x1d8fdb,_0x154965(0xdf)+_0x4fea05);const _0xfcdf71=bufferSha256(readFileSync(_0x3f69d2));if(_0xfcdf71!==_0x577879)throw CliErrors[_0x154965(0xb0)](_0x154965(0xd5)+_0x1d8fdb+_0x154965(0xad)+_0x4fea05,_0x154965(0xa7)+_0x4fea05);}else{const _0x4df8aa=resolve(_0x1d8fdb,SKILL_FILE);if(existsSync(_0x4df8aa)&&_0xd3d91[_0x154965(0xbd)]){const _0x1e5c61=contentHash(readFileSync(_0x4df8aa,'utf8'));if(_0x1e5c61!==_0xd3d91[_0x154965(0xbd)])throw CliErrors['validation'](_0x154965(0xb1)+_0x4df8aa,_0x154965(0xca));}}for(const _0x160c35 of normalizeLocalFiles(_0x5cb99c)){if(_0x2dbd50?.[_0x160c35['path']])continue;if(!_0x2dbd50&&_0x160c35[_0x154965(0xc2)]===SKILL_FILE)continue;const _0xf7492c=resolveManagedFilePath(_0x1d8fdb,_0x160c35['path']);if(!existsSync(_0xf7492c))continue;const _0x524927=lstatSync(_0xf7492c);if(!_0x524927[_0x154965(0xb6)]())throw CliErrors[_0x154965(0xb0)](_0x154965(0xd5)+_0x1d8fdb,_0x154965(0xcc)+_0x160c35[_0x154965(0xc2)]);const _0x372117=bufferSha256(readFileSync(_0xf7492c));if(_0x372117!==fileHash(_0x160c35))throw CliErrors[_0x154965(0xb0)](_0x154965(0xd5)+_0x1d8fdb,'Remote\x20Skill\x20would\x20overwrite\x20an\x20unmanaged\x20local\x20file:\x20'+_0x160c35[_0x154965(0xc2)]);}}function materializeFiles(_0x217442,_0x264d9b){const _0x356d86=a156_0x15ca;for(const _0x1e9ab2 of normalizeLocalFiles(_0x264d9b)){const _0x2d72ee=resolveManagedFilePath(_0x217442,_0x1e9ab2[_0x356d86(0xc2)]);mkdirSync(dirname(_0x2d72ee),{'recursive':!![],'mode':0x1c0}),writeBytesAtomic(_0x2d72ee,fileContent(_0x1e9ab2),0x180);}}function removeStaleManagedFiles(_0x242803,_0x18d906,_0x61f0a8){const _0x4bee9f=a156_0x15ca;if(!_0x18d906)return;const _0x38fbbd=new Set(normalizeLocalFiles(_0x61f0a8)[_0x4bee9f(0xb3)](_0x32c8e1=>_0x32c8e1[_0x4bee9f(0xc2)]));for(const _0x1efd08 of Object[_0x4bee9f(0xde)](_0x18d906)){if(_0x38fbbd[_0x4bee9f(0xcb)](_0x1efd08))continue;const _0x1d7f2b=resolveManagedFilePath(_0x242803,_0x1efd08);existsSync(_0x1d7f2b)&&lstatSync(_0x1d7f2b)['isFile']()&&rmSync(_0x1d7f2b,{'force':!![]});}}
|