@lovrabet/lovrabet-cli 2.3.6 → 2.3.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (185) hide show
  1. package/README.md +15 -11
  2. package/lib/cli.js +1 -1
  3. package/lib/commands/api-doc/index.js +1 -1
  4. package/lib/commands/app/cache.js +1 -1
  5. package/lib/commands/app/definitions.js +1 -1
  6. package/lib/commands/app/eligibility.js +1 -1
  7. package/lib/commands/app/mock-loader.js +1 -1
  8. package/lib/commands/app/remote-source.js +1 -1
  9. package/lib/commands/app/shared.js +1 -1
  10. package/lib/commands/app-config/get.js +1 -1
  11. package/lib/commands/app-config/index.js +1 -1
  12. package/lib/commands/approval/index.js +1 -1
  13. package/lib/commands/artifact/index.js +1 -1
  14. package/lib/commands/auth/device.js +1 -1
  15. package/lib/commands/auth/index.js +1 -1
  16. package/lib/commands/auth/prompt.js +1 -1
  17. package/lib/commands/bff/detail.js +1 -1
  18. package/lib/commands/bff/exec.js +1 -1
  19. package/lib/commands/bff/index.js +1 -1
  20. package/lib/commands/cli-skill/index.js +1 -1
  21. package/lib/commands/common/config-policy.js +1 -1
  22. package/lib/commands/common/constraints.js +1 -1
  23. package/lib/commands/common/flags.js +1 -1
  24. package/lib/commands/common/local-file.js +1 -1
  25. package/lib/commands/config/definitions.js +1 -1
  26. package/lib/commands/config/init.js +1 -1
  27. package/lib/commands/config/shared.js +1 -1
  28. package/lib/commands/data/import-excel.js +1 -1
  29. package/lib/commands/data/index.js +1 -1
  30. package/lib/commands/dataset/detail.js +1 -1
  31. package/lib/commands/dataset/index.js +1 -1
  32. package/lib/commands/dataset/list.js +1 -1
  33. package/lib/commands/dataset/sdk-doc.js +1 -1
  34. package/lib/commands/doctor.js +1 -1
  35. package/lib/commands/file/index.js +1 -1
  36. package/lib/commands/init.js +1 -1
  37. package/lib/commands/kb/index.js +1 -1
  38. package/lib/commands/logs/index.js +1 -1
  39. package/lib/commands/notification/config-list.js +1 -1
  40. package/lib/commands/notification/index.js +1 -1
  41. package/lib/commands/notification/shared.js +1 -1
  42. package/lib/commands/ocr/index.js +1 -1
  43. package/lib/commands/permit/dataset-get.js +1 -1
  44. package/lib/commands/permit/dataset-set.js +1 -1
  45. package/lib/commands/permit/index.js +1 -1
  46. package/lib/commands/permit/page-get.js +1 -1
  47. package/lib/commands/permit/page-set.js +1 -1
  48. package/lib/commands/permit/role-menus-set.js +1 -1
  49. package/lib/commands/permit/role-menus.js +1 -1
  50. package/lib/commands/permit/shared.js +1 -1
  51. package/lib/commands/personal-bff/index.js +1 -1
  52. package/lib/commands/registry.js +1 -1
  53. package/lib/commands/role/create.js +1 -1
  54. package/lib/commands/role/delete.js +1 -1
  55. package/lib/commands/role/detail.js +1 -1
  56. package/lib/commands/role/index.js +1 -1
  57. package/lib/commands/role/list.js +1 -1
  58. package/lib/commands/role/shared.js +1 -1
  59. package/lib/commands/role/update.js +1 -1
  60. package/lib/commands/role/user-add.js +1 -1
  61. package/lib/commands/role/user-remove.js +1 -1
  62. package/lib/commands/schedule/index.js +1 -1
  63. package/lib/commands/schema.js +1 -1
  64. package/lib/commands/service/dynamic.js +1 -1
  65. package/lib/commands/service/function-name-adapter.js +1 -1
  66. package/lib/commands/service/index.js +1 -1
  67. package/lib/commands/service/registry.js +1 -1
  68. package/lib/commands/skill/commands/create.js +1 -1
  69. package/lib/commands/skill/commands/diagram.js +1 -1
  70. package/lib/commands/skill/commands/install.js +1 -1
  71. package/lib/commands/skill/commands/list.js +1 -1
  72. package/lib/commands/skill/commands/push.js +1 -1
  73. package/lib/commands/skill/commands/validate.js +1 -1
  74. package/lib/commands/skill/diagram.js +1 -1
  75. package/lib/commands/skill/flags.js +1 -1
  76. package/lib/commands/skill/index.js +1 -1
  77. package/lib/commands/skill/manifest-helpers.js +1 -1
  78. package/lib/commands/skill/push-execute.js +1 -1
  79. package/lib/commands/skill/push-flow-helpers.js +1 -1
  80. package/lib/commands/skill/push-retarget.js +1 -1
  81. package/lib/commands/skill/scopes.js +1 -1
  82. package/lib/commands/skill/summary.js +1 -1
  83. package/lib/commands/skill/templates.js +1 -1
  84. package/lib/commands/skill/validate.js +1 -1
  85. package/lib/commands/sql/detail.js +1 -1
  86. package/lib/commands/sql/exec.js +1 -1
  87. package/lib/commands/sql/index.js +1 -1
  88. package/lib/commands/update.js +1 -1
  89. package/lib/commands/user-account/bind.js +1 -1
  90. package/lib/commands/user-account/index.js +1 -1
  91. package/lib/commands/workspace/index.js +1 -1
  92. package/lib/config/domain-config.js +1 -1
  93. package/lib/config/schema.js +1 -1
  94. package/lib/constant/app.js +1 -1
  95. package/lib/constant/auth-mode.js +1 -1
  96. package/lib/constant/cli.js +1 -1
  97. package/lib/constant/defaults.js +1 -1
  98. package/lib/constant/distribution.js +1 -1
  99. package/lib/constant/domain.js +1 -1
  100. package/lib/constant/env.js +1 -1
  101. package/lib/constant/output.js +1 -1
  102. package/lib/constant/product.js +1 -1
  103. package/lib/constant/region.js +1 -1
  104. package/lib/constant/risk.js +1 -1
  105. package/lib/constant/url.js +1 -1
  106. package/lib/context.js +1 -1
  107. package/lib/core/api-client.d.ts +6 -6
  108. package/lib/core/api-client.js +1 -1
  109. package/lib/core/db-resolver.js +1 -1
  110. package/lib/core/kb-management-client.d.ts +5 -3
  111. package/lib/core/kb-management-client.js +1 -1
  112. package/lib/core/kb-search-client.d.ts +6 -1
  113. package/lib/core/kb-search-client.js +1 -1
  114. package/lib/core/sdk-client.js +1 -1
  115. package/lib/errors.js +1 -1
  116. package/lib/framework/access-error.js +1 -1
  117. package/lib/framework/build-all-flags.js +1 -1
  118. package/lib/framework/dryrun.js +1 -1
  119. package/lib/framework/flags.js +1 -1
  120. package/lib/framework/help.js +1 -1
  121. package/lib/framework/index.js +1 -1
  122. package/lib/framework/output.js +1 -1
  123. package/lib/framework/preparse.js +1 -1
  124. package/lib/framework/rate-limit.js +1 -1
  125. package/lib/framework/raw-flags.js +1 -1
  126. package/lib/framework/response.js +1 -1
  127. package/lib/framework/runner-confirmation.js +1 -1
  128. package/lib/framework/runner-error.js +1 -1
  129. package/lib/framework/runner.js +1 -1
  130. package/lib/framework/schema-export.js +1 -1
  131. package/lib/framework/service-order.js +1 -1
  132. package/lib/framework/types.js +1 -1
  133. package/lib/generated/build-info.d.ts +4 -4
  134. package/lib/generated/build-info.js +1 -1
  135. package/lib/generated/official-routing.js +1 -1
  136. package/lib/generated/routing-contract.js +1 -1
  137. package/lib/help.js +1 -1
  138. package/lib/postinstall.js +1 -1
  139. package/lib/runtime/confirmation.js +1 -1
  140. package/lib/runtime/event.js +1 -1
  141. package/lib/runtime/index.js +1 -1
  142. package/lib/runtime/queue.js +1 -1
  143. package/lib/runtime/resolve.js +1 -1
  144. package/lib/services/dataset-import/auto-id-runner.js +1 -1
  145. package/lib/services/dataset-import/excel-reader.js +1 -1
  146. package/lib/services/dataset-import/image-bytes.js +1 -1
  147. package/lib/services/dataset-import/image-ooxml.js +1 -1
  148. package/lib/services/dataset-import/image-runner.js +1 -1
  149. package/lib/services/dataset-import/metadata.js +1 -1
  150. package/lib/services/dataset-import/preview.js +1 -1
  151. package/lib/services/dataset-import/runner.js +1 -1
  152. package/lib/skills/builtin-skill.js +1 -1
  153. package/lib/skills/npx-skills-add.js +1 -1
  154. package/lib/skills/runtime-skill-sync/constants.js +1 -1
  155. package/lib/skills/runtime-skill-sync/fs-utils.js +1 -1
  156. package/lib/skills/runtime-skill-sync/hashing.js +1 -1
  157. package/lib/skills/runtime-skill-sync/install-target.js +1 -1
  158. package/lib/skills/runtime-skill-sync/links.js +1 -1
  159. package/lib/skills/runtime-skill-sync/list-local.js +1 -1
  160. package/lib/skills/runtime-skill-sync/local-files.js +1 -1
  161. package/lib/skills/runtime-skill-sync/materialize.js +1 -1
  162. package/lib/skills/runtime-skill-sync/metadata.js +1 -1
  163. package/lib/skills/runtime-skill-sync/paths.js +1 -1
  164. package/lib/skills/runtime-skill-sync/push.js +1 -1
  165. package/lib/skills/runtime-skill-sync/scopes.js +1 -1
  166. package/lib/skills/runtime-skill-sync/zip-codec.js +1 -1
  167. package/lib/skills/runtime-skill-sync/zip-package.js +1 -1
  168. package/lib/skills/runtime-skill-sync.js +1 -1
  169. package/lib/skills/skill-presence.js +1 -1
  170. package/lib/utils/access-key-redaction.js +1 -1
  171. package/lib/utils/apply-jq-filter.js +1 -1
  172. package/lib/utils/cli-version-check.js +1 -1
  173. package/lib/utils/cli-version-policy.js +1 -1
  174. package/lib/utils/logger.js +1 -1
  175. package/lib/utils/lossless-json.js +1 -1
  176. package/lib/utils/params.js +1 -1
  177. package/lib/utils/positive-safe-integer.js +1 -1
  178. package/lib/utils/redaction.js +1 -1
  179. package/lib/utils/update-notice.js +1 -1
  180. package/lib/utils/version.js +1 -1
  181. package/lib/utils/write-cli-side-channel.js +1 -1
  182. package/package.json +1 -1
  183. package/skills/lovrabet/SKILL.md +2 -2
  184. package/skills/lovrabet/references/lovrabet-kb-workflow.md +9 -5
  185. package/skills/lovrabet.manifest.json +3 -3
@@ -1 +1 @@
1
- const a146_0x18e918=a146_0x3dbd;(function(_0x15838d,_0x3272a6){const _0x3f0550=a146_0x3dbd,_0x5857f3=_0x15838d();while(!![]){try{const _0x33869a=parseInt(_0x3f0550(0x266))/0x1+-parseInt(_0x3f0550(0x20d))/0x2*(parseInt(_0x3f0550(0x213))/0x3)+-parseInt(_0x3f0550(0x1ec))/0x4+-parseInt(_0x3f0550(0x1f9))/0x5+parseInt(_0x3f0550(0x1e2))/0x6+parseInt(_0x3f0550(0x22a))/0x7*(-parseInt(_0x3f0550(0x228))/0x8)+-parseInt(_0x3f0550(0x219))/0x9*(-parseInt(_0x3f0550(0x217))/0xa);if(_0x33869a===_0x3272a6)break;else _0x5857f3['push'](_0x5857f3['shift']());}catch(_0x32511f){_0x5857f3['push'](_0x5857f3['shift']());}}}(a146_0x1254,0xb5700));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(_0x42f088){const _0x50413e=a146_0x3dbd;if(Array['isArray'](_0x42f088))return'['+_0x42f088[_0x50413e(0x1dd)](canonical)[_0x50413e(0x254)](',')+']';if(_0x42f088&&typeof _0x42f088===_0x50413e(0x1ea))return'{'+Object[_0x50413e(0x265)](_0x42f088)[_0x50413e(0x22d)]()[_0x50413e(0x1dd)](_0x47e995=>JSON[_0x50413e(0x1e0)](_0x47e995)+':'+canonical(_0x42f088[_0x47e995]))[_0x50413e(0x254)](',')+'}';return JSON[_0x50413e(0x1e0)](_0x42f088)??_0x50413e(0x216);}function a146_0x1254(){const _0x20b71d=['Import\x20primary\x20key\x20collision;\x20stop\x20without\x20replacing\x20the\x20fixed\x20IDs.','source','warnings','422560aUgxAo','Import\x20checkpoint\x20contains\x20a\x20content\x20conflict.','63aJbXpm','resume','parse','sort','name','pois','Import\x20input,\x20output\x20and\x20lock\x20paths\x20must\x20be\x20different\x20files.','.lock','now','some','.recovery','binding','datasetCode','length','sheet','succeeded','has','Invalid\x20or\x20duplicate\x20import\x20readback\x20ID.','address','schemaHash','actorId','Import\x20output\x20must\x20not\x20be\x20a\x20symbolic\x20link.','message','set','hex','METADATA','Import\x20lock\x20changed;\x20retry\x20recovery.','unsent','maxBatchBytes','schemaFingerprint','slice','isInteger','schemaVersion','forEach','conflict','string','add','mappingHash','.lock.recovery','road','Import\x20checkpoint\x20does\x20not\x20match\x20the\x20input,\x20target\x20or\x20identity.','every','join','fixed-negative-id','The\x20fixed-ID\x20runner\x20requires\x20the\x20v1\x20import\x20contract.','sync','runtimeDomain','pid','elapsedMs','previewUrl','fileHash','Import\x20lock\x20recovery\x20is\x20active\x20or\x20interrupted;\x20inspect\x20the\x20recovery\x20guard\x20before\x20retrying.','emptyRows','The\x20server\x20import\x20contract\x20is\x20unsupported\x20or\x20incomplete.','latitude','close','token','Invalid\x20import\x20batch\x20size.','isArray','keys','600599vrcwjg','ENOENT','map','rowNumber','entries','stringify','Cannot\x20read\x20the\x20import\x20checkpoint.','3447258lQdzjm','Import\x20content\x20conflict\x20at\x20Excel\x20row\x20','size','geolocation','isSafeInteger','rows','isSymbolicLink','batchSize','object','incomplete','897612uEFzyL','\x20exceeds\x20the\x20import\x20request\x20size\x20limit.','cityAdcode','Invalid\x20import\x20lock\x20owner.','version','includes','city','districtAdcode','Excel\x20contains\x20no\x20valid\x20data\x20rows.','ids','readback','Import\x20checkpoint\x20already\x20exists;\x20use\x20--resume.','netType','551455VoRyuY','auto-id-task-marker','toString','Excel\x20contains\x20invalid\x20rows;\x20no\x20data\x20was\x20written.','filter','Incomplete\x20readback.','byteLength','streetNumber','push','country','url','Invalid\x20write\x20result.','province','code','dingTalkUrl','createUserId','The\x20import\x20checkpoint\x20is\x20locked\x20by\x20a\x20running\x20process.','utf8','operatorType','report','62hEIDSk','createUserName','Previously\x20imported\x20records\x20are\x20no\x20longer\x20visible;\x20recovery\x20stopped.','appCode','type','maxBatchSize','32355sCsEmU','Excel\x20row\x20','writeFile','undefined','50zZRVbK','write','1282383XbEOat','checkpoint','longitude','pending','.tmp-','key','accuracy','errorMessage','status','onCheckpointReady','ESRCH','values'];a146_0x1254=function(){return _0x20b71d;};return a146_0x1254();}const EMPTY_IMAGE_LOCATION_FIELDS=new Set(['time',a146_0x18e918(0x20b),a146_0x18e918(0x1f3),'district',a146_0x18e918(0x22f),a146_0x18e918(0x251),a146_0x18e918(0x202),'countryCode',a146_0x18e918(0x205),a146_0x18e918(0x260),a146_0x18e918(0x1f2),a146_0x18e918(0x1f8),'resultCode',a146_0x18e918(0x200),a146_0x18e918(0x21f),a146_0x18e918(0x21b),a146_0x18e918(0x1ee),a146_0x18e918(0x220),a146_0x18e918(0x23c),'lbswuaCacheId']);export function sameImportValue(_0x53f55f,_0x35b916,_0xc821e1=![]){const _0x4ac5e8=a146_0x18e918;if(_0xc821e1){const _0x406a24=_0x14383b=>Array[_0x4ac5e8(0x264)](_0x14383b)?_0x14383b[_0x4ac5e8(0x1dd)](_0x2d6849=>{const _0xa6e01b=_0x4ac5e8;if(!_0x2d6849||typeof _0x2d6849!==_0xa6e01b(0x1ea)||Array['isArray'](_0x2d6849))return _0x2d6849;const _0x23c0e2={..._0x2d6849};delete _0x23c0e2[_0xa6e01b(0x203)],delete _0x23c0e2[_0xa6e01b(0x25b)];if(_0x23c0e2[_0xa6e01b(0x207)]==='')delete _0x23c0e2[_0xa6e01b(0x207)];if(_0x23c0e2['createUserId']==null)delete _0x23c0e2[_0xa6e01b(0x208)];if(_0x23c0e2['createUserName']==null)delete _0x23c0e2[_0xa6e01b(0x20e)];if(_0x23c0e2[_0xa6e01b(0x1e5)]==null||typeof _0x23c0e2['geolocation']==='object'&&!Array[_0xa6e01b(0x264)](_0x23c0e2[_0xa6e01b(0x1e5)])&&Object[_0xa6e01b(0x1df)](_0x23c0e2['geolocation'])[_0xa6e01b(0x253)](([_0x4f4ed5,_0x1ae0c3])=>EMPTY_IMAGE_LOCATION_FIELDS['has'](_0x4f4ed5)&&_0x1ae0c3===null))delete _0x23c0e2[_0xa6e01b(0x1e5)];for(const _0x13b0bd of[_0xa6e01b(0x22e),_0xa6e01b(0x211),_0xa6e01b(0x21e)])if(!(_0x13b0bd in _0x23c0e2))_0x23c0e2[_0x13b0bd]='';if(_0x23c0e2[_0xa6e01b(0x1e4)]==null)_0x23c0e2[_0xa6e01b(0x1e4)]=0x0;return _0x23c0e2;}):_0x14383b;return canonical(_0x406a24(_0x53f55f))===canonical(_0x406a24(_0x35b916));}return _0x53f55f===null?_0x35b916===null||_0x35b916===undefined:canonical(_0x35b916)===canonical(_0x53f55f);}async function rejectSymlink(_0x52ebcc){const _0x292e1b=a146_0x18e918;try{if((await lstat(_0x52ebcc))[_0x292e1b(0x1e8)]())throw Error(_0x292e1b(0x23f));}catch(_0x4ab58b){if(_0x4ab58b[_0x292e1b(0x206)]!==_0x292e1b(0x267))throw _0x4ab58b;}}export async function resolveImportOutputPath(_0x4c8531){return await rejectSymlink(_0x4c8531),resolve(await realpath(dirname(resolve(_0x4c8531))),basename(_0x4c8531));}export function assertImportPaths(_0x356410,_0x419522,_0x2caa9d=[]){const _0x1ee320=a146_0x18e918,_0x39149a=[..._0x2caa9d,_0x356410,_0x419522,_0x356410+'.lock',_0x356410+_0x1ee320(0x250)][_0x1ee320(0x1dd)](_0xc0c8e2=>resolve(_0xc0c8e2));if(new Set(_0x39149a)[_0x1ee320(0x1e4)]!==_0x39149a['length'])throw Error(_0x1ee320(0x230));}function a146_0x3dbd(_0x5b6674,_0x38fbcd){_0x5b6674=_0x5b6674-0x1dd;const _0x1254a5=a146_0x1254();let _0x3dbd59=_0x1254a5[_0x5b6674];return _0x3dbd59;}export async function saveImportJson(_0x13b9a8,_0x7f8fdc){const _0x5a2226=a146_0x18e918;await rejectSymlink(_0x13b9a8);const _0x499339=_0x13b9a8+_0x5a2226(0x21d)+randomUUID(),_0x198bbf=await open(_0x499339,'wx',0x180);try{await _0x198bbf[_0x5a2226(0x215)](JSON['stringify'](_0x7f8fdc,null,0x2)),await _0x198bbf[_0x5a2226(0x257)]();}finally{await _0x198bbf[_0x5a2226(0x261)]();}try{await rename(_0x499339,_0x13b9a8);}catch(_0x15a336){await unlink(_0x499339)['catch'](()=>{});throw _0x15a336;}}export async function acquireLock(_0x529dca){const _0x5637b0=a146_0x18e918,_0x31998b=_0x529dca+_0x5637b0(0x231),_0x4bdf7e=randomUUID();await rejectSymlink(_0x31998b);const _0x3ee573=_0x31998b+_0x5637b0(0x234);let _0x496cfb,_0x13ed2a;try{try{_0x496cfb=await open(_0x31998b,'wx',0x180);}catch(_0xfb4500){if(_0xfb4500[_0x5637b0(0x206)]!=='EEXIST')throw _0xfb4500;try{_0x13ed2a=await open(_0x3ee573,'wx',0x180);}catch(_0x3515df){if(_0x3515df[_0x5637b0(0x206)]==='EEXIST')throw Error(_0x5637b0(0x25d));throw _0x3515df;}await _0x13ed2a[_0x5637b0(0x215)](JSON[_0x5637b0(0x1e0)]({'pid':process['pid'],'token':_0x4bdf7e})),await _0x13ed2a[_0x5637b0(0x257)](),await rejectSymlink(_0x31998b);let _0x48969e;try{_0x48969e=await readFile(_0x31998b,_0x5637b0(0x20a));}catch(_0x2fc891){if(_0x2fc891[_0x5637b0(0x206)]!==_0x5637b0(0x267))throw _0x2fc891;}if(_0x48969e!==undefined){let _0x206556;try{_0x206556=JSON[_0x5637b0(0x22c)](_0x48969e);}catch{throw Error('Invalid\x20import\x20lock;\x20inspect\x20it\x20before\x20recovery.');}if(!_0x206556||!Number[_0x5637b0(0x1e6)](_0x206556['pid'])||_0x206556[_0x5637b0(0x259)]<=0x0)throw Error(_0x5637b0(0x1ef));try{process['kill'](_0x206556['pid'],0x0);throw Error(_0x5637b0(0x209));}catch(_0x3e1590){if(_0x3e1590[_0x5637b0(0x206)]!==_0x5637b0(0x223))throw _0x3e1590;}if(await readFile(_0x31998b,_0x5637b0(0x20a))!==_0x48969e)throw Error(_0x5637b0(0x244));await unlink(_0x31998b);}_0x496cfb=await open(_0x31998b,'wx',0x180);}await _0x496cfb[_0x5637b0(0x215)](JSON[_0x5637b0(0x1e0)]({'pid':process['pid'],'token':_0x4bdf7e})),await _0x496cfb[_0x5637b0(0x257)]();}finally{try{await _0x496cfb?.[_0x5637b0(0x261)]();}finally{if(_0x13ed2a)try{await _0x13ed2a[_0x5637b0(0x261)]();}finally{await unlink(_0x3ee573);}}}return async()=>{const _0x5ea172=_0x5637b0;if(JSON[_0x5ea172(0x22c)](await readFile(_0x31998b,_0x5ea172(0x20a)))[_0x5ea172(0x262)]===_0x4bdf7e)await unlink(_0x31998b);};}export function assertImportContract(_0x3fd40e,_0xdffed6,_0x227190){const _0x16b258=a146_0x18e918;if(!_0x3fd40e||!(_0x3fd40e[_0x16b258(0x24a)]===0x1&&_0x3fd40e['strategy']===_0x16b258(0x255)||_0x3fd40e[_0x16b258(0x24a)]===0x2&&_0x3fd40e['strategy']===_0x16b258(0x1fa))||_0x3fd40e[_0x16b258(0x226)]!==_0x16b258(0x243)||_0x3fd40e['appCode']!==_0xdffed6||_0x3fd40e['datasetCode']!==_0x227190||typeof _0x3fd40e[_0x16b258(0x23e)]!==_0x16b258(0x24d)||!_0x3fd40e[_0x16b258(0x23e)]||typeof _0x3fd40e[_0x16b258(0x247)]!==_0x16b258(0x24d)||!_0x3fd40e[_0x16b258(0x247)]||!Number[_0x16b258(0x1e6)](_0x3fd40e[_0x16b258(0x212)])||_0x3fd40e[_0x16b258(0x212)]<0x1||_0x3fd40e['maxBatchSize']>0x3e8||!Number[_0x16b258(0x1e6)](_0x3fd40e['maxBatchBytes'])||_0x3fd40e[_0x16b258(0x246)]<0x1||_0x3fd40e[_0x16b258(0x246)]>0x14*0x400*0x400)throw Error(_0x16b258(0x25f));}export async function runExcelImport(_0xf5019b){const _0x32b1a5=a146_0x18e918;_0xf5019b={..._0xf5019b,'checkpoint':await resolveImportOutputPath(_0xf5019b['checkpoint']),'report':await resolveImportOutputPath(_0xf5019b[_0x32b1a5(0x20c)])};const {manifest:_0x33f4e7,contract:_0x51004c,api:_0x455b12}=_0xf5019b;assertImportContract(_0x51004c,_0xf5019b[_0x32b1a5(0x210)],_0xf5019b[_0x32b1a5(0x236)]);if(_0x51004c[_0x32b1a5(0x24a)]!==0x1)throw Error(_0x32b1a5(0x256));if(_0x33f4e7['errors'][_0x32b1a5(0x237)])throw Error(_0x32b1a5(0x1fc));if(!_0x33f4e7[_0x32b1a5(0x1e7)]['length'])throw Error(_0x32b1a5(0x1f4));if(!Number[_0x32b1a5(0x249)](_0xf5019b['batchSize'])||_0xf5019b['batchSize']<0x1||_0xf5019b[_0x32b1a5(0x1e9)]>_0x51004c[_0x32b1a5(0x212)])throw Error(_0x32b1a5(0x263));for(const _0x2318bf of _0x33f4e7[_0x32b1a5(0x1e7)]){if(Buffer[_0x32b1a5(0x1ff)](JSON[_0x32b1a5(0x1e0)]({'schemaFingerprint':_0x51004c[_0x32b1a5(0x247)],'items':[{..._0x2318bf[_0x32b1a5(0x224)],'id':-0x1fffffffffffff}]}),'utf8')>_0x51004c[_0x32b1a5(0x246)])throw Error(_0x32b1a5(0x214)+_0x2318bf[_0x32b1a5(0x1de)]+_0x32b1a5(0x1ed));}assertImportPaths(_0xf5019b[_0x32b1a5(0x21a)],_0xf5019b[_0x32b1a5(0x20c)]);const _0x2562c2={'appCode':_0xf5019b[_0x32b1a5(0x210)],'datasetCode':_0xf5019b['datasetCode'],'runtimeDomain':_0xf5019b[_0x32b1a5(0x258)],'actorId':_0x51004c[_0x32b1a5(0x23e)],'fileHash':_0x33f4e7[_0x32b1a5(0x25c)],'mappingHash':_0x33f4e7[_0x32b1a5(0x24f)],'schemaHash':_0x33f4e7[_0x32b1a5(0x23d)],'remoteSchemaHash':_0x51004c[_0x32b1a5(0x247)],'batchSize':_0xf5019b['batchSize'],'sheet':_0x33f4e7[_0x32b1a5(0x238)]},_0x1e36d1=await acquireLock(_0xf5019b[_0x32b1a5(0x21a)]);let _0x4d2d02;const _0x27b198=Date[_0x32b1a5(0x232)]();let _0x52f3a4=0x0;const _0x377f85=[],_0x2fb47a=()=>({'importId':_0x4d2d02?.['importId'],'sourceRows':_0x33f4e7[_0x32b1a5(0x1e7)]['length'],'emptyRows':_0x33f4e7[_0x32b1a5(0x25e)][_0x32b1a5(0x237)],'succeeded':_0x4d2d02?.[_0x32b1a5(0x1e7)][_0x32b1a5(0x1fd)](_0x20dfb=>_0x20dfb['status']===_0x32b1a5(0x239))['length']??0x0,'unknown':_0x4d2d02?.[_0x32b1a5(0x1e7)][_0x32b1a5(0x1fd)](_0x342056=>_0x342056['status']==='pending')['length']??0x0,'conflicts':_0x4d2d02?.[_0x32b1a5(0x1e7)][_0x32b1a5(0x1fd)](_0x5e56b8=>_0x5e56b8[_0x32b1a5(0x221)]===_0x32b1a5(0x24c))[_0x32b1a5(0x237)]??0x0,'notAttempted':_0x4d2d02?.[_0x32b1a5(0x1e7)][_0x32b1a5(0x1fd)](_0x474ec8=>_0x474ec8[_0x32b1a5(0x221)]===_0x32b1a5(0x245))[_0x32b1a5(0x237)]??_0x33f4e7[_0x32b1a5(0x1e7)]['length'],'batches':_0x52f3a4,'batchResults':_0x377f85,'elapsedMs':Date[_0x32b1a5(0x232)]()-_0x27b198,'checkpoint':resolve(_0xf5019b[_0x32b1a5(0x21a)]),'report':resolve(_0xf5019b['report']),'warnings':_0x33f4e7[_0x32b1a5(0x227)]});try{await rejectSymlink(_0xf5019b[_0x32b1a5(0x21a)]);if(_0xf5019b[_0x32b1a5(0x22b)]){try{_0x4d2d02=JSON['parse'](await readFile(_0xf5019b['checkpoint'],'utf8'));}catch{throw Error(_0x32b1a5(0x1e1));}if(!_0x4d2d02||_0x4d2d02[_0x32b1a5(0x1f0)]!==0x1||typeof _0x4d2d02['importId']!==_0x32b1a5(0x24d)||canonical(_0x4d2d02[_0x32b1a5(0x235)])!==canonical(_0x2562c2)||!Array[_0x32b1a5(0x264)](_0x4d2d02['rows'])||_0x4d2d02[_0x32b1a5(0x1e7)][_0x32b1a5(0x237)]!==_0x33f4e7[_0x32b1a5(0x1e7)][_0x32b1a5(0x237)]||new Set(_0x4d2d02['rows']['map'](_0x1847dd=>_0x1847dd['id']))[_0x32b1a5(0x1e4)]!==_0x4d2d02[_0x32b1a5(0x1e7)][_0x32b1a5(0x237)]||_0x4d2d02['rows']['some']((_0x38ae51,_0x260021)=>!Number[_0x32b1a5(0x1e6)](_0x38ae51['id'])||_0x38ae51['id']>=0x0||_0x38ae51[_0x32b1a5(0x1de)]!==_0x33f4e7['rows'][_0x260021][_0x32b1a5(0x1de)]||![_0x32b1a5(0x245),_0x32b1a5(0x21c),_0x32b1a5(0x239),'conflict']['includes'](_0x38ae51['status'])))throw Error(_0x32b1a5(0x252));}else{try{await lstat(_0xf5019b[_0x32b1a5(0x21a)]);throw Error(_0x32b1a5(0x1f7));}catch(_0x1dd2a7){if(_0x1dd2a7[_0x32b1a5(0x206)]!==_0x32b1a5(0x267))throw _0x1dd2a7;}const _0x267fc0=new Set();_0x4d2d02={'version':0x1,'importId':randomUUID(),'binding':_0x2562c2,'rows':_0x33f4e7['rows'][_0x32b1a5(0x1dd)](_0xf1a216=>{const _0xd61678=_0x32b1a5;let _0x47b8d9;do{_0x47b8d9=-(Number(BigInt('0x'+randomBytes(0x7)[_0xd61678(0x1fb)](_0xd61678(0x242)))&(0x1n<<0x34n)-0x1n)+0x1);}while(_0x267fc0[_0xd61678(0x23a)](_0x47b8d9));return _0x267fc0[_0xd61678(0x24e)](_0x47b8d9),{'id':_0x47b8d9,'rowNumber':_0xf1a216[_0xd61678(0x1de)],'status':_0xd61678(0x245)};})},await saveImportJson(_0xf5019b[_0x32b1a5(0x21a)],_0x4d2d02);}await _0xf5019b[_0x32b1a5(0x222)]?.();const _0x282929=_0x4d2d02;if(_0x282929[_0x32b1a5(0x1e7)][_0x32b1a5(0x233)](_0x47ac08=>_0x47ac08[_0x32b1a5(0x221)]===_0x32b1a5(0x24c)))throw Error(_0x32b1a5(0x229));const _0x123bb0=async _0x2fc79c=>{const _0x337a63=_0x32b1a5,_0x2b114e=await _0x455b12[_0x337a63(0x1f6)](_0x2fc79c[_0x337a63(0x1dd)](_0x17dba8=>_0x282929[_0x337a63(0x1e7)][_0x17dba8]['id']));if(!Array[_0x337a63(0x264)](_0x2b114e))throw Error('Invalid\x20import\x20readback\x20response.');const _0x3861d6=new Set(_0x2fc79c[_0x337a63(0x1dd)](_0x2577e0=>_0x282929[_0x337a63(0x1e7)][_0x2577e0]['id'])),_0x21cc5c=new Map();for(const _0x9a600a of _0x2b114e){const _0x5e778e=Number(_0x9a600a?.['id']);if(!_0x3861d6[_0x337a63(0x23a)](_0x5e778e)||_0x21cc5c[_0x337a63(0x23a)](_0x5e778e))throw Error(_0x337a63(0x23b));_0x21cc5c[_0x337a63(0x241)](_0x5e778e,_0x9a600a);}for(const _0x5e6f2b of _0x2fc79c){const _0x5d9129=_0x21cc5c['get'](_0x282929[_0x337a63(0x1e7)][_0x5e6f2b]['id']);if(!_0x5d9129)continue;if(_0x282929[_0x337a63(0x1e7)][_0x5e6f2b][_0x337a63(0x221)]===_0x337a63(0x245)){_0x282929[_0x337a63(0x1e7)][_0x5e6f2b][_0x337a63(0x221)]=_0x337a63(0x24c),await saveImportJson(_0xf5019b[_0x337a63(0x21a)],_0x282929);throw Error(_0x337a63(0x225));}const _0xdbf612=_0x33f4e7[_0x337a63(0x1e7)][_0x5e6f2b]['values'];if(Object[_0x337a63(0x265)](_0xdbf612)[_0x337a63(0x233)](_0x3f606c=>!sameImportValue(_0xdbf612[_0x3f606c],_0x5d9129[_0x3f606c],_0x33f4e7['imageFields']?.[_0x337a63(0x1f1)](_0x3f606c)&&!_0x33f4e7['uploadFields']?.[_0x337a63(0x1f1)](_0x3f606c)))){_0x282929[_0x337a63(0x1e7)][_0x5e6f2b][_0x337a63(0x221)]='conflict',await saveImportJson(_0xf5019b[_0x337a63(0x21a)],_0x282929);throw Error(_0x337a63(0x1e3)+_0x282929['rows'][_0x5e6f2b]['rowNumber']+'.');}_0x282929['rows'][_0x5e6f2b]['status']=_0x337a63(0x239);}return await saveImportJson(_0xf5019b[_0x337a63(0x21a)],_0x282929),_0x21cc5c;};if(_0xf5019b[_0x32b1a5(0x22b)])for(let _0x56cc73=0x0;_0x56cc73<_0x282929[_0x32b1a5(0x1e7)][_0x32b1a5(0x237)];_0x56cc73+=_0xf5019b[_0x32b1a5(0x1e9)]){const _0xead924=_0x282929[_0x32b1a5(0x1e7)][_0x32b1a5(0x248)](_0x56cc73,_0x56cc73+_0xf5019b[_0x32b1a5(0x1e9)])[_0x32b1a5(0x1dd)]((_0x2ff1c4,_0x34991e)=>_0x56cc73+_0x34991e),_0x212c2a=_0xead924[_0x32b1a5(0x1fd)](_0x515ab5=>_0x282929[_0x32b1a5(0x1e7)][_0x515ab5][_0x32b1a5(0x221)]===_0x32b1a5(0x239)),_0x51c35c=await _0x123bb0(_0xead924),_0x2888c4=_0x212c2a[_0x32b1a5(0x1fd)](_0x1196c0=>!_0x51c35c[_0x32b1a5(0x23a)](_0x282929[_0x32b1a5(0x1e7)][_0x1196c0]['id']));if(_0x2888c4[_0x32b1a5(0x237)]){_0x2888c4['forEach'](_0x447b09=>{const _0x4130ef=_0x32b1a5;_0x282929[_0x4130ef(0x1e7)][_0x447b09][_0x4130ef(0x221)]=_0x4130ef(0x24c);}),await saveImportJson(_0xf5019b['checkpoint'],_0x282929);throw Error(_0x32b1a5(0x20f));}}for(let _0x4d4311=0x0;_0x4d4311<_0x282929[_0x32b1a5(0x1e7)][_0x32b1a5(0x237)];){const _0x4b82ad=[],_0x4676fd=[];while(_0x4d4311<_0x282929[_0x32b1a5(0x1e7)][_0x32b1a5(0x237)]&&_0x4676fd[_0x32b1a5(0x237)]<_0xf5019b['batchSize']){const _0x2ffc83=_0x4d4311++;if(_0x282929[_0x32b1a5(0x1e7)][_0x2ffc83][_0x32b1a5(0x221)]===_0x32b1a5(0x239))continue;const _0x10bb69={..._0x33f4e7[_0x32b1a5(0x1e7)][_0x2ffc83]['values'],'id':_0x282929[_0x32b1a5(0x1e7)][_0x2ffc83]['id']};if(Buffer[_0x32b1a5(0x1ff)](JSON[_0x32b1a5(0x1e0)]({'schemaFingerprint':_0x51004c[_0x32b1a5(0x247)],'items':[..._0x4676fd,_0x10bb69]}),_0x32b1a5(0x20a))>_0x51004c[_0x32b1a5(0x246)]){if(!_0x4676fd[_0x32b1a5(0x237)])throw Error('Excel\x20row\x20'+_0x282929['rows'][_0x2ffc83][_0x32b1a5(0x1de)]+_0x32b1a5(0x1ed));_0x4d4311--;break;}_0x4b82ad[_0x32b1a5(0x201)](_0x2ffc83),_0x4676fd[_0x32b1a5(0x201)](_0x10bb69);}if(!_0x4676fd[_0x32b1a5(0x237)])continue;const _0x461c8b=_0x4b82ad[_0x32b1a5(0x1fd)](_0x1488cc=>_0x282929['rows'][_0x1488cc][_0x32b1a5(0x221)]===_0x32b1a5(0x245));if(_0x461c8b[_0x32b1a5(0x237)]){const _0x4e1f53=await _0x455b12['readback'](_0x461c8b[_0x32b1a5(0x1dd)](_0x5f5497=>_0x282929[_0x32b1a5(0x1e7)][_0x5f5497]['id']));if(!Array[_0x32b1a5(0x264)](_0x4e1f53))throw Error('Invalid\x20import\x20readback\x20response.');if(_0x4e1f53[_0x32b1a5(0x237)])throw Error(_0x32b1a5(0x225));}_0x4b82ad[_0x32b1a5(0x24b)](_0x5ad9a0=>{const _0x11420f=_0x32b1a5;_0x282929['rows'][_0x5ad9a0][_0x11420f(0x221)]=_0x11420f(0x21c);}),await saveImportJson(_0xf5019b[_0x32b1a5(0x21a)],_0x282929),_0x52f3a4++;const _0x1f3888=Date['now'](),_0x3fce60={'batch':_0x52f3a4,'rowStart':_0x282929[_0x32b1a5(0x1e7)][_0x4b82ad[0x0]][_0x32b1a5(0x1de)],'rowEnd':_0x282929['rows'][_0x4b82ad[_0x4b82ad[_0x32b1a5(0x237)]-0x1]][_0x32b1a5(0x1de)],'count':_0x4676fd[_0x32b1a5(0x237)],'bytes':Buffer[_0x32b1a5(0x1ff)](JSON['stringify']({'schemaFingerprint':_0x51004c[_0x32b1a5(0x247)],'items':_0x4676fd}),'utf8'),'elapsedMs':0x0,'status':'unknown'};_0x377f85[_0x32b1a5(0x201)](_0x3fce60);try{const _0x31db5e=await _0x455b12[_0x32b1a5(0x218)](_0x4676fd);if(!_0x31db5e||_0x31db5e['count']!==_0x4676fd[_0x32b1a5(0x237)]||!Array[_0x32b1a5(0x264)](_0x31db5e[_0x32b1a5(0x1f5)])||_0x31db5e[_0x32b1a5(0x1f5)]['length']!==_0x4676fd[_0x32b1a5(0x237)]||_0x31db5e[_0x32b1a5(0x1f5)]['some']((_0x3d5d4f,_0x2b449c)=>Number(_0x3d5d4f)!==_0x282929[_0x32b1a5(0x1e7)][_0x4b82ad[_0x2b449c]]['id']))throw Error(_0x32b1a5(0x204));await _0x123bb0(_0x4b82ad);if(_0x4b82ad[_0x32b1a5(0x233)](_0x2cfb57=>_0x282929['rows'][_0x2cfb57][_0x32b1a5(0x221)]!=='succeeded'))throw Error(_0x32b1a5(0x1fe));}catch(_0x276a10){if(_0x282929[_0x32b1a5(0x1e7)][_0x32b1a5(0x233)](_0x37cfb2=>_0x37cfb2['status']===_0x32b1a5(0x24c)))throw _0x276a10;try{await _0x123bb0(_0x4b82ad);}catch(_0x37c9ec){if(_0x282929[_0x32b1a5(0x1e7)]['some'](_0x5d6291=>_0x5d6291['status']===_0x32b1a5(0x24c)))throw _0x37c9ec;}if(_0x4b82ad[_0x32b1a5(0x233)](_0x136875=>_0x282929['rows'][_0x136875][_0x32b1a5(0x221)]!==_0x32b1a5(0x239)))throw Error('The\x20import\x20write\x20outcome\x20is\x20unknown.\x20Resume\x20to\x20reconcile\x20the\x20fixed\x20IDs\x20before\x20continuing.');}finally{_0x3fce60[_0x32b1a5(0x25a)]=Date[_0x32b1a5(0x232)]()-_0x1f3888;if(_0x4b82ad[_0x32b1a5(0x253)](_0x3a1b1f=>_0x282929[_0x32b1a5(0x1e7)][_0x3a1b1f][_0x32b1a5(0x221)]===_0x32b1a5(0x239)))_0x3fce60['status']=_0x32b1a5(0x239);else{if(_0x4b82ad[_0x32b1a5(0x233)](_0x2bddef=>_0x282929['rows'][_0x2bddef][_0x32b1a5(0x221)]===_0x32b1a5(0x24c)))_0x3fce60[_0x32b1a5(0x221)]='conflict';}}}const _0x3815a4={'status':'completed',..._0x2fb47a()};return await saveImportJson(_0xf5019b['report'],_0x3815a4),_0x3815a4;}catch(_0x2b660f){if(_0x4d2d02)await saveImportJson(_0xf5019b[_0x32b1a5(0x20c)],{'status':_0x32b1a5(0x1eb),..._0x2fb47a(),'message':_0x2b660f[_0x32b1a5(0x240)]});throw _0x2b660f;}finally{await _0x1e36d1();}}
1
+ const a146_0x117efd=a146_0x3899;(function(_0x4c80a2,_0x317885){const _0x3e8d0f=a146_0x3899,_0x5b8bc5=_0x4c80a2();while(!![]){try{const _0x13a452=-parseInt(_0x3e8d0f(0x14b))/0x1+parseInt(_0x3e8d0f(0x159))/0x2+parseInt(_0x3e8d0f(0x11a))/0x3+-parseInt(_0x3e8d0f(0x14f))/0x4+parseInt(_0x3e8d0f(0x107))/0x5*(-parseInt(_0x3e8d0f(0x14c))/0x6)+parseInt(_0x3e8d0f(0x123))/0x7*(-parseInt(_0x3e8d0f(0x13b))/0x8)+parseInt(_0x3e8d0f(0x135))/0x9;if(_0x13a452===_0x317885)break;else _0x5b8bc5['push'](_0x5b8bc5['shift']());}catch(_0x132971){_0x5b8bc5['push'](_0x5b8bc5['shift']());}}}(a146_0x2e71,0x3eb0b));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(_0x67a174){const _0x829d86=a146_0x3899;if(Array['isArray'](_0x67a174))return'['+_0x67a174['map'](canonical)[_0x829d86(0x10e)](',')+']';if(_0x67a174&&typeof _0x67a174===_0x829d86(0xf9))return'{'+Object[_0x829d86(0x166)](_0x67a174)['sort']()[_0x829d86(0x150)](_0xab818a=>JSON['stringify'](_0xab818a)+':'+canonical(_0x67a174[_0xab818a]))[_0x829d86(0x10e)](',')+'}';return JSON[_0x829d86(0x165)](_0x67a174)??_0x829d86(0x12c);}const EMPTY_IMAGE_LOCATION_FIELDS=new Set([a146_0x117efd(0x144),a146_0x117efd(0x102),'districtAdcode','district',a146_0x117efd(0x132),'road',a146_0x117efd(0x154),a146_0x117efd(0x172),a146_0x117efd(0x15c),a146_0x117efd(0x14e),a146_0x117efd(0x156),a146_0x117efd(0x146),a146_0x117efd(0x116),a146_0x117efd(0x14a),a146_0x117efd(0x131),a146_0x117efd(0x125),a146_0x117efd(0x16e),'errorMessage','address',a146_0x117efd(0x122)]);export function sameImportValue(_0x17fe22,_0x492d6d,_0x3cf2ac=![]){const _0xe17288=a146_0x117efd;if(_0x3cf2ac){const _0x4f5212=_0xea73e0=>Array[_0xe17288(0xfa)](_0xea73e0)?_0xea73e0[_0xe17288(0x150)](_0x12033e=>{const _0xe7bae=_0xe17288;if(!_0x12033e||typeof _0x12033e!=='object'||Array['isArray'](_0x12033e))return _0x12033e;const _0x4fe552={..._0x12033e};delete _0x4fe552[_0xe7bae(0x126)],delete _0x4fe552[_0xe7bae(0x11d)];if(_0x4fe552[_0xe7bae(0x133)]==='')delete _0x4fe552['dingTalkUrl'];if(_0x4fe552[_0xe7bae(0x141)]==null)delete _0x4fe552['createUserId'];if(_0x4fe552[_0xe7bae(0x173)]==null)delete _0x4fe552[_0xe7bae(0x173)];if(_0x4fe552['geolocation']==null||typeof _0x4fe552[_0xe7bae(0x10d)]===_0xe7bae(0xf9)&&!Array['isArray'](_0x4fe552[_0xe7bae(0x10d)])&&Object[_0xe7bae(0x11f)](_0x4fe552[_0xe7bae(0x10d)])['every'](([_0x1c95dd,_0x2cb939])=>EMPTY_IMAGE_LOCATION_FIELDS[_0xe7bae(0x12f)](_0x1c95dd)&&_0x2cb939===null))delete _0x4fe552[_0xe7bae(0x10d)];for(const _0x23c3ce of[_0xe7bae(0x139),_0xe7bae(0x115),'key'])if(!(_0x23c3ce in _0x4fe552))_0x4fe552[_0x23c3ce]='';if(_0x4fe552['size']==null)_0x4fe552[_0xe7bae(0x127)]=0x0;return _0x4fe552;}):_0xea73e0;return canonical(_0x4f5212(_0x17fe22))===canonical(_0x4f5212(_0x492d6d));}return _0x17fe22===null?_0x492d6d===null||_0x492d6d===undefined:canonical(_0x492d6d)===canonical(_0x17fe22);}async function rejectSymlink(_0x573bea){const _0x501b7a=a146_0x117efd;try{if((await lstat(_0x573bea))[_0x501b7a(0xfe)]())throw Error(_0x501b7a(0x170));}catch(_0x455700){if(_0x455700[_0x501b7a(0x151)]!=='ENOENT')throw _0x455700;}}function a146_0x2e71(){const _0x505d63=['map','code','maxBatchSize','pid','country','uploadFields','city','schemaHash','isSafeInteger','726262FtKmiW','Previously\x20imported\x20records\x20are\x20no\x20longer\x20visible;\x20recovery\x20stopped.','Import\x20checkpoint\x20already\x20exists;\x20use\x20--resume.','province','Excel\x20contains\x20no\x20valid\x20data\x20rows.','EEXIST','The\x20import\x20write\x20outcome\x20is\x20unknown.\x20Resume\x20to\x20reconcile\x20the\x20fixed\x20IDs\x20before\x20continuing.','fileHash','appCode','Invalid\x20import\x20batch\x20size.','unknown','some','stringify','keys','ESRCH','runtimeDomain','push','values','binding','toString','Import\x20lock\x20changed;\x20retry\x20recovery.','cityAdcode','importId','Import\x20output\x20must\x20not\x20be\x20a\x20symbolic\x20link.','emptyRows','countryCode','createUserName','Invalid\x20write\x20result.','length','byteLength','isInteger','mappingHash','readback','\x20exceeds\x20the\x20import\x20request\x20size\x20limit.','succeeded','now','ids','slice','filter','Incomplete\x20readback.','object','isArray','Excel\x20contains\x20invalid\x20rows;\x20no\x20data\x20was\x20written.','errors','strategy','isSymbolicLink','source','elapsedMs','.lock','operatorType','schemaVersion','incomplete','get','status','12815wBtoYR','The\x20server\x20import\x20contract\x20is\x20unsupported\x20or\x20incomplete.','rowNumber','sheet','resume','utf8','geolocation','join','Import\x20checkpoint\x20does\x20not\x20match\x20the\x20input,\x20target\x20or\x20identity.','pending','imageFields','Import\x20content\x20conflict\x20at\x20Excel\x20row\x20','checkpoint','Excel\x20row\x20','type','resultCode','set','Import\x20input,\x20output\x20and\x20lock\x20paths\x20must\x20be\x20different\x20files.','datasetCode','1089408qUiOUm','close','The\x20fixed-ID\x20runner\x20requires\x20the\x20v1\x20import\x20contract.','previewUrl','forEach','entries','write','token','lbswuaCacheId','7028KTIEeE','batchSize','longitude','url','size','Invalid\x20import\x20readback\x20response.','sync','fixed-negative-id','.recovery','undefined','Import\x20lock\x20recovery\x20is\x20active\x20or\x20interrupted;\x20inspect\x20the\x20recovery\x20guard\x20before\x20retrying.','conflict','has','message','accuracy','pois','dingTalkUrl','rows','3677040pSRepc','includes','maxBatchBytes','ENOENT','name','every','2336nBmHmo','schemaFingerprint','report','.lock.recovery','actorId','writeFile','createUserId','unsent','hex','time','auto-id-task-marker','netType','parse','string','completed','streetNumber','187898NOMjlN','852wSKOJD','Cannot\x20read\x20the\x20import\x20checkpoint.','latitude','132144HpGaDp'];a146_0x2e71=function(){return _0x505d63;};return a146_0x2e71();}export async function resolveImportOutputPath(_0x2e03a2){return await rejectSymlink(_0x2e03a2),resolve(await realpath(dirname(resolve(_0x2e03a2))),basename(_0x2e03a2));}export function assertImportPaths(_0x4c6f96,_0x40e75a,_0x358bea=[]){const _0x343e63=a146_0x117efd,_0x291140=[..._0x358bea,_0x4c6f96,_0x40e75a,_0x4c6f96+_0x343e63(0x101),_0x4c6f96+_0x343e63(0x13e)][_0x343e63(0x150)](_0x2748bd=>resolve(_0x2748bd));if(new Set(_0x291140)[_0x343e63(0x127)]!==_0x291140[_0x343e63(0x175)])throw Error(_0x343e63(0x118));}export async function saveImportJson(_0x25c958,_0x52bc07){const _0x5b0447=a146_0x117efd;await rejectSymlink(_0x25c958);const _0x3edb58=_0x25c958+'.tmp-'+randomUUID(),_0xc395a4=await open(_0x3edb58,'wx',0x180);try{await _0xc395a4[_0x5b0447(0x140)](JSON[_0x5b0447(0x165)](_0x52bc07,null,0x2)),await _0xc395a4[_0x5b0447(0x129)]();}finally{await _0xc395a4['close']();}try{await rename(_0x3edb58,_0x25c958);}catch(_0x14088c){await unlink(_0x3edb58)['catch'](()=>{});throw _0x14088c;}}export async function acquireLock(_0x10f6d1){const _0x15be26=a146_0x117efd,_0x52157a=_0x10f6d1+_0x15be26(0x101),_0x2ee0b7=randomUUID();await rejectSymlink(_0x52157a);const _0x33dccf=_0x52157a+_0x15be26(0x12b);let _0x1516bc,_0x2ac1cf;try{try{_0x1516bc=await open(_0x52157a,'wx',0x180);}catch(_0x34f20b){if(_0x34f20b[_0x15be26(0x151)]!==_0x15be26(0x15e))throw _0x34f20b;try{_0x2ac1cf=await open(_0x33dccf,'wx',0x180);}catch(_0xbf6c70){if(_0xbf6c70[_0x15be26(0x151)]===_0x15be26(0x15e))throw Error(_0x15be26(0x12d));throw _0xbf6c70;}await _0x2ac1cf[_0x15be26(0x140)](JSON['stringify']({'pid':process['pid'],'token':_0x2ee0b7})),await _0x2ac1cf['sync'](),await rejectSymlink(_0x52157a);let _0x52e0be;try{_0x52e0be=await readFile(_0x52157a,_0x15be26(0x10c));}catch(_0x49cd65){if(_0x49cd65['code']!==_0x15be26(0x138))throw _0x49cd65;}if(_0x52e0be!==undefined){let _0xaa0ad2;try{_0xaa0ad2=JSON['parse'](_0x52e0be);}catch{throw Error('Invalid\x20import\x20lock;\x20inspect\x20it\x20before\x20recovery.');}if(!_0xaa0ad2||!Number[_0x15be26(0x158)](_0xaa0ad2['pid'])||_0xaa0ad2[_0x15be26(0x153)]<=0x0)throw Error('Invalid\x20import\x20lock\x20owner.');try{process['kill'](_0xaa0ad2['pid'],0x0);throw Error('The\x20import\x20checkpoint\x20is\x20locked\x20by\x20a\x20running\x20process.');}catch(_0x2b9aa3){if(_0x2b9aa3[_0x15be26(0x151)]!==_0x15be26(0x167))throw _0x2b9aa3;}if(await readFile(_0x52157a,_0x15be26(0x10c))!==_0x52e0be)throw Error(_0x15be26(0x16d));await unlink(_0x52157a);}_0x1516bc=await open(_0x52157a,'wx',0x180);}await _0x1516bc['writeFile'](JSON[_0x15be26(0x165)]({'pid':process[_0x15be26(0x153)],'token':_0x2ee0b7})),await _0x1516bc[_0x15be26(0x129)]();}finally{try{await _0x1516bc?.[_0x15be26(0x11b)]();}finally{if(_0x2ac1cf)try{await _0x2ac1cf[_0x15be26(0x11b)]();}finally{await unlink(_0x33dccf);}}}return async()=>{const _0x4893e5=_0x15be26;if(JSON[_0x4893e5(0x147)](await readFile(_0x52157a,_0x4893e5(0x10c)))[_0x4893e5(0x121)]===_0x2ee0b7)await unlink(_0x52157a);};}export function assertImportContract(_0xec915d,_0x989aab,_0x412051){const _0xe0ad9e=a146_0x117efd;if(!_0xec915d||!(_0xec915d[_0xe0ad9e(0x103)]===0x1&&_0xec915d['strategy']===_0xe0ad9e(0x12a)||_0xec915d[_0xe0ad9e(0x103)]===0x2&&_0xec915d[_0xe0ad9e(0xfd)]===_0xe0ad9e(0x145))||_0xec915d[_0xe0ad9e(0xff)]!=='METADATA'||_0xec915d[_0xe0ad9e(0x161)]!==_0x989aab||_0xec915d[_0xe0ad9e(0x119)]!==_0x412051||typeof _0xec915d[_0xe0ad9e(0x13f)]!==_0xe0ad9e(0x148)||!_0xec915d[_0xe0ad9e(0x13f)]||typeof _0xec915d[_0xe0ad9e(0x13c)]!==_0xe0ad9e(0x148)||!_0xec915d['schemaFingerprint']||!Number[_0xe0ad9e(0x158)](_0xec915d[_0xe0ad9e(0x152)])||_0xec915d[_0xe0ad9e(0x152)]<0x1||_0xec915d[_0xe0ad9e(0x152)]>0x3e8||!Number[_0xe0ad9e(0x158)](_0xec915d[_0xe0ad9e(0x137)])||_0xec915d[_0xe0ad9e(0x137)]<0x1||_0xec915d[_0xe0ad9e(0x137)]>0x14*0x400*0x400)throw Error(_0xe0ad9e(0x108));}function a146_0x3899(_0x4a0e06,_0x310382){_0x4a0e06=_0x4a0e06-0xf1;const _0x2e71c3=a146_0x2e71();let _0x3899e5=_0x2e71c3[_0x4a0e06];return _0x3899e5;}export async function runExcelImport(_0x3d80d6){const _0x96c336=a146_0x117efd;_0x3d80d6={..._0x3d80d6,'checkpoint':await resolveImportOutputPath(_0x3d80d6['checkpoint']),'report':await resolveImportOutputPath(_0x3d80d6['report'])};const {manifest:_0x5efe29,contract:_0x129e3f,api:_0xc33b9c}=_0x3d80d6;assertImportContract(_0x129e3f,_0x3d80d6[_0x96c336(0x161)],_0x3d80d6[_0x96c336(0x119)]);if(_0x129e3f[_0x96c336(0x103)]!==0x1)throw Error(_0x96c336(0x11c));if(_0x5efe29[_0x96c336(0xfc)]['length'])throw Error(_0x96c336(0xfb));if(!_0x5efe29[_0x96c336(0x134)][_0x96c336(0x175)])throw Error(_0x96c336(0x15d));if(!Number[_0x96c336(0x177)](_0x3d80d6[_0x96c336(0x124)])||_0x3d80d6[_0x96c336(0x124)]<0x1||_0x3d80d6[_0x96c336(0x124)]>_0x129e3f['maxBatchSize'])throw Error(_0x96c336(0x162));for(const _0x381483 of _0x5efe29[_0x96c336(0x134)]){if(Buffer[_0x96c336(0x176)](JSON[_0x96c336(0x165)]({'schemaFingerprint':_0x129e3f[_0x96c336(0x13c)],'items':[{..._0x381483[_0x96c336(0x16a)],'id':-0x1fffffffffffff}]}),_0x96c336(0x10c))>_0x129e3f[_0x96c336(0x137)])throw Error(_0x96c336(0x114)+_0x381483[_0x96c336(0x109)]+'\x20exceeds\x20the\x20import\x20request\x20size\x20limit.');}assertImportPaths(_0x3d80d6[_0x96c336(0x113)],_0x3d80d6[_0x96c336(0x13d)]);const _0x105981={'appCode':_0x3d80d6[_0x96c336(0x161)],'datasetCode':_0x3d80d6[_0x96c336(0x119)],'runtimeDomain':_0x3d80d6[_0x96c336(0x168)],'actorId':_0x129e3f[_0x96c336(0x13f)],'fileHash':_0x5efe29[_0x96c336(0x160)],'mappingHash':_0x5efe29[_0x96c336(0x178)],'schemaHash':_0x5efe29[_0x96c336(0x157)],'remoteSchemaHash':_0x129e3f[_0x96c336(0x13c)],'batchSize':_0x3d80d6['batchSize'],'sheet':_0x5efe29[_0x96c336(0x10a)]},_0x2cb6ba=await acquireLock(_0x3d80d6[_0x96c336(0x113)]);let _0x2add93;const _0x2865db=Date[_0x96c336(0xf4)]();let _0x189098=0x0;const _0x89dbcf=[],_0x3886d3=()=>({'importId':_0x2add93?.[_0x96c336(0x16f)],'sourceRows':_0x5efe29[_0x96c336(0x134)][_0x96c336(0x175)],'emptyRows':_0x5efe29[_0x96c336(0x171)][_0x96c336(0x175)],'succeeded':_0x2add93?.[_0x96c336(0x134)]['filter'](_0x2c2e89=>_0x2c2e89[_0x96c336(0x106)]===_0x96c336(0xf3))[_0x96c336(0x175)]??0x0,'unknown':_0x2add93?.[_0x96c336(0x134)][_0x96c336(0xf7)](_0xeaf677=>_0xeaf677[_0x96c336(0x106)]==='pending')[_0x96c336(0x175)]??0x0,'conflicts':_0x2add93?.[_0x96c336(0x134)][_0x96c336(0xf7)](_0x195737=>_0x195737[_0x96c336(0x106)]==='conflict')['length']??0x0,'notAttempted':_0x2add93?.[_0x96c336(0x134)][_0x96c336(0xf7)](_0x58efa0=>_0x58efa0[_0x96c336(0x106)]===_0x96c336(0x142))[_0x96c336(0x175)]??_0x5efe29[_0x96c336(0x134)][_0x96c336(0x175)],'batches':_0x189098,'batchResults':_0x89dbcf,'elapsedMs':Date[_0x96c336(0xf4)]()-_0x2865db,'checkpoint':resolve(_0x3d80d6[_0x96c336(0x113)]),'report':resolve(_0x3d80d6[_0x96c336(0x13d)]),'warnings':_0x5efe29['warnings']});try{await rejectSymlink(_0x3d80d6[_0x96c336(0x113)]);if(_0x3d80d6[_0x96c336(0x10b)]){try{_0x2add93=JSON[_0x96c336(0x147)](await readFile(_0x3d80d6[_0x96c336(0x113)],_0x96c336(0x10c)));}catch{throw Error(_0x96c336(0x14d));}if(!_0x2add93||_0x2add93['version']!==0x1||typeof _0x2add93[_0x96c336(0x16f)]!=='string'||canonical(_0x2add93[_0x96c336(0x16b)])!==canonical(_0x105981)||!Array['isArray'](_0x2add93[_0x96c336(0x134)])||_0x2add93['rows'][_0x96c336(0x175)]!==_0x5efe29[_0x96c336(0x134)][_0x96c336(0x175)]||new Set(_0x2add93['rows'][_0x96c336(0x150)](_0x535a11=>_0x535a11['id']))[_0x96c336(0x127)]!==_0x2add93[_0x96c336(0x134)]['length']||_0x2add93[_0x96c336(0x134)][_0x96c336(0x164)]((_0x283570,_0x35c941)=>!Number[_0x96c336(0x158)](_0x283570['id'])||_0x283570['id']>=0x0||_0x283570[_0x96c336(0x109)]!==_0x5efe29[_0x96c336(0x134)][_0x35c941][_0x96c336(0x109)]||!['unsent',_0x96c336(0x110),_0x96c336(0xf3),_0x96c336(0x12e)][_0x96c336(0x136)](_0x283570[_0x96c336(0x106)])))throw Error(_0x96c336(0x10f));}else{try{await lstat(_0x3d80d6[_0x96c336(0x113)]);throw Error(_0x96c336(0x15b));}catch(_0x1ddd53){if(_0x1ddd53[_0x96c336(0x151)]!=='ENOENT')throw _0x1ddd53;}const _0x48069f=new Set();_0x2add93={'version':0x1,'importId':randomUUID(),'binding':_0x105981,'rows':_0x5efe29['rows']['map'](_0x4e4af9=>{const _0x366be2=_0x96c336;let _0x18453b;do{_0x18453b=-(Number(BigInt('0x'+randomBytes(0x7)[_0x366be2(0x16c)](_0x366be2(0x143)))&(0x1n<<0x34n)-0x1n)+0x1);}while(_0x48069f['has'](_0x18453b));return _0x48069f['add'](_0x18453b),{'id':_0x18453b,'rowNumber':_0x4e4af9['rowNumber'],'status':_0x366be2(0x142)};})},await saveImportJson(_0x3d80d6[_0x96c336(0x113)],_0x2add93);}await _0x3d80d6['onCheckpointReady']?.();const _0x489260=_0x2add93;if(_0x489260[_0x96c336(0x134)]['some'](_0x5d99fd=>_0x5d99fd['status']===_0x96c336(0x12e)))throw Error('Import\x20checkpoint\x20contains\x20a\x20content\x20conflict.');const _0x2ec577=async _0x58aa25=>{const _0x386e65=_0x96c336,_0x58adc5=await _0xc33b9c[_0x386e65(0xf1)](_0x58aa25['map'](_0x2b236d=>_0x489260['rows'][_0x2b236d]['id']));if(!Array['isArray'](_0x58adc5))throw Error('Invalid\x20import\x20readback\x20response.');const _0x143e51=new Set(_0x58aa25[_0x386e65(0x150)](_0x5c77ae=>_0x489260[_0x386e65(0x134)][_0x5c77ae]['id'])),_0x17e0e5=new Map();for(const _0xed7aba of _0x58adc5){const _0x273388=Number(_0xed7aba?.['id']);if(!_0x143e51[_0x386e65(0x12f)](_0x273388)||_0x17e0e5['has'](_0x273388))throw Error('Invalid\x20or\x20duplicate\x20import\x20readback\x20ID.');_0x17e0e5[_0x386e65(0x117)](_0x273388,_0xed7aba);}for(const _0x3c72e9 of _0x58aa25){const _0x2f8240=_0x17e0e5[_0x386e65(0x105)](_0x489260[_0x386e65(0x134)][_0x3c72e9]['id']);if(!_0x2f8240)continue;if(_0x489260[_0x386e65(0x134)][_0x3c72e9][_0x386e65(0x106)]==='unsent'){_0x489260[_0x386e65(0x134)][_0x3c72e9][_0x386e65(0x106)]='conflict',await saveImportJson(_0x3d80d6[_0x386e65(0x113)],_0x489260);throw Error('Import\x20primary\x20key\x20collision;\x20stop\x20without\x20replacing\x20the\x20fixed\x20IDs.');}const _0x369548=_0x5efe29['rows'][_0x3c72e9][_0x386e65(0x16a)];if(Object[_0x386e65(0x166)](_0x369548)['some'](_0x39c073=>!sameImportValue(_0x369548[_0x39c073],_0x2f8240[_0x39c073],_0x5efe29[_0x386e65(0x111)]?.[_0x386e65(0x136)](_0x39c073)&&!_0x5efe29[_0x386e65(0x155)]?.['includes'](_0x39c073)))){_0x489260[_0x386e65(0x134)][_0x3c72e9][_0x386e65(0x106)]='conflict',await saveImportJson(_0x3d80d6[_0x386e65(0x113)],_0x489260);throw Error(_0x386e65(0x112)+_0x489260['rows'][_0x3c72e9][_0x386e65(0x109)]+'.');}_0x489260['rows'][_0x3c72e9][_0x386e65(0x106)]='succeeded';}return await saveImportJson(_0x3d80d6[_0x386e65(0x113)],_0x489260),_0x17e0e5;};if(_0x3d80d6[_0x96c336(0x10b)])for(let _0x509817=0x0;_0x509817<_0x489260[_0x96c336(0x134)]['length'];_0x509817+=_0x3d80d6[_0x96c336(0x124)]){const _0x25ef4a=_0x489260[_0x96c336(0x134)][_0x96c336(0xf6)](_0x509817,_0x509817+_0x3d80d6[_0x96c336(0x124)])['map']((_0x1386da,_0x1f1aed)=>_0x509817+_0x1f1aed),_0x141b58=_0x25ef4a[_0x96c336(0xf7)](_0x261bef=>_0x489260[_0x96c336(0x134)][_0x261bef][_0x96c336(0x106)]===_0x96c336(0xf3)),_0x256f10=await _0x2ec577(_0x25ef4a),_0x18f27c=_0x141b58[_0x96c336(0xf7)](_0x122413=>!_0x256f10[_0x96c336(0x12f)](_0x489260[_0x96c336(0x134)][_0x122413]['id']));if(_0x18f27c[_0x96c336(0x175)]){_0x18f27c[_0x96c336(0x11e)](_0x5dfbc5=>{const _0x5f5d58=_0x96c336;_0x489260[_0x5f5d58(0x134)][_0x5dfbc5][_0x5f5d58(0x106)]=_0x5f5d58(0x12e);}),await saveImportJson(_0x3d80d6['checkpoint'],_0x489260);throw Error(_0x96c336(0x15a));}}for(let _0x10ec5e=0x0;_0x10ec5e<_0x489260[_0x96c336(0x134)][_0x96c336(0x175)];){const _0x44630a=[],_0x11eb10=[];while(_0x10ec5e<_0x489260[_0x96c336(0x134)]['length']&&_0x11eb10[_0x96c336(0x175)]<_0x3d80d6['batchSize']){const _0x3344b6=_0x10ec5e++;if(_0x489260[_0x96c336(0x134)][_0x3344b6]['status']===_0x96c336(0xf3))continue;const _0x5d9e3d={..._0x5efe29[_0x96c336(0x134)][_0x3344b6][_0x96c336(0x16a)],'id':_0x489260[_0x96c336(0x134)][_0x3344b6]['id']};if(Buffer['byteLength'](JSON['stringify']({'schemaFingerprint':_0x129e3f['schemaFingerprint'],'items':[..._0x11eb10,_0x5d9e3d]}),_0x96c336(0x10c))>_0x129e3f[_0x96c336(0x137)]){if(!_0x11eb10[_0x96c336(0x175)])throw Error(_0x96c336(0x114)+_0x489260[_0x96c336(0x134)][_0x3344b6][_0x96c336(0x109)]+_0x96c336(0xf2));_0x10ec5e--;break;}_0x44630a[_0x96c336(0x169)](_0x3344b6),_0x11eb10[_0x96c336(0x169)](_0x5d9e3d);}if(!_0x11eb10[_0x96c336(0x175)])continue;const _0x391cf3=_0x44630a[_0x96c336(0xf7)](_0x418056=>_0x489260[_0x96c336(0x134)][_0x418056][_0x96c336(0x106)]===_0x96c336(0x142));if(_0x391cf3[_0x96c336(0x175)]){const _0x292e6d=await _0xc33b9c['readback'](_0x391cf3[_0x96c336(0x150)](_0x29ba1e=>_0x489260[_0x96c336(0x134)][_0x29ba1e]['id']));if(!Array[_0x96c336(0xfa)](_0x292e6d))throw Error(_0x96c336(0x128));if(_0x292e6d[_0x96c336(0x175)])throw Error('Import\x20primary\x20key\x20collision;\x20stop\x20without\x20replacing\x20the\x20fixed\x20IDs.');}_0x44630a[_0x96c336(0x11e)](_0x258fa0=>{const _0x39802a=_0x96c336;_0x489260[_0x39802a(0x134)][_0x258fa0]['status']=_0x39802a(0x110);}),await saveImportJson(_0x3d80d6[_0x96c336(0x113)],_0x489260),_0x189098++;const _0x430b64=Date[_0x96c336(0xf4)](),_0x4ca1df={'batch':_0x189098,'rowStart':_0x489260[_0x96c336(0x134)][_0x44630a[0x0]]['rowNumber'],'rowEnd':_0x489260[_0x96c336(0x134)][_0x44630a[_0x44630a['length']-0x1]]['rowNumber'],'count':_0x11eb10[_0x96c336(0x175)],'bytes':Buffer[_0x96c336(0x176)](JSON[_0x96c336(0x165)]({'schemaFingerprint':_0x129e3f[_0x96c336(0x13c)],'items':_0x11eb10}),'utf8'),'elapsedMs':0x0,'status':_0x96c336(0x163)};_0x89dbcf['push'](_0x4ca1df);try{const _0x284479=await _0xc33b9c[_0x96c336(0x120)](_0x11eb10);if(!_0x284479||_0x284479['count']!==_0x11eb10[_0x96c336(0x175)]||!Array[_0x96c336(0xfa)](_0x284479[_0x96c336(0xf5)])||_0x284479[_0x96c336(0xf5)][_0x96c336(0x175)]!==_0x11eb10[_0x96c336(0x175)]||_0x284479[_0x96c336(0xf5)][_0x96c336(0x164)]((_0x3c108a,_0x37469a)=>Number(_0x3c108a)!==_0x489260[_0x96c336(0x134)][_0x44630a[_0x37469a]]['id']))throw Error(_0x96c336(0x174));await _0x2ec577(_0x44630a);if(_0x44630a[_0x96c336(0x164)](_0x3d72cb=>_0x489260[_0x96c336(0x134)][_0x3d72cb][_0x96c336(0x106)]!=='succeeded'))throw Error(_0x96c336(0xf8));}catch(_0x2cf344){if(_0x489260['rows'][_0x96c336(0x164)](_0x5cc104=>_0x5cc104[_0x96c336(0x106)]==='conflict'))throw _0x2cf344;try{await _0x2ec577(_0x44630a);}catch(_0x2735f5){if(_0x489260[_0x96c336(0x134)][_0x96c336(0x164)](_0x47ef6c=>_0x47ef6c[_0x96c336(0x106)]===_0x96c336(0x12e)))throw _0x2735f5;}if(_0x44630a[_0x96c336(0x164)](_0x24dab7=>_0x489260[_0x96c336(0x134)][_0x24dab7][_0x96c336(0x106)]!=='succeeded'))throw Error(_0x96c336(0x15f));}finally{_0x4ca1df[_0x96c336(0x100)]=Date[_0x96c336(0xf4)]()-_0x430b64;if(_0x44630a[_0x96c336(0x13a)](_0x91b618=>_0x489260[_0x96c336(0x134)][_0x91b618][_0x96c336(0x106)]==='succeeded'))_0x4ca1df[_0x96c336(0x106)]='succeeded';else{if(_0x44630a[_0x96c336(0x164)](_0x40dc2b=>_0x489260['rows'][_0x40dc2b][_0x96c336(0x106)]==='conflict'))_0x4ca1df['status']='conflict';}}}const _0x19594b={'status':_0x96c336(0x149),..._0x3886d3()};return await saveImportJson(_0x3d80d6[_0x96c336(0x13d)],_0x19594b),_0x19594b;}catch(_0x2d59b6){if(_0x2add93)await saveImportJson(_0x3d80d6['report'],{'status':_0x96c336(0x104),..._0x3886d3(),'message':_0x2d59b6[_0x96c336(0x130)]});throw _0x2d59b6;}finally{await _0x2cb6ba();}}
@@ -1 +1 @@
1
- const a148_0x148006=a148_0x58c6;(function(_0x59a281,_0xd5b266){const _0x2e6a06=a148_0x58c6,_0x249ad0=_0x59a281();while(!![]){try{const _0x2b4f59=-parseInt(_0x2e6a06(0x14d))/0x1+-parseInt(_0x2e6a06(0x153))/0x2*(-parseInt(_0x2e6a06(0x162))/0x3)+-parseInt(_0x2e6a06(0x12f))/0x4*(parseInt(_0x2e6a06(0x13a))/0x5)+parseInt(_0x2e6a06(0x160))/0x6*(-parseInt(_0x2e6a06(0x156))/0x7)+-parseInt(_0x2e6a06(0x15a))/0x8*(-parseInt(_0x2e6a06(0x16b))/0x9)+-parseInt(_0x2e6a06(0x130))/0xa*(parseInt(_0x2e6a06(0x13c))/0xb)+parseInt(_0x2e6a06(0x154))/0xc;if(_0x2b4f59===_0xd5b266)break;else _0x249ad0['push'](_0x249ad0['shift']());}catch(_0x5130c1){_0x249ad0['push'](_0x249ad0['shift']());}}}(a148_0x37f0,0x2aa75));import{createHash}from'node:crypto';function a148_0x58c6(_0x3f8d51,_0x27fef1){_0x3f8d51=_0x3f8d51-0x129;const _0x37f02b=a148_0x37f0();let _0x58c63b=_0x37f02b[_0x3f8d51];return _0x58c63b;}import{lstatSync,readFileSync,readdirSync}from'node:fs';import{homedir}from'node:os';function a148_0x37f0(){const _0x52e482=['utf8','unknown','SOURCE_INVALID','Unsafe\x20manifest\x20path:\x20','absent','lovrabet-skills','version','missing','package.json','sha256','67444wJgqBh','83490XTYdWV','path','Built-in\x20Skill\x20source\x20does\x20not\x20match\x20its\x20package\x20manifest','skipped','root','home','match','present','unverifiable','output','95cLlRwg','lovrabet','341OofrSy','manifest','skillVersion','version_mismatch','INSTALL_FAILED','partialFailure','reason','split','count','join','packageRoot','state','Symbolic\x20link\x20is\x20not\x20allowed:\x20','flatMap','startsWith','hex','VERIFY_FAILED','260371PSAWHC','SKILL.md','parse','every','Installed\x20Skill\x20state\x20is\x20','packageVersion','633538dDUbDV','6924648AUxvMQ','current','161bwtKfV','\x20verified;\x20','lovrabet.manifest.json','skills@latest\x20exited\x20','1912hAXPSz','digest','pipe','\x20automatically\x20selected\x20installation\x20target(s)\x20could\x20not\x20be\x20installed.','log','Unsupported\x20Skill\x20entry:\x20','22326SSvmEA','content_mismatch','3PBvBVg','name','skills','includes','length','lovrabet\x20cli-skill\x20install','files','CLI\x20Built-in\x20Skill\x20','error','7758ITcmnv','update','message'];a148_0x37f0=function(){return _0x52e482;};return a148_0x37f0();}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=a148_0x148006(0x167),SKILL_NAME=a148_0x148006(0x13b),debug=debuglog(a148_0x148006(0x12a));function frontmatterValue(_0x1a3787,_0x5e602a){const _0x3efc3d=a148_0x148006;return _0x1a3787[_0x3efc3d(0x136)](new RegExp('^'+_0x5e602a+':\x5cs*(.+)$','m'))?.[0x1]?.['trim']()??'';}function listFiles(_0x1a57d2,_0x29145b=_0x1a57d2){const _0x41df54=a148_0x148006;return readdirSync(_0x29145b,{'withFileTypes':!![]})[_0x41df54(0x149)](_0x5b0fc9=>{const _0x167121=_0x41df54,_0x457df0=join(_0x29145b,_0x5b0fc9[_0x167121(0x163)]),_0x119ea5=lstatSync(_0x457df0);if(_0x119ea5['isSymbolicLink']())throw new Error(_0x167121(0x148)+_0x457df0);if(_0x119ea5['isDirectory']())return listFiles(_0x1a57d2,_0x457df0);if(!_0x119ea5['isFile']())throw new Error(_0x167121(0x15f)+_0x457df0);return[relative(_0x1a57d2,_0x457df0)[_0x167121(0x143)](sep)[_0x167121(0x145)]('/')];})['sort']((_0x4684eb,_0x1ba6f7)=>_0x4684eb<_0x1ba6f7?-0x1:_0x4684eb>_0x1ba6f7?0x1:0x0);}function digestFiles(_0x52fe1c,_0x343831){const _0x4fc0e3=a148_0x148006,_0x2e5f06=createHash(_0x4fc0e3(0x12e));for(const _0x11e88f of _0x343831){if(_0x11e88f[_0x4fc0e3(0x14a)]('/')||_0x11e88f[_0x4fc0e3(0x143)]('/')[_0x4fc0e3(0x165)]('..')||_0x11e88f[_0x4fc0e3(0x165)]('\x5c'))throw new Error(_0x4fc0e3(0x171)+_0x11e88f);_0x2e5f06[_0x4fc0e3(0x16c)](_0x11e88f),_0x2e5f06[_0x4fc0e3(0x16c)]('\x00'),_0x2e5f06[_0x4fc0e3(0x16c)](readFileSync(join(_0x52fe1c,..._0x11e88f[_0x4fc0e3(0x143)]('/')))),_0x2e5f06[_0x4fc0e3(0x16c)]('\x00');}return _0x2e5f06['digest'](_0x4fc0e3(0x14b));}function sameFiles(_0x2a3def,_0x72ac15){const _0x58c8b1=a148_0x148006;return _0x2a3def[_0x58c8b1(0x166)]===_0x72ac15[_0x58c8b1(0x166)]&&_0x2a3def[_0x58c8b1(0x150)]((_0x265421,_0x50b543)=>_0x265421===_0x72ac15[_0x50b543]);}function readSource(_0x377364){const _0x95291d=a148_0x148006,_0x4292d2=JSON['parse'](readFileSync(join(_0x377364,_0x95291d(0x12d)),_0x95291d(0x16e))),_0x6d3f07=JSON[_0x95291d(0x14f)](readFileSync(join(_0x377364,_0x95291d(0x164),_0x95291d(0x158)),_0x95291d(0x16e))),_0x2bb6d2=join(_0x377364,_0x95291d(0x164),SKILL_NAME),_0x2c97c9=frontmatterValue(readFileSync(join(_0x2bb6d2,_0x95291d(0x14e)),_0x95291d(0x16e)),_0x95291d(0x12b)),_0x2f1bf7=listFiles(_0x2bb6d2);if(_0x6d3f07['schemaVersion']!==0x1||_0x6d3f07['name']!==SKILL_NAME||!_0x4292d2[_0x95291d(0x12b)]||_0x6d3f07['packageVersion']!==_0x4292d2[_0x95291d(0x12b)]||_0x6d3f07['skillVersion']!==_0x4292d2[_0x95291d(0x12b)]||_0x2c97c9!==_0x4292d2[_0x95291d(0x12b)]||!sameFiles(_0x2f1bf7,_0x6d3f07[_0x95291d(0x168)])||digestFiles(_0x2bb6d2,_0x2f1bf7)!==_0x6d3f07[_0x95291d(0x15b)])throw new Error(_0x95291d(0x132));return{'packageVersion':_0x4292d2['version'],'skillVersion':_0x2c97c9,'root':_0x2bb6d2,'manifest':_0x6d3f07};}function installedSkillPath(_0x134c3c){const _0x3ad4b5=a148_0x148006,_0x4c9207=resolveInstalledSkill(SKILL_NAME,{'home':_0x134c3c});if(_0x4c9207[_0x3ad4b5(0x147)]==='present')return{'state':_0x3ad4b5(0x137),'path':dirname(_0x4c9207[_0x3ad4b5(0x131)])};if(_0x4c9207[_0x3ad4b5(0x147)]===_0x3ad4b5(0x129))return{'state':_0x3ad4b5(0x12c)};return{'state':_0x3ad4b5(0x138),'reason':_0x4c9207['reason']};}export function inspectInstalledBuiltinSkillVersion(_0x34be99,_0x115d2e={}){const _0x593a5d=a148_0x148006,_0x3fd233=installedSkillPath(_0x115d2e[_0x593a5d(0x135)]??homedir());if(_0x3fd233[_0x593a5d(0x147)]===_0x593a5d(0x12c))return{'state':_0x593a5d(0x12c),'expectedVersion':_0x34be99,'repairCommand':REPAIR_COMMAND};if(_0x3fd233['state']==='unverifiable')return{'state':_0x593a5d(0x138),'expectedVersion':_0x34be99,'reason':_0x3fd233[_0x593a5d(0x142)],'repairCommand':REPAIR_COMMAND};try{const _0x261cf1=frontmatterValue(readFileSync(join(_0x3fd233[_0x593a5d(0x131)],_0x593a5d(0x14e)),_0x593a5d(0x16e)),_0x593a5d(0x12b));return{'state':_0x261cf1===_0x34be99?_0x593a5d(0x155):_0x593a5d(0x13f),'expectedVersion':_0x34be99,'skillVersion':_0x261cf1,'installedPath':_0x3fd233['path'],'repairCommand':REPAIR_COMMAND};}catch(_0x381f6c){return{'state':_0x593a5d(0x138),'expectedVersion':_0x34be99,'installedPath':_0x3fd233['path'],'reason':_0x381f6c instanceof Error?_0x381f6c['message']:String(_0x381f6c),'repairCommand':REPAIR_COMMAND};}}export function inspectBuiltinSkill(_0x1fbabb={}){const _0x9cabcc=a148_0x148006,_0x5d6ca6=_0x1fbabb['packageRoot']??DEFAULT_PACKAGE_ROOT;let _0x4c28ab;try{_0x4c28ab=readSource(_0x5d6ca6);}catch(_0x1b41c0){return{'state':_0x9cabcc(0x138),'packageVersion':_0x9cabcc(0x16f),'reason':_0x1b41c0 instanceof Error?_0x1b41c0['message']:String(_0x1b41c0),'repairCommand':REPAIR_COMMAND};}const _0x34d1e1=installedSkillPath(_0x1fbabb[_0x9cabcc(0x135)]??homedir());if(_0x34d1e1[_0x9cabcc(0x147)]===_0x9cabcc(0x12c))return{'state':'missing','packageVersion':_0x4c28ab[_0x9cabcc(0x152)],'repairCommand':REPAIR_COMMAND};if(_0x34d1e1['state']===_0x9cabcc(0x138))return{'state':'unverifiable','packageVersion':_0x4c28ab[_0x9cabcc(0x152)],'reason':_0x34d1e1[_0x9cabcc(0x142)],'repairCommand':REPAIR_COMMAND};try{const _0x26ee8e=frontmatterValue(readFileSync(join(_0x34d1e1[_0x9cabcc(0x131)],_0x9cabcc(0x14e)),_0x9cabcc(0x16e)),_0x9cabcc(0x12b));if(_0x26ee8e!==_0x4c28ab[_0x9cabcc(0x13e)])return{'state':'version_mismatch','packageVersion':_0x4c28ab['packageVersion'],'skillVersion':_0x26ee8e,'installedPath':_0x34d1e1['path'],'repairCommand':REPAIR_COMMAND};const _0x5eb18e=listFiles(_0x34d1e1[_0x9cabcc(0x131)]),_0x116db2=digestFiles(_0x34d1e1[_0x9cabcc(0x131)],_0x5eb18e);return{'state':sameFiles(_0x5eb18e,_0x4c28ab[_0x9cabcc(0x13d)]['files'])&&_0x116db2===_0x4c28ab[_0x9cabcc(0x13d)][_0x9cabcc(0x15b)]?_0x9cabcc(0x155):_0x9cabcc(0x161),'packageVersion':_0x4c28ab[_0x9cabcc(0x152)],'skillVersion':_0x26ee8e,'installedPath':_0x34d1e1[_0x9cabcc(0x131)],'digest':_0x116db2,'repairCommand':REPAIR_COMMAND};}catch(_0x3c45b1){return{'state':_0x9cabcc(0x138),'packageVersion':_0x4c28ab[_0x9cabcc(0x152)],'installedPath':_0x34d1e1[_0x9cabcc(0x131)],'reason':_0x3c45b1 instanceof Error?_0x3c45b1[_0x9cabcc(0x16d)]:String(_0x3c45b1),'repairCommand':REPAIR_COMMAND};}}function failure(_0xa3cc02,_0x370b5f,_0x42c26c,_0x244b0b){const _0x8b57a8=a148_0x148006;return{'ok':![],'code':_0xa3cc02,'packageVersion':_0x370b5f[_0x8b57a8(0x152)],'skillVersion':_0x370b5f['skillVersion'],'installedPath':_0x244b0b,'changed':![],'repairCommand':REPAIR_COMMAND,'error':_0x42c26c instanceof Error?_0x42c26c[_0x8b57a8(0x16d)]:String(_0x42c26c)};}export function installBuiltinSkill(_0xd2ed0f={}){const _0x2ab481=a148_0x148006,_0x1e72c7=_0xd2ed0f[_0x2ab481(0x146)]??DEFAULT_PACKAGE_ROOT,_0x5e4b9d=_0xd2ed0f['home']??homedir();let _0x585a35;try{_0x585a35=readSource(_0x1e72c7);}catch(_0x2ceff7){return failure(_0x2ab481(0x170),{'packageVersion':_0x2ab481(0x16f),'skillVersion':_0x2ab481(0x16f)},_0x2ceff7);}const _0x5195df=inspectBuiltinSkill({'packageRoot':_0x1e72c7,'home':_0x5e4b9d}),_0x319434=runNpxSkillsAddGlobal(_0x1e72c7,_0x585a35[_0x2ab481(0x134)],{'stdio':_0xd2ed0f['stdio']??_0x2ab481(0x15c),'expectedSkillName':SKILL_NAME,'presence':{'home':_0x5e4b9d}});if(_0x319434[_0x2ab481(0x133)])return{'ok':!![],'packageVersion':_0x585a35[_0x2ab481(0x152)],'skillVersion':_0x585a35[_0x2ab481(0x13e)],'installedPath':_0x5195df['installedPath'],'changed':![],'repairCommand':REPAIR_COMMAND};if(!_0x319434['ok'])return failure(_0x2ab481(0x140),_0x585a35,_0x319434[_0x2ab481(0x16a)]??_0x2ab481(0x159)+_0x319434['status']);const _0x4074ae=inspectBuiltinSkill({'packageRoot':_0x1e72c7,'home':_0x5e4b9d});if(_0x4074ae[_0x2ab481(0x147)]!==_0x2ab481(0x155)){const _0x5457ac=_0x4074ae[_0x2ab481(0x142)]??_0x2ab481(0x151)+_0x4074ae[_0x2ab481(0x147)];return failure(_0x2ab481(0x14c),_0x585a35,_0x319434[_0x2ab481(0x141)]?_0x5457ac+'\x0a'+_0x319434[_0x2ab481(0x141)][_0x2ab481(0x139)]:_0x5457ac,_0x4074ae['installedPath']);}return _0x319434[_0x2ab481(0x141)]&&(debug('Installer\x20reported\x20partial\x20target\x20failures:\x0a%s',_0x319434[_0x2ab481(0x141)]['output']),console[_0x2ab481(0x15e)](_0x2ab481(0x169)+_0x585a35['skillVersion']+_0x2ab481(0x157)+_0x319434[_0x2ab481(0x141)][_0x2ab481(0x144)]+_0x2ab481(0x15d))),{'ok':!![],'packageVersion':_0x585a35[_0x2ab481(0x152)],'skillVersion':_0x585a35[_0x2ab481(0x13e)],'installedPath':_0x4074ae['installedPath'],'changed':_0x5195df[_0x2ab481(0x147)]!=='current','repairCommand':REPAIR_COMMAND};}
1
+ const a148_0x3dacd1=a148_0x5522;(function(_0x17100b,_0x21c844){const _0x3221c9=a148_0x5522,_0x1a3c67=_0x17100b();while(!![]){try{const _0x1773da=parseInt(_0x3221c9(0x20c))/0x1+parseInt(_0x3221c9(0x1f6))/0x2*(-parseInt(_0x3221c9(0x1fa))/0x3)+parseInt(_0x3221c9(0x207))/0x4+-parseInt(_0x3221c9(0x21c))/0x5+-parseInt(_0x3221c9(0x212))/0x6*(parseInt(_0x3221c9(0x1f7))/0x7)+-parseInt(_0x3221c9(0x204))/0x8*(-parseInt(_0x3221c9(0x1ff))/0x9)+parseInt(_0x3221c9(0x22b))/0xa;if(_0x1773da===_0x21c844)break;else _0x1a3c67['push'](_0x1a3c67['shift']());}catch(_0x4be8dc){_0x1a3c67['push'](_0x1a3c67['shift']());}}}(a148_0x395a,0x4915c));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';function a148_0x5522(_0x4a0ab4,_0x5d0f0e){_0x4a0ab4=_0x4a0ab4-0x1e5;const _0x395aae=a148_0x395a();let _0x5522a2=_0x395aae[_0x4a0ab4];return _0x5522a2;}import{runNpxSkillsAddGlobal}from'../skills/npx-skills-add.js';function a148_0x395a(){const _0x5dc43e=['INSTALL_FAILED','290400bipBwD','every','Built-in\x20Skill\x20source\x20does\x20not\x20match\x20its\x20package\x20manifest','Unsafe\x20manifest\x20path:\x20','Unsupported\x20Skill\x20entry:\x20','497605IglclC','\x20verified;\x20','skills@latest\x20exited\x20','skipped','home','isSymbolicLink','110628QGUkce','isFile','version_mismatch','CLI\x20Built-in\x20Skill\x20','sort','lovrabet\x20cli-skill\x20install','message','utf8','unverifiable','sha256','2522610xLsxSN','includes','isDirectory','manifest','parse','version','log','match','count','join','path','installedPath','reason','skills','error','3362160cUXesl','partialFailure','status','update','packageRoot','present','name','schemaVersion','root','unknown','split','Installed\x20Skill\x20state\x20is\x20','skillVersion','stdio','SOURCE_INVALID','state','packageVersion','hex','SKILL.md','16yeFLBX','35mgyLgV','length','files','10263gIGgIq','VERIFY_FAILED','Symbolic\x20link\x20is\x20not\x20allowed:\x20','missing','trim','9TrdpDJ','digest','startsWith','output','current','136120wDwMkW','flatMap'];a148_0x395a=function(){return _0x5dc43e;};return a148_0x395a();}import{resolveInstalledSkill}from'../skills/skill-presence.js';const DEFAULT_PACKAGE_ROOT=resolve(dirname(fileURLToPath(import.meta.url)),'..','..'),REPAIR_COMMAND=a148_0x3dacd1(0x217),SKILL_NAME='lovrabet',debug=debuglog('lovrabet-skills');function frontmatterValue(_0x36afd7,_0x135db7){const _0x1917e4=a148_0x3dacd1;return _0x36afd7[_0x1917e4(0x223)](new RegExp('^'+_0x135db7+':\x5cs*(.+)$','m'))?.[0x1]?.[_0x1917e4(0x1fe)]()??'';}function listFiles(_0x4dab56,_0x2ff11b=_0x4dab56){const _0x1d268f=a148_0x3dacd1;return readdirSync(_0x2ff11b,{'withFileTypes':!![]})[_0x1d268f(0x205)](_0x5beb23=>{const _0x2b6be0=_0x1d268f,_0x100260=join(_0x2ff11b,_0x5beb23[_0x2b6be0(0x1e9)]),_0x373391=lstatSync(_0x100260);if(_0x373391[_0x2b6be0(0x211)]())throw new Error(_0x2b6be0(0x1fc)+_0x100260);if(_0x373391[_0x2b6be0(0x21e)]())return listFiles(_0x4dab56,_0x100260);if(!_0x373391[_0x2b6be0(0x213)]())throw new Error(_0x2b6be0(0x20b)+_0x100260);return[relative(_0x4dab56,_0x100260)[_0x2b6be0(0x1ed)](sep)[_0x2b6be0(0x225)]('/')];})[_0x1d268f(0x216)]((_0x3c9f88,_0x19e7da)=>_0x3c9f88<_0x19e7da?-0x1:_0x3c9f88>_0x19e7da?0x1:0x0);}function digestFiles(_0xd9cd06,_0xc4774d){const _0x2f6e7e=a148_0x3dacd1,_0x236f4e=createHash(_0x2f6e7e(0x21b));for(const _0x4ef865 of _0xc4774d){if(_0x4ef865[_0x2f6e7e(0x201)]('/')||_0x4ef865[_0x2f6e7e(0x1ed)]('/')['includes']('..')||_0x4ef865[_0x2f6e7e(0x21d)]('\x5c'))throw new Error(_0x2f6e7e(0x20a)+_0x4ef865);_0x236f4e[_0x2f6e7e(0x1e6)](_0x4ef865),_0x236f4e[_0x2f6e7e(0x1e6)]('\x00'),_0x236f4e[_0x2f6e7e(0x1e6)](readFileSync(join(_0xd9cd06,..._0x4ef865[_0x2f6e7e(0x1ed)]('/')))),_0x236f4e[_0x2f6e7e(0x1e6)]('\x00');}return _0x236f4e[_0x2f6e7e(0x200)](_0x2f6e7e(0x1f4));}function sameFiles(_0x1e091b,_0x2e474b){const _0x5ad7d0=a148_0x3dacd1;return _0x1e091b[_0x5ad7d0(0x1f8)]===_0x2e474b[_0x5ad7d0(0x1f8)]&&_0x1e091b[_0x5ad7d0(0x208)]((_0xc8a7bb,_0x418a7c)=>_0xc8a7bb===_0x2e474b[_0x418a7c]);}function readSource(_0x1ad3b3){const _0x373e0d=a148_0x3dacd1,_0x583b4c=JSON[_0x373e0d(0x220)](readFileSync(join(_0x1ad3b3,'package.json'),'utf8')),_0x3443e5=JSON[_0x373e0d(0x220)](readFileSync(join(_0x1ad3b3,'skills','lovrabet.manifest.json'),_0x373e0d(0x219))),_0x429ce8=join(_0x1ad3b3,_0x373e0d(0x229),SKILL_NAME),_0x46de79=frontmatterValue(readFileSync(join(_0x429ce8,_0x373e0d(0x1f5)),_0x373e0d(0x219)),'version'),_0x1ff7ed=listFiles(_0x429ce8);if(_0x3443e5[_0x373e0d(0x1ea)]!==0x1||_0x3443e5[_0x373e0d(0x1e9)]!==SKILL_NAME||!_0x583b4c[_0x373e0d(0x221)]||_0x3443e5[_0x373e0d(0x1f3)]!==_0x583b4c[_0x373e0d(0x221)]||_0x3443e5[_0x373e0d(0x1ef)]!==_0x583b4c[_0x373e0d(0x221)]||_0x46de79!==_0x583b4c[_0x373e0d(0x221)]||!sameFiles(_0x1ff7ed,_0x3443e5[_0x373e0d(0x1f9)])||digestFiles(_0x429ce8,_0x1ff7ed)!==_0x3443e5['digest'])throw new Error(_0x373e0d(0x209));return{'packageVersion':_0x583b4c[_0x373e0d(0x221)],'skillVersion':_0x46de79,'root':_0x429ce8,'manifest':_0x3443e5};}function installedSkillPath(_0x355289){const _0x49b7ff=a148_0x3dacd1,_0xb5f2ac=resolveInstalledSkill(SKILL_NAME,{'home':_0x355289});if(_0xb5f2ac[_0x49b7ff(0x1f2)]===_0x49b7ff(0x1e8))return{'state':_0x49b7ff(0x1e8),'path':dirname(_0xb5f2ac['path'])};if(_0xb5f2ac['state']==='absent')return{'state':_0x49b7ff(0x1fd)};return{'state':_0x49b7ff(0x21a),'reason':_0xb5f2ac[_0x49b7ff(0x228)]};}export function inspectInstalledBuiltinSkillVersion(_0x37733a,_0x57ad40={}){const _0x5a7fc8=a148_0x3dacd1,_0x40ab9a=installedSkillPath(_0x57ad40[_0x5a7fc8(0x210)]??homedir());if(_0x40ab9a[_0x5a7fc8(0x1f2)]===_0x5a7fc8(0x1fd))return{'state':_0x5a7fc8(0x1fd),'expectedVersion':_0x37733a,'repairCommand':REPAIR_COMMAND};if(_0x40ab9a['state']===_0x5a7fc8(0x21a))return{'state':_0x5a7fc8(0x21a),'expectedVersion':_0x37733a,'reason':_0x40ab9a[_0x5a7fc8(0x228)],'repairCommand':REPAIR_COMMAND};try{const _0x516e49=frontmatterValue(readFileSync(join(_0x40ab9a[_0x5a7fc8(0x226)],_0x5a7fc8(0x1f5)),_0x5a7fc8(0x219)),_0x5a7fc8(0x221));return{'state':_0x516e49===_0x37733a?_0x5a7fc8(0x203):_0x5a7fc8(0x214),'expectedVersion':_0x37733a,'skillVersion':_0x516e49,'installedPath':_0x40ab9a['path'],'repairCommand':REPAIR_COMMAND};}catch(_0x253e70){return{'state':_0x5a7fc8(0x21a),'expectedVersion':_0x37733a,'installedPath':_0x40ab9a[_0x5a7fc8(0x226)],'reason':_0x253e70 instanceof Error?_0x253e70[_0x5a7fc8(0x218)]:String(_0x253e70),'repairCommand':REPAIR_COMMAND};}}export function inspectBuiltinSkill(_0x12786a={}){const _0x21abba=a148_0x3dacd1,_0x35324f=_0x12786a[_0x21abba(0x1e7)]??DEFAULT_PACKAGE_ROOT;let _0x47518f;try{_0x47518f=readSource(_0x35324f);}catch(_0x36321b){return{'state':_0x21abba(0x21a),'packageVersion':_0x21abba(0x1ec),'reason':_0x36321b instanceof Error?_0x36321b[_0x21abba(0x218)]:String(_0x36321b),'repairCommand':REPAIR_COMMAND};}const _0x57eed5=installedSkillPath(_0x12786a[_0x21abba(0x210)]??homedir());if(_0x57eed5[_0x21abba(0x1f2)]===_0x21abba(0x1fd))return{'state':_0x21abba(0x1fd),'packageVersion':_0x47518f[_0x21abba(0x1f3)],'repairCommand':REPAIR_COMMAND};if(_0x57eed5[_0x21abba(0x1f2)]===_0x21abba(0x21a))return{'state':_0x21abba(0x21a),'packageVersion':_0x47518f['packageVersion'],'reason':_0x57eed5[_0x21abba(0x228)],'repairCommand':REPAIR_COMMAND};try{const _0xc90ad=frontmatterValue(readFileSync(join(_0x57eed5[_0x21abba(0x226)],_0x21abba(0x1f5)),_0x21abba(0x219)),_0x21abba(0x221));if(_0xc90ad!==_0x47518f['skillVersion'])return{'state':_0x21abba(0x214),'packageVersion':_0x47518f[_0x21abba(0x1f3)],'skillVersion':_0xc90ad,'installedPath':_0x57eed5['path'],'repairCommand':REPAIR_COMMAND};const _0x18a108=listFiles(_0x57eed5[_0x21abba(0x226)]),_0x213503=digestFiles(_0x57eed5[_0x21abba(0x226)],_0x18a108);return{'state':sameFiles(_0x18a108,_0x47518f[_0x21abba(0x21f)][_0x21abba(0x1f9)])&&_0x213503===_0x47518f[_0x21abba(0x21f)][_0x21abba(0x200)]?'current':'content_mismatch','packageVersion':_0x47518f[_0x21abba(0x1f3)],'skillVersion':_0xc90ad,'installedPath':_0x57eed5[_0x21abba(0x226)],'digest':_0x213503,'repairCommand':REPAIR_COMMAND};}catch(_0x5eb104){return{'state':'unverifiable','packageVersion':_0x47518f[_0x21abba(0x1f3)],'installedPath':_0x57eed5['path'],'reason':_0x5eb104 instanceof Error?_0x5eb104[_0x21abba(0x218)]:String(_0x5eb104),'repairCommand':REPAIR_COMMAND};}}function failure(_0x1d9529,_0x13499c,_0x3d1b0b,_0x5eb07d){const _0xc811bc=a148_0x3dacd1;return{'ok':![],'code':_0x1d9529,'packageVersion':_0x13499c['packageVersion'],'skillVersion':_0x13499c['skillVersion'],'installedPath':_0x5eb07d,'changed':![],'repairCommand':REPAIR_COMMAND,'error':_0x3d1b0b instanceof Error?_0x3d1b0b[_0xc811bc(0x218)]:String(_0x3d1b0b)};}export function installBuiltinSkill(_0x48c926={}){const _0x5c668c=a148_0x3dacd1,_0x41bf9f=_0x48c926['packageRoot']??DEFAULT_PACKAGE_ROOT,_0x4b6325=_0x48c926[_0x5c668c(0x210)]??homedir();let _0x10b18b;try{_0x10b18b=readSource(_0x41bf9f);}catch(_0x3d7c04){return failure(_0x5c668c(0x1f1),{'packageVersion':_0x5c668c(0x1ec),'skillVersion':'unknown'},_0x3d7c04);}const _0x398b40=inspectBuiltinSkill({'packageRoot':_0x41bf9f,'home':_0x4b6325}),_0xeecce2=runNpxSkillsAddGlobal(_0x41bf9f,_0x10b18b[_0x5c668c(0x1eb)],{'stdio':_0x48c926[_0x5c668c(0x1f0)]??'pipe','expectedSkillName':SKILL_NAME,'presence':{'home':_0x4b6325}});if(_0xeecce2[_0x5c668c(0x20f)])return{'ok':!![],'packageVersion':_0x10b18b[_0x5c668c(0x1f3)],'skillVersion':_0x10b18b[_0x5c668c(0x1ef)],'installedPath':_0x398b40['installedPath'],'changed':![],'repairCommand':REPAIR_COMMAND};if(!_0xeecce2['ok'])return failure(_0x5c668c(0x206),_0x10b18b,_0xeecce2[_0x5c668c(0x22a)]??_0x5c668c(0x20e)+_0xeecce2[_0x5c668c(0x1e5)]);const _0x5ce2f0=inspectBuiltinSkill({'packageRoot':_0x41bf9f,'home':_0x4b6325});if(_0x5ce2f0['state']!==_0x5c668c(0x203)){const _0x350aa5=_0x5ce2f0[_0x5c668c(0x228)]??_0x5c668c(0x1ee)+_0x5ce2f0[_0x5c668c(0x1f2)];return failure(_0x5c668c(0x1fb),_0x10b18b,_0xeecce2[_0x5c668c(0x22c)]?_0x350aa5+'\x0a'+_0xeecce2[_0x5c668c(0x22c)][_0x5c668c(0x202)]:_0x350aa5,_0x5ce2f0[_0x5c668c(0x227)]);}return _0xeecce2[_0x5c668c(0x22c)]&&(debug('Installer\x20reported\x20partial\x20target\x20failures:\x0a%s',_0xeecce2[_0x5c668c(0x22c)]['output']),console[_0x5c668c(0x222)](_0x5c668c(0x215)+_0x10b18b['skillVersion']+_0x5c668c(0x20d)+_0xeecce2['partialFailure'][_0x5c668c(0x224)]+'\x20automatically\x20selected\x20installation\x20target(s)\x20could\x20not\x20be\x20installed.')),{'ok':!![],'packageVersion':_0x10b18b[_0x5c668c(0x1f3)],'skillVersion':_0x10b18b[_0x5c668c(0x1ef)],'installedPath':_0x5ce2f0[_0x5c668c(0x227)],'changed':_0x398b40[_0x5c668c(0x1f2)]!==_0x5c668c(0x203),'repairCommand':REPAIR_COMMAND};}
@@ -1 +1 @@
1
- const a149_0x5ed2e6=a149_0x1953;(function(_0x4cebe0,_0x3b90cc){const _0x33f07a=a149_0x1953,_0x3f802e=_0x4cebe0();while(!![]){try{const _0x29427b=-parseInt(_0x33f07a(0x120))/0x1*(-parseInt(_0x33f07a(0x10c))/0x2)+parseInt(_0x33f07a(0x117))/0x3*(-parseInt(_0x33f07a(0x122))/0x4)+-parseInt(_0x33f07a(0x126))/0x5+parseInt(_0x33f07a(0x132))/0x6*(parseInt(_0x33f07a(0x10a))/0x7)+-parseInt(_0x33f07a(0x138))/0x8+-parseInt(_0x33f07a(0x10d))/0x9+parseInt(_0x33f07a(0x11b))/0xa*(parseInt(_0x33f07a(0x125))/0xb);if(_0x29427b===_0x3b90cc)break;else _0x3f802e['push'](_0x3f802e['shift']());}catch(_0x31507b){_0x3f802e['push'](_0x3f802e['shift']());}}}(a149_0x2123,0x91c48));import{execaSync}from'execa';import{LOVRABET_SKILL_SOURCE as a149_0xeed5f8}from'../constant/distribution.js';import{PRODUCT_CONFIG,productEnvName}from'../constant/product.js';import{resolveInstalledSkill}from'../skills/skill-presence.js';export const LOVRABET_SKILL_SOURCE=a149_0xeed5f8;function a149_0x2123(){const _0x4d8b95=['exit\x20','stdio','unknown','3nAzirn','NPX_NOT_FOUND','shortMessage','INSTALL_PARTIAL','10JlSiHp','Skill\x20\x22','\x22\x20install\x20state:\x20','stdout','CHILD_EXIT_NONZERO','304QHcWCj','stderr','2216316cVlzdb','pipe','SPAWN_FAILED','6840284yiezEB','17105hOXpiR','skipNpxSkillsEnvSuffix','internalSkillSource','add','ENOENT','NPM_CONFIG_GLOBAL','exitCode','join','log','SKILL_NOT_INSTALLED','code','filter','12ozzXFX','EACCES','signal','failed','expectedSkillName','npx','4640960CrDVhL','skills@latest','trim','absent','presence','3067071IcauWD','state','4006fcGfgy','3351402zCvEUH','unverifiable','!\x20Could\x20not\x20verify\x20\x22','\x22\x20not\x20found\x20after\x20install\x20(checked\x20','Installer\x20reported\x20','checked','reason'];a149_0x2123=function(){return _0x4d8b95;};return a149_0x2123();}export const LOVRABET_SKILL_GIT_SOURCE=PRODUCT_CONFIG[a149_0x5ed2e6(0x128)];export const LOVRABET_GLOBAL_SKILL_NAME=PRODUCT_CONFIG['globalSkillName'];export function resolveGlobalSkillName(_0x33d8ca){const _0xdbf8e4=a149_0x5ed2e6;switch(_0x33d8ca[_0xdbf8e4(0x107)]()){case LOVRABET_SKILL_SOURCE:case LOVRABET_SKILL_GIT_SOURCE:return LOVRABET_GLOBAL_SKILL_NAME;default:return undefined;}}function a149_0x1953(_0x49239c,_0x41ba5a){_0x49239c=_0x49239c-0x107;const _0x2123ae=a149_0x2123();let _0x1953cc=_0x2123ae[_0x49239c];return _0x1953cc;}export const LOVRABET_SKIP_NPX_SKILLS_ENV=productEnvName(PRODUCT_CONFIG[a149_0x5ed2e6(0x127)]);const CHILD_OUTPUT_MAX_BUFFER=0x10*0x400*0x400;function failure(_0x51ae91,_0x16a507,_0x381c3f){return{'ok':![],'status':_0x16a507,'code':_0x51ae91,'error':'['+_0x51ae91+']\x20'+_0x381c3f};}export function shouldSkipNpxSkillsAdd(){return process.env[LOVRABET_SKIP_NPX_SKILLS_ENV]==='1';}export function runNpxSkillsAddGlobal(_0x28b1fe,_0x36fb65=LOVRABET_SKILL_SOURCE,_0x465e51){const _0x45b83d=a149_0x5ed2e6;if(shouldSkipNpxSkillsAdd())return{'ok':!![],'status':0x0,'skipped':!![]};const _0x1af240=['-y',_0x45b83d(0x139),_0x45b83d(0x129),_0x36fb65,'-g','-y'],_0x21494a=[_0x45b83d(0x137),..._0x1af240][_0x45b83d(0x12d)]('\x20');console[_0x45b83d(0x12e)]('*\x20'+_0x21494a);const _0x472b56={...process.env};delete _0x472b56['npm_config_global'],delete _0x472b56[_0x45b83d(0x12b)];const _0x329e98=execaSync(_0x45b83d(0x137),_0x1af240,{'cwd':_0x28b1fe,'stdio':_0x45b83d(0x123),'env':_0x472b56,'extendEnv':![],'shell':![],'reject':![],'maxBuffer':CHILD_OUTPUT_MAX_BUFFER}),_0x3dfe78=[_0x329e98[_0x45b83d(0x11e)]?String(_0x329e98['stdout']):'',_0x329e98[_0x45b83d(0x121)]?String(_0x329e98[_0x45b83d(0x121)]):''][_0x45b83d(0x131)](Boolean)['join']('\x0a')[_0x45b83d(0x107)](),_0x17fc51=_0x329e98[_0x45b83d(0x12c)]??null,_0x3f4ea6=_0x239083=>{const _0x19646f=_0x45b83d;return _0x465e51?.[_0x19646f(0x115)]!==_0x19646f(0x123)&&!_0x239083['partialFailure']&&_0x3dfe78&&console['log'](_0x3dfe78),_0x239083;};if(_0x329e98['code']){const _0x5f1e1c=_0x329e98['code']===_0x45b83d(0x12a)?_0x45b83d(0x118):_0x329e98['code']==='EPERM'||_0x329e98['code']===_0x45b83d(0x133)?'PERMISSION_DENIED':_0x45b83d(0x124);return _0x3f4ea6(failure(_0x5f1e1c,_0x17fc51,_0x329e98[_0x45b83d(0x119)]??_0x329e98['message']??_0x329e98[_0x45b83d(0x130)]));}if(_0x329e98[_0x45b83d(0x134)])return _0x3f4ea6(failure('CHILD_TERMINATED',_0x17fc51,'npx\x20terminated\x20by\x20signal\x20'+_0x329e98[_0x45b83d(0x134)]));if(_0x329e98[_0x45b83d(0x135)]&&_0x17fc51===null)return _0x3f4ea6(failure(_0x45b83d(0x124),_0x17fc51,_0x329e98[_0x45b83d(0x119)]??_0x329e98['message']??'npx\x20failed\x20to\x20start'));if(_0x17fc51!==0x0)return _0x3f4ea6(failure(_0x45b83d(0x11f),_0x17fc51,_0x3dfe78||_0x329e98[_0x45b83d(0x119)]||_0x45b83d(0x114)+(_0x17fc51??_0x45b83d(0x116))));const _0x40c911=_0x465e51?.[_0x45b83d(0x136)]??resolveGlobalSkillName(_0x36fb65),_0x56bff2=_0x40c911?resolveInstalledSkill(_0x40c911,_0x465e51?.[_0x45b83d(0x109)]):undefined,_0x348cea=_0x3dfe78['match'](/Failed to install\s+(\d+)/i);if(_0x348cea&&Number(_0x348cea[0x1])>0x0){const _0x2cceee=_0x45b83d(0x111)+_0x348cea[0x1]+'\x20failed\x20target(s)'+(_0x3dfe78?':\x0a'+_0x3dfe78:'');if(_0x56bff2?.[_0x45b83d(0x10b)]==='present')return{'ok':!![],'status':0x0,'partialFailure':{'count':Number(_0x348cea[0x1]),'output':_0x3dfe78}};return _0x3f4ea6(failure(_0x45b83d(0x11a),0x0,_0x2cceee));}if(_0x40c911&&_0x56bff2){if(_0x56bff2[_0x45b83d(0x10b)]===_0x45b83d(0x108))return _0x3f4ea6(failure(_0x45b83d(0x12f),0x0,_0x45b83d(0x11c)+_0x40c911+_0x45b83d(0x110)+_0x56bff2[_0x45b83d(0x112)][_0x45b83d(0x12d)](',\x20')+')'));_0x56bff2['state']===_0x45b83d(0x10e)&&console['warn'](_0x45b83d(0x10f)+_0x40c911+_0x45b83d(0x11d)+_0x56bff2[_0x45b83d(0x113)]);}return _0x3f4ea6({'ok':!![],'status':0x0});}
1
+ const a149_0x204cd8=a149_0x3539;(function(_0x5d18bb,_0x4849c6){const _0x421436=a149_0x3539,_0x301d69=_0x5d18bb();while(!![]){try{const _0x4fccb4=-parseInt(_0x421436(0x13d))/0x1*(-parseInt(_0x421436(0x13f))/0x2)+parseInt(_0x421436(0x13c))/0x3+parseInt(_0x421436(0x11f))/0x4*(-parseInt(_0x421436(0x132))/0x5)+parseInt(_0x421436(0x146))/0x6*(-parseInt(_0x421436(0x147))/0x7)+-parseInt(_0x421436(0x138))/0x8+-parseInt(_0x421436(0x134))/0x9*(parseInt(_0x421436(0x12c))/0xa)+parseInt(_0x421436(0x118))/0xb;if(_0x4fccb4===_0x4849c6)break;else _0x301d69['push'](_0x301d69['shift']());}catch(_0x27f008){_0x301d69['push'](_0x301d69['shift']());}}}(a149_0x472c,0x8d2c4));import{execaSync}from'execa';function a149_0x3539(_0x393d39,_0x4e8bcb){_0x393d39=_0x393d39-0x118;const _0x472c35=a149_0x472c();let _0x3539f3=_0x472c35[_0x393d39];return _0x3539f3;}import{LOVRABET_SKILL_SOURCE as a149_0x2630db}from'../constant/distribution.js';import{PRODUCT_CONFIG,productEnvName}from'../constant/product.js';import{resolveInstalledSkill}from'../skills/skill-presence.js';export const LOVRABET_SKILL_SOURCE=a149_0x2630db;export const LOVRABET_SKILL_GIT_SOURCE=PRODUCT_CONFIG[a149_0x204cd8(0x121)];export const LOVRABET_GLOBAL_SKILL_NAME=PRODUCT_CONFIG['globalSkillName'];export function resolveGlobalSkillName(_0x1d71f5){const _0x2ffd8a=a149_0x204cd8;switch(_0x1d71f5[_0x2ffd8a(0x11c)]()){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[a149_0x204cd8(0x122)]);const CHILD_OUTPUT_MAX_BUFFER=0x10*0x400*0x400;function a149_0x472c(){const _0x3dedf9=['expectedSkillName','trim','!\x20Could\x20not\x20verify\x20\x22','NPX_NOT_FOUND','92hMPSSW','Skill\x20\x22','internalSkillSource','skipNpxSkillsEnvSuffix','code','stdout','failed','pipe','ENOENT','join','CHILD_EXIT_NONZERO','\x22\x20install\x20state:\x20','npx\x20terminated\x20by\x20signal\x20','3525130WWNKMA','npx\x20failed\x20to\x20start','PERMISSION_DENIED','npm_config_global','unknown','unverifiable','243205MlXaPI','stdio','27ySMlAD','reason','signal','exit\x20','7555080nngcJT','stderr','npx','exitCode','1495851cbXvEu','5761AxmALa','SKILL_NOT_INSTALLED','146ZfATOI','\x20failed\x20target(s)','message','shortMessage','partialFailure','absent','NPM_CONFIG_GLOBAL','6qHPwIT','6529733DdFnbW','checked','match','\x22\x20not\x20found\x20after\x20install\x20(checked\x20','40838160qMxapL','state','SPAWN_FAILED'];a149_0x472c=function(){return _0x3dedf9;};return a149_0x472c();}function failure(_0x1532d1,_0x5913b0,_0x2d98b9){return{'ok':![],'status':_0x5913b0,'code':_0x1532d1,'error':'['+_0x1532d1+']\x20'+_0x2d98b9};}export function shouldSkipNpxSkillsAdd(){return process.env[LOVRABET_SKIP_NPX_SKILLS_ENV]==='1';}export function runNpxSkillsAddGlobal(_0x5a1931,_0x1f8be9=LOVRABET_SKILL_SOURCE,_0x7c3bb4){const _0x492c8f=a149_0x204cd8;if(shouldSkipNpxSkillsAdd())return{'ok':!![],'status':0x0,'skipped':!![]};const _0x7265d=['-y','skills@latest','add',_0x1f8be9,'-g','-y'],_0x3e0e57=[_0x492c8f(0x13a),..._0x7265d][_0x492c8f(0x128)]('\x20');console['log']('*\x20'+_0x3e0e57);const _0x4bad3c={...process.env};delete _0x4bad3c[_0x492c8f(0x12f)],delete _0x4bad3c[_0x492c8f(0x145)];const _0x140012=execaSync(_0x492c8f(0x13a),_0x7265d,{'cwd':_0x5a1931,'stdio':_0x492c8f(0x126),'env':_0x4bad3c,'extendEnv':![],'shell':![],'reject':![],'maxBuffer':CHILD_OUTPUT_MAX_BUFFER}),_0x102c28=[_0x140012[_0x492c8f(0x124)]?String(_0x140012[_0x492c8f(0x124)]):'',_0x140012[_0x492c8f(0x139)]?String(_0x140012[_0x492c8f(0x139)]):'']['filter'](Boolean)['join']('\x0a')['trim'](),_0x30183e=_0x140012[_0x492c8f(0x13b)]??null,_0x806e22=_0x5efd3a=>{const _0x3de4d0=_0x492c8f;return _0x7c3bb4?.[_0x3de4d0(0x133)]!=='pipe'&&!_0x5efd3a[_0x3de4d0(0x143)]&&_0x102c28&&console['log'](_0x102c28),_0x5efd3a;};if(_0x140012[_0x492c8f(0x123)]){const _0x137cf4=_0x140012[_0x492c8f(0x123)]===_0x492c8f(0x127)?_0x492c8f(0x11e):_0x140012[_0x492c8f(0x123)]==='EPERM'||_0x140012['code']==='EACCES'?_0x492c8f(0x12e):_0x492c8f(0x11a);return _0x806e22(failure(_0x137cf4,_0x30183e,_0x140012[_0x492c8f(0x142)]??_0x140012['message']??_0x140012['code']));}if(_0x140012[_0x492c8f(0x136)])return _0x806e22(failure('CHILD_TERMINATED',_0x30183e,_0x492c8f(0x12b)+_0x140012[_0x492c8f(0x136)]));if(_0x140012[_0x492c8f(0x125)]&&_0x30183e===null)return _0x806e22(failure(_0x492c8f(0x11a),_0x30183e,_0x140012['shortMessage']??_0x140012[_0x492c8f(0x141)]??_0x492c8f(0x12d)));if(_0x30183e!==0x0)return _0x806e22(failure(_0x492c8f(0x129),_0x30183e,_0x102c28||_0x140012[_0x492c8f(0x142)]||_0x492c8f(0x137)+(_0x30183e??_0x492c8f(0x130))));const _0x124824=_0x7c3bb4?.[_0x492c8f(0x11b)]??resolveGlobalSkillName(_0x1f8be9),_0x4f369a=_0x124824?resolveInstalledSkill(_0x124824,_0x7c3bb4?.['presence']):undefined,_0x53a48f=_0x102c28[_0x492c8f(0x149)](/Failed to install\s+(\d+)/i);if(_0x53a48f&&Number(_0x53a48f[0x1])>0x0){const _0x32fe0d='Installer\x20reported\x20'+_0x53a48f[0x1]+_0x492c8f(0x140)+(_0x102c28?':\x0a'+_0x102c28:'');if(_0x4f369a?.[_0x492c8f(0x119)]==='present')return{'ok':!![],'status':0x0,'partialFailure':{'count':Number(_0x53a48f[0x1]),'output':_0x102c28}};return _0x806e22(failure('INSTALL_PARTIAL',0x0,_0x32fe0d));}if(_0x124824&&_0x4f369a){if(_0x4f369a[_0x492c8f(0x119)]===_0x492c8f(0x144))return _0x806e22(failure(_0x492c8f(0x13e),0x0,_0x492c8f(0x120)+_0x124824+_0x492c8f(0x14a)+_0x4f369a[_0x492c8f(0x148)][_0x492c8f(0x128)](',\x20')+')'));_0x4f369a[_0x492c8f(0x119)]===_0x492c8f(0x131)&&console['warn'](_0x492c8f(0x11d)+_0x124824+_0x492c8f(0x12a)+_0x4f369a[_0x492c8f(0x135)]);}return _0x806e22({'ok':!![],'status':0x0});}
@@ -1 +1 @@
1
- const a150_0x27e147=a150_0x4a21;function a150_0x4a21(_0x178e24,_0xabacd){_0x178e24=_0x178e24-0x1b9;const _0x1505b4=a150_0x1505();let _0x4a21f1=_0x1505b4[_0x178e24];return _0x4a21f1;}function a150_0x1505(){const _0x28ccf7=['.next','build','12KRMrOc','9511130HMQNxY','14667345lNLZBk','.cache','node_modules','.DS_Store','1256820XAVVwG','33wKaNYj','4394772QOkdrd','47514omWnWr','7wUDbqN','lovrabet.skill.json','46eHMuSl','3795635faLGCb','SKILL.md','12899136GhCSNX','.hg','.svn'];a150_0x1505=function(){return _0x28ccf7;};return a150_0x1505();}(function(_0x345581,_0x1d2f60){const _0x5866d7=a150_0x4a21,_0x301cb5=_0x345581();while(!![]){try{const _0x4e763b=parseInt(_0x5866d7(0x1bf))/0x1+parseInt(_0x5866d7(0x1c5))/0x2*(-parseInt(_0x5866d7(0x1c2))/0x3)+parseInt(_0x5866d7(0x1c1))/0x4+parseInt(_0x5866d7(0x1c6))/0x5*(-parseInt(_0x5866d7(0x1b9))/0x6)+parseInt(_0x5866d7(0x1c3))/0x7*(parseInt(_0x5866d7(0x1c8))/0x8)+parseInt(_0x5866d7(0x1bb))/0x9+-parseInt(_0x5866d7(0x1ba))/0xa*(parseInt(_0x5866d7(0x1c0))/0xb);if(_0x4e763b===_0x1d2f60)break;else _0x301cb5['push'](_0x301cb5['shift']());}catch(_0x4ec407){_0x301cb5['push'](_0x301cb5['shift']());}}}(a150_0x1505,0xd262f));export const METADATA_FILE=a150_0x27e147(0x1c4);export const SKILL_FILE=a150_0x27e147(0x1c7);export const IGNORED_FILE_NAMES=new Set([METADATA_FILE,a150_0x27e147(0x1be)]);export const IGNORED_DIR_NAMES=new Set(['.git',a150_0x27e147(0x1c9),a150_0x27e147(0x1ca),a150_0x27e147(0x1bd),a150_0x27e147(0x1cb),'dist',a150_0x27e147(0x1cc),'coverage','.turbo',a150_0x27e147(0x1bc)]);
1
+ const a150_0x418586=a150_0x5a82;(function(_0x133205,_0x47699a){const _0x2ab1ac=a150_0x5a82,_0x26bde6=_0x133205();while(!![]){try{const _0x4b2f33=-parseInt(_0x2ab1ac(0x183))/0x1+-parseInt(_0x2ab1ac(0x181))/0x2+parseInt(_0x2ab1ac(0x17b))/0x3*(parseInt(_0x2ab1ac(0x17c))/0x4)+parseInt(_0x2ab1ac(0x174))/0x5*(-parseInt(_0x2ab1ac(0x173))/0x6)+parseInt(_0x2ab1ac(0x185))/0x7*(parseInt(_0x2ab1ac(0x17d))/0x8)+-parseInt(_0x2ab1ac(0x175))/0x9*(parseInt(_0x2ab1ac(0x176))/0xa)+-parseInt(_0x2ab1ac(0x178))/0xb*(-parseInt(_0x2ab1ac(0x177))/0xc);if(_0x4b2f33===_0x47699a)break;else _0x26bde6['push'](_0x26bde6['shift']());}catch(_0x2e6691){_0x26bde6['push'](_0x26bde6['shift']());}}}(a150_0x1f31,0x1f7a4));export const METADATA_FILE='lovrabet.skill.json';export const SKILL_FILE='SKILL.md';function a150_0x5a82(_0x2fd2b1,_0x116df6){_0x2fd2b1=_0x2fd2b1-0x173;const _0x1f3155=a150_0x1f31();let _0x5a8209=_0x1f3155[_0x2fd2b1];return _0x5a8209;}export const IGNORED_FILE_NAMES=new Set([METADATA_FILE,'.DS_Store']);function a150_0x1f31(){const _0x531775=['.git','71992mvgnWE','.hg','37088GPGVYK','coverage','2933IvEyqF','dist','12tzNUxG','180505RMSedM','265194aWqfvS','70wBgfbn','396rstdgO','69311qqAIcb','.turbo','node_modules','4305TuDVDW','108VFKdfU','4464zkpnYX','.next','build'];a150_0x1f31=function(){return _0x531775;};return a150_0x1f31();}export const IGNORED_DIR_NAMES=new Set([a150_0x418586(0x180),a150_0x418586(0x182),'.svn',a150_0x418586(0x17a),a150_0x418586(0x17e),a150_0x418586(0x186),a150_0x418586(0x17f),a150_0x418586(0x184),a150_0x418586(0x179),'.cache']);
@@ -1 +1 @@
1
- function a151_0x3936(_0x54b613,_0x335865){_0x54b613=_0x54b613-0x8f;const _0x25bb56=a151_0x25bb();let _0x393679=_0x25bb56[_0x54b613];return _0x393679;}(function(_0x1e55b5,_0x58216e){const _0x404da2=a151_0x3936,_0x108cea=_0x1e55b5();while(!![]){try{const _0x382ba7=-parseInt(_0x404da2(0x97))/0x1*(parseInt(_0x404da2(0x9e))/0x2)+parseInt(_0x404da2(0x90))/0x3+parseInt(_0x404da2(0x94))/0x4*(parseInt(_0x404da2(0x9d))/0x5)+-parseInt(_0x404da2(0x8f))/0x6+parseInt(_0x404da2(0x93))/0x7*(parseInt(_0x404da2(0x9a))/0x8)+parseInt(_0x404da2(0x98))/0x9+-parseInt(_0x404da2(0x95))/0xa*(parseInt(_0x404da2(0x92))/0xb);if(_0x382ba7===_0x58216e)break;else _0x108cea['push'](_0x108cea['shift']());}catch(_0x3b43b1){_0x108cea['push'](_0x108cea['shift']());}}}(a151_0x25bb,0xcfcac));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(_0x33b383,_0x4b6495){const _0x28a23b=a151_0x3936,_0x18c09b=normalizeSkillRelativePath(_0x4b6495),_0x88cec0=realOrResolved(_0x33b383),_0x3891ae=resolve(_0x88cec0,..._0x18c09b[_0x28a23b(0x96)]('/'));if(!isPathInside(_0x3891ae,_0x88cec0))throw CliErrors[_0x28a23b(0xa1)](_0x28a23b(0xa2)+_0x4b6495);return ensureNoSymlinkInManagedPath(_0x88cec0,_0x18c09b),_0x3891ae;}export function ensureNoSymlinkInManagedPath(_0xb30cbf,_0x320d04){const _0x2e8571=a151_0x3936;let _0x159873=_0xb30cbf;for(const _0x44e1d3 of _0x320d04[_0x2e8571(0x96)]('/')){_0x159873=resolve(_0x159873,_0x44e1d3);const _0x352477=lstatIfPresent(_0x159873);if(_0x352477?.[_0x2e8571(0xa0)]())throw CliErrors[_0x2e8571(0xa1)](_0x2e8571(0x9f)+_0x320d04);}}export function isDanglingSymlink(_0x298359){const _0x5382f8=a151_0x3936;try{return lstatSync(_0x298359)[_0x5382f8(0xa0)]();}catch{return![];}}export function resolveSymlinkTarget(_0x430c5b){const _0x4a8aac=readlinkSync(_0x430c5b);return isAbsolute(_0x4a8aac)?_0x4a8aac:resolve(dirname(_0x430c5b),_0x4a8aac);}export function isPathInside(_0x5f1efb,_0x187d34){const _0x23f1a0=a151_0x3936,_0x55b4ed=_0x5f1efb['endsWith'](sep)?_0x5f1efb:''+_0x5f1efb+sep,_0x12f5b4=_0x187d34[_0x23f1a0(0x9c)](sep)?_0x187d34:''+_0x187d34+sep;return _0x5f1efb===_0x187d34||_0x55b4ed['startsWith'](_0x12f5b4);}export function realOrResolved(_0x547950){try{return realpathSync(_0x547950);}catch{return resolve(_0x547950);}}export function lstatIfPresent(_0x488559){try{return lstatSync(_0x488559);}catch{return undefined;}}function a151_0x25bb(){const _0x1f57c7=['validation','Unsafe\x20Skill\x20file\x20path:\x20','3403668MXpCKw','4323531NNUoQe','.tmp','110UatMQo','6667899KENIzj','192VSuerP','2314670yVPGIJ','split','186546ZDAMXb','8900424ITxhHx','from','8TnGbMU','utf8','endsWith','94795rQVsHb','6IMpDek','Refusing\x20to\x20write\x20through\x20Skill\x20symlink\x20path:\x20','isSymbolicLink'];a151_0x25bb=function(){return _0x1f57c7;};return a151_0x25bb();}export function writeTextAtomic(_0x872e51,_0x39c34f,_0x38bfaa){const _0x346fa9=a151_0x3936;writeBytesAtomic(_0x872e51,Buffer[_0x346fa9(0x99)](_0x39c34f,_0x346fa9(0x9b)),_0x38bfaa);}export function writeBytesAtomic(_0x47860a,_0x3fe481,_0x60e3aa){const _0x2d6abf=a151_0x3936,_0x3a41c7=_0x47860a+_0x2d6abf(0x91);try{writeFileSync(_0x3a41c7,_0x3fe481,{'mode':_0x60e3aa}),renameSync(_0x3a41c7,_0x47860a);}catch(_0x3dd921){try{rmSync(_0x3a41c7,{'force':!![]});}catch{}throw _0x3dd921;}}export function writeJsonAtomic(_0x34f700,_0x19b258){writeTextAtomic(_0x34f700,JSON['stringify'](_0x19b258,null,0x2)+'\x0a',0x180);}
1
+ function a151_0xac9c(_0x1cb0a1,_0x145761){_0x1cb0a1=_0x1cb0a1-0xa7;const _0xd2c993=a151_0xd2c9();let _0xac9c32=_0xd2c993[_0x1cb0a1];return _0xac9c32;}(function(_0x5ef543,_0x1009ac){const _0x200e29=a151_0xac9c,_0x56ffc1=_0x5ef543();while(!![]){try{const _0xe693fa=-parseInt(_0x200e29(0xab))/0x1*(-parseInt(_0x200e29(0xac))/0x2)+-parseInt(_0x200e29(0xb8))/0x3*(parseInt(_0x200e29(0xb5))/0x4)+-parseInt(_0x200e29(0xb0))/0x5+parseInt(_0x200e29(0xb9))/0x6+parseInt(_0x200e29(0xae))/0x7+-parseInt(_0x200e29(0xaf))/0x8+parseInt(_0x200e29(0xb1))/0x9;if(_0xe693fa===_0x1009ac)break;else _0x56ffc1['push'](_0x56ffc1['shift']());}catch(_0x30d5b2){_0x56ffc1['push'](_0x56ffc1['shift']());}}}(a151_0xd2c9,0x28002));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(_0x2f378a,_0x3c1944){const _0x10bce8=a151_0xac9c,_0x30dcc3=normalizeSkillRelativePath(_0x3c1944),_0x2c57df=realOrResolved(_0x2f378a),_0xf6f07d=resolve(_0x2c57df,..._0x30dcc3[_0x10bce8(0xad)]('/'));if(!isPathInside(_0xf6f07d,_0x2c57df))throw CliErrors[_0x10bce8(0xb2)](_0x10bce8(0xb3)+_0x3c1944);return ensureNoSymlinkInManagedPath(_0x2c57df,_0x30dcc3),_0xf6f07d;}export function ensureNoSymlinkInManagedPath(_0x34127e,_0x14f2c5){const _0x3ce936=a151_0xac9c;let _0x300904=_0x34127e;for(const _0x149b64 of _0x14f2c5[_0x3ce936(0xad)]('/')){_0x300904=resolve(_0x300904,_0x149b64);const _0x1124ba=lstatIfPresent(_0x300904);if(_0x1124ba?.[_0x3ce936(0xa7)]())throw CliErrors['validation'](_0x3ce936(0xb7)+_0x14f2c5);}}export function isDanglingSymlink(_0x25141c){const _0x5bdd55=a151_0xac9c;try{return lstatSync(_0x25141c)[_0x5bdd55(0xa7)]();}catch{return![];}}export function resolveSymlinkTarget(_0x2f8e97){const _0x470cbd=readlinkSync(_0x2f8e97);return isAbsolute(_0x470cbd)?_0x470cbd:resolve(dirname(_0x2f8e97),_0x470cbd);}export function isPathInside(_0x230d24,_0x2b04ad){const _0x3136e3=a151_0xac9c,_0x57380f=_0x230d24[_0x3136e3(0xa9)](sep)?_0x230d24:''+_0x230d24+sep,_0x5b51fc=_0x2b04ad[_0x3136e3(0xa9)](sep)?_0x2b04ad:''+_0x2b04ad+sep;return _0x230d24===_0x2b04ad||_0x57380f[_0x3136e3(0xb6)](_0x5b51fc);}function a151_0xd2c9(){const _0x40ab63=['from','28TakmmD','startsWith','Refusing\x20to\x20write\x20through\x20Skill\x20symlink\x20path:\x20','96306sGKzas','1677330ZWnsOh','isSymbolicLink','.tmp','endsWith','utf8','2GUyqVy','320726tprNMA','split','834141xjdkTo','2549720oSmdKD','451625ZqkuSe','703368PtwSHt','validation','Unsafe\x20Skill\x20file\x20path:\x20'];a151_0xd2c9=function(){return _0x40ab63;};return a151_0xd2c9();}export function realOrResolved(_0x122229){try{return realpathSync(_0x122229);}catch{return resolve(_0x122229);}}export function lstatIfPresent(_0x3fc7ee){try{return lstatSync(_0x3fc7ee);}catch{return undefined;}}export function writeTextAtomic(_0x8fea70,_0x2ee237,_0x3cfaf7){const _0x235aae=a151_0xac9c;writeBytesAtomic(_0x8fea70,Buffer[_0x235aae(0xb4)](_0x2ee237,_0x235aae(0xaa)),_0x3cfaf7);}export function writeBytesAtomic(_0x5144be,_0xf7bc7,_0x5447e5){const _0x500ac6=a151_0xac9c,_0x340f81=_0x5144be+_0x500ac6(0xa8);try{writeFileSync(_0x340f81,_0xf7bc7,{'mode':_0x5447e5}),renameSync(_0x340f81,_0x5144be);}catch(_0x5422af){try{rmSync(_0x340f81,{'force':!![]});}catch{}throw _0x5422af;}}export function writeJsonAtomic(_0x107234,_0x51ce29){writeTextAtomic(_0x107234,JSON['stringify'](_0x51ce29,null,0x2)+'\x0a',0x180);}
@@ -1 +1 @@
1
- function a152_0x4cd1(){const _0x48fe56=['83544nKDZGz','4FbhaLm','5417096TMeGsU','digest','276xgBddJ','13370910aMejqC','6410qhZvsB','67752bhdJNT','sha256','14893749BiUAaT','size','path','hex','update','545DFSsLk','10007410lENyUc'];a152_0x4cd1=function(){return _0x48fe56;};return a152_0x4cd1();}function a152_0x29af(_0x4e4c1c,_0x1009f1){_0x4e4c1c=_0x4e4c1c-0x1a8;const _0x4cd1ea=a152_0x4cd1();let _0x29af5e=_0x4cd1ea[_0x4e4c1c];return _0x29af5e;}(function(_0x1d9900,_0x3f7333){const _0x1148e5=a152_0x29af,_0x48b822=_0x1d9900();while(!![]){try{const _0x5f5819=-parseInt(_0x1148e5(0x1b1))/0x1*(parseInt(_0x1148e5(0x1ac))/0x2)+-parseInt(_0x1148e5(0x1af))/0x3*(parseInt(_0x1148e5(0x1b2))/0x4)+parseInt(_0x1148e5(0x1a9))/0x5*(parseInt(_0x1148e5(0x1ab))/0x6)+-parseInt(_0x1148e5(0x1aa))/0x7+-parseInt(_0x1148e5(0x1ad))/0x8+parseInt(_0x1148e5(0x1b4))/0x9+parseInt(_0x1148e5(0x1b0))/0xa;if(_0x5f5819===_0x3f7333)break;else _0x48b822['push'](_0x48b822['shift']());}catch(_0x53cc5f){_0x48b822['push'](_0x48b822['shift']());}}}(a152_0x4cd1,0xcb129));import{createHash}from'node:crypto';import{fileContent,normalizeManifestFiles}from'./local-files.js';export function contentHash(_0x3a6f5d){const _0x4a2401=a152_0x29af;return createHash(_0x4a2401(0x1b3))[_0x4a2401(0x1a8)](_0x3a6f5d)[_0x4a2401(0x1ae)](_0x4a2401(0x1b7));}export function fileHash(_0xe8627){return bufferSha256(fileContent(_0xe8627));}export function bufferSha256(_0x2fce76){const _0xc65d96=a152_0x29af;return createHash('sha256')['update'](_0x2fce76)['digest'](_0xc65d96(0x1b7));}export function fileTreeHash(_0x45b2e6){const _0x20cf3b=a152_0x29af,_0x519438=createHash('sha256');for(const _0x9c51bd of normalizeManifestFiles(_0x45b2e6)){_0x519438['update'](_0x9c51bd[_0x20cf3b(0x1b6)]),_0x519438[_0x20cf3b(0x1a8)]('\x00'),_0x519438[_0x20cf3b(0x1a8)](_0x9c51bd[_0x20cf3b(0x1b3)]),_0x519438['update']('\x00'),_0x519438[_0x20cf3b(0x1a8)](String(_0x9c51bd[_0x20cf3b(0x1b5)])),_0x519438[_0x20cf3b(0x1a8)]('\x00');}return _0x519438[_0x20cf3b(0x1ae)]('hex');}
1
+ (function(_0x59ff44,_0x146c8c){const _0x111c2e=a152_0x455e,_0x25eb5d=_0x59ff44();while(!![]){try{const _0x5bfcb0=-parseInt(_0x111c2e(0x1eb))/0x1+parseInt(_0x111c2e(0x1ed))/0x2*(-parseInt(_0x111c2e(0x1e8))/0x3)+-parseInt(_0x111c2e(0x1f2))/0x4+-parseInt(_0x111c2e(0x1f0))/0x5+-parseInt(_0x111c2e(0x1f4))/0x6+parseInt(_0x111c2e(0x1ec))/0x7+-parseInt(_0x111c2e(0x1e9))/0x8*(-parseInt(_0x111c2e(0x1ef))/0x9);if(_0x5bfcb0===_0x146c8c)break;else _0x25eb5d['push'](_0x25eb5d['shift']());}catch(_0x2f7015){_0x25eb5d['push'](_0x25eb5d['shift']());}}}(a152_0x4746,0x360d4));import{createHash}from'node:crypto';import{fileContent,normalizeManifestFiles}from'./local-files.js';export function contentHash(_0xb4d409){const _0x52d438=a152_0x455e;return createHash(_0x52d438(0x1e6))['update'](_0xb4d409)[_0x52d438(0x1f3)](_0x52d438(0x1ea));}export function fileHash(_0x4e132d){return bufferSha256(fileContent(_0x4e132d));}export function bufferSha256(_0x1c26d3){const _0x2ba1b2=a152_0x455e;return createHash(_0x2ba1b2(0x1e6))[_0x2ba1b2(0x1e7)](_0x1c26d3)[_0x2ba1b2(0x1f3)](_0x2ba1b2(0x1ea));}function a152_0x455e(_0x362d68,_0x1952cd){_0x362d68=_0x362d68-0x1e6;const _0x474634=a152_0x4746();let _0x455eba=_0x474634[_0x362d68];return _0x455eba;}export function fileTreeHash(_0x779344){const _0x47afce=a152_0x455e,_0x142f3d=createHash(_0x47afce(0x1e6));for(const _0x4abf35 of normalizeManifestFiles(_0x779344)){_0x142f3d[_0x47afce(0x1e7)](_0x4abf35[_0x47afce(0x1f1)]),_0x142f3d[_0x47afce(0x1e7)]('\x00'),_0x142f3d['update'](_0x4abf35[_0x47afce(0x1e6)]),_0x142f3d[_0x47afce(0x1e7)]('\x00'),_0x142f3d['update'](String(_0x4abf35[_0x47afce(0x1ee)])),_0x142f3d[_0x47afce(0x1e7)]('\x00');}return _0x142f3d['digest'](_0x47afce(0x1ea));}function a152_0x4746(){const _0x58f491=['digest','2013516cJQEdk','sha256','update','81MrmRjk','8aKyMeL','hex','376585AhCKzl','2218125lLRAUm','7600skTGTD','size','10042182jrYGHj','1870125WpMAOU','path','89924RPWkhf'];a152_0x4746=function(){return _0x58f491;};return a152_0x4746();}
@@ -1 +1 @@
1
- const a153_0x333160=a153_0x19e0;(function(_0x198608,_0x2428df){const _0x577d78=a153_0x19e0,_0x261625=_0x198608();while(!![]){try{const _0x331010=-parseInt(_0x577d78(0x70))/0x1+-parseInt(_0x577d78(0x6c))/0x2*(parseInt(_0x577d78(0x78))/0x3)+parseInt(_0x577d78(0x74))/0x4+-parseInt(_0x577d78(0x6b))/0x5+-parseInt(_0x577d78(0x69))/0x6*(-parseInt(_0x577d78(0x75))/0x7)+parseInt(_0x577d78(0x6e))/0x8*(parseInt(_0x577d78(0x6d))/0x9)+parseInt(_0x577d78(0x72))/0xa;if(_0x331010===_0x2428df)break;else _0x261625['push'](_0x261625['shift']());}catch(_0x4b2336){_0x261625['push'](_0x261625['shift']());}}}(a153_0x2f5f,0x6ee5a));import{resolve}from'node:path';function a153_0x19e0(_0x90b0c3,_0x3d5f2a){_0x90b0c3=_0x90b0c3-0x69;const _0x2f5f4d=a153_0x2f5f();let _0x19e060=_0x2f5f4d[_0x90b0c3];return _0x19e060;}import{resolveSkillSyncPaths,runtimeAgentSkillRoots,safePathSegment}from'./paths.js';function a153_0x2f5f(){const _0x4fa644=['project','830334BBPnqH','managedRoot','1143945rQFDOC','3398yJjqRz','9UptSwL','587024DUTTcs','global','729756iXNIVL','appCode','3943940uhugxj','.agents','2174364FXbnvo','35frNmdE','cwd','freeze','513RABtqy'];a153_0x2f5f=function(){return _0x4fa644;};return a153_0x2f5f();}export function resolveRuntimeSkillInstallTarget(_0x4bf008,_0x7b6472=a153_0x333160(0x6f),_0x2415a4={}){const _0x140d14=a153_0x333160,_0x3a7d7e=resolveSkillSyncPaths(_0x2415a4),_0x31d875=safePathSegment(_0x4bf008,_0x140d14(0x71)),_0xa56bcd=_0x7b6472===_0x140d14(0x79)?[resolve(_0x2415a4[_0x140d14(0x76)]??process[_0x140d14(0x76)](),_0x140d14(0x73),'skills')]:runtimeAgentSkillRoots(_0x3a7d7e);return Object[_0x140d14(0x77)]({'scope':_0x7b6472,'appCode':_0x31d875,'skillRoots':Object['freeze'](_0xa56bcd),'managedRoot':_0x3a7d7e[_0x140d14(0x6a)]});}
1
+ const a153_0x493e35=a153_0x55ed;(function(_0x567440,_0x27abe9){const _0x2f81e2=a153_0x55ed,_0x3902bd=_0x567440();while(!![]){try{const _0x28b6e1=parseInt(_0x2f81e2(0xb3))/0x1+parseInt(_0x2f81e2(0xb6))/0x2+-parseInt(_0x2f81e2(0xb2))/0x3+-parseInt(_0x2f81e2(0xb5))/0x4*(-parseInt(_0x2f81e2(0xb0))/0x5)+-parseInt(_0x2f81e2(0xba))/0x6*(parseInt(_0x2f81e2(0xb8))/0x7)+parseInt(_0x2f81e2(0xb4))/0x8*(-parseInt(_0x2f81e2(0xae))/0x9)+parseInt(_0x2f81e2(0xad))/0xa;if(_0x28b6e1===_0x27abe9)break;else _0x3902bd['push'](_0x3902bd['shift']());}catch(_0x1e940d){_0x3902bd['push'](_0x3902bd['shift']());}}}(a153_0x4c8f,0x97d63));function a153_0x55ed(_0x333d68,_0x363d4f){_0x333d68=_0x333d68-0xac;const _0x4c8f9e=a153_0x4c8f();let _0x55ed77=_0x4c8f9e[_0x333d68];return _0x55ed77;}import{resolve}from'node:path';function a153_0x4c8f(){const _0xdca3c0=['cwd','159677zcauSk','.agents','108AvlKuJ','freeze','6356180GBUPEp','27gjyFog','project','5ywQcAV','global','7755iZNBLq','230219ETzTTB','2637440GxQpdw','2835664MBffWl','898786IoCmxb'];a153_0x4c8f=function(){return _0xdca3c0;};return a153_0x4c8f();}import{resolveSkillSyncPaths,runtimeAgentSkillRoots,safePathSegment}from'./paths.js';export function resolveRuntimeSkillInstallTarget(_0x27cf23,_0x32aba0=a153_0x493e35(0xb1),_0x4deed8={}){const _0x2ba4a6=a153_0x493e35,_0x501fb5=resolveSkillSyncPaths(_0x4deed8),_0x35442d=safePathSegment(_0x27cf23,'appCode'),_0x59824d=_0x32aba0===_0x2ba4a6(0xaf)?[resolve(_0x4deed8[_0x2ba4a6(0xb7)]??process[_0x2ba4a6(0xb7)](),_0x2ba4a6(0xb9),'skills')]:runtimeAgentSkillRoots(_0x501fb5);return Object[_0x2ba4a6(0xac)]({'scope':_0x32aba0,'appCode':_0x35442d,'skillRoots':Object['freeze'](_0x59824d),'managedRoot':_0x501fb5['managedRoot']});}
@@ -1 +1 @@
1
- const a154_0xbd8b71=a154_0xcff4;function a154_0x2f07(){const _0x519155=['Refusing\x20to\x20copy\x20Skill\x20symlink:\x20','protectedLinkRoots','metadataPath','dir','accessKey','isDirectory','builtin','push','map','get','name','length','1420463JvDoAe','Refusing\x20to\x20shadow\x20reserved\x20Agent\x20Skill\x20in\x20project\x20scope:\x20','filter','Only\x20builtin\x20Skills\x20can\x20be\x20linked\x20into\x20the\x20global\x20Skill\x20root:\x20','updated','external-symlink','lovrabet','skill','project','21684qyzShe','39637500tMnSID','1785gqENCs','unchanged','not-managed-symlink','skillRoots','validation','contentHash','metadata-mismatch','scope','12454371PUVLuf','pruneSkillCodes','agentsSkillsDir','has','activeSkillCodes','1200174qiwRvx','runtime-observe','secret-retriever','managedRoot','Refusing\x20to\x20overwrite\x20unmanaged\x20global\x20Skill\x20directory:\x20','personal','134781QlgqnD','skipped','slice','set','Refusing\x20to\x20link\x20Skill\x20metadata\x20outside\x20target\x20','Refusing\x20to\x20overwrite\x20unmanaged\x20path:\x20','company','isSymbolicLink','scopes','32xXxlPi','trim','skillCode','appCode','20UTwUaS','linked-from-protected-root','removed','Refusing\x20to\x20overwrite\x20global\x20Skill\x20symlink:\x20','values','2414713dvOupG'];a154_0x2f07=function(){return _0x519155;};return a154_0x2f07();}(function(_0x52fb5e,_0x2708dd){const _0x36868f=a154_0xcff4,_0x48db94=_0x52fb5e();while(!![]){try{const _0x4fdcf6=-parseInt(_0x36868f(0x101))/0x1+-parseInt(_0x36868f(0xdc))/0x2+-parseInt(_0x36868f(0xe2))/0x3*(-parseInt(_0x36868f(0xef))/0x4)+parseInt(_0x36868f(0xcf))/0x5*(-parseInt(_0x36868f(0xcd))/0x6)+-parseInt(_0x36868f(0xf4))/0x7*(parseInt(_0x36868f(0xeb))/0x8)+parseInt(_0x36868f(0xd7))/0x9+parseInt(_0x36868f(0xce))/0xa;if(_0x4fdcf6===_0x2708dd)break;else _0x48db94['push'](_0x48db94['shift']());}catch(_0x4a2e30){_0x48db94['push'](_0x48db94['shift']());}}}(a154_0x2f07,0xd73d4));import{existsSync,lstatSync,mkdirSync,readdirSync,symlinkSync,unlinkSync}from'node:fs';import{basename,dirname,resolve}from'node:path';import a154_0x587f10 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}=a154_0x587f10,RESERVED_PROJECT_SKILL_CODES=new Set([a154_0xbd8b71(0xca),a154_0xbd8b71(0xdd),a154_0xbd8b71(0xde)]);export function linkEffectiveRuntimeSkills(_0xba4ec4,_0x1fec3f){const _0x183b1e=a154_0xbd8b71,_0xf08ce0=new Map();for(const _0x3d1ddf of _0xba4ec4){const _0x55ec69=_0x3d1ddf[_0x183b1e(0xcb)][_0x183b1e(0xed)];if(!_0x55ec69)continue;const _0x50828f=_0xf08ce0[_0x183b1e(0xfe)](_0x55ec69);(!_0x50828f||_0x3d1ddf['scope']===_0x183b1e(0xe1))&&_0xf08ce0[_0x183b1e(0xe5)](_0x55ec69,_0x3d1ddf);}const _0x37615a=[];for(const _0x2fa396 of _0xf08ce0[_0x183b1e(0xf3)]()){const _0x5aa577=requireSkillCode(_0x2fa396[_0x183b1e(0xcb)]),_0x2db19d=readMetadataIfPresent(_0x2fa396[_0x183b1e(0xf7)]);if(_0x2db19d?.[_0x183b1e(0xee)]!==_0x1fec3f[_0x183b1e(0xee)]||_0x2db19d[_0x183b1e(0xed)]!==_0x5aa577)throw CliErrors['validation'](_0x183b1e(0xe6)+_0x1fec3f['appCode']+':\x20'+_0x2fa396[_0x183b1e(0xf7)]);const _0x58526c=runtimeSkillLinkName(_0x1fec3f,_0x5aa577);for(const _0x3ea85e of _0x1fec3f[_0x183b1e(0xd2)]){_0x37615a['push'](ensureManagedSymlink(resolve(_0x3ea85e,_0x58526c),_0x2fa396[_0x183b1e(0xf8)],_0x1fec3f,_0x5aa577));}}return _0x37615a;}export function pruneStaleRuntimeSkillLinks(_0x2d4d38,_0xcd47b5,_0x5bd5a5){const _0x5b6c41=a154_0xbd8b71,_0x5e37f8=new Set([..._0xcd47b5][_0x5b6c41(0xfd)](_0x1b1d14=>_0x1b1d14[_0x5b6c41(0xec)]())[_0x5b6c41(0x103)](Boolean)),_0x40db25=_0x5bd5a5?new Set([..._0x5bd5a5][_0x5b6c41(0xfd)](_0x5653b9=>_0x5653b9[_0x5b6c41(0xec)]())['filter'](Boolean)):undefined,_0x15305a=[];for(const _0x523ecd of _0x2d4d38[_0x5b6c41(0xd2)]){for(const _0xf14cf6 of managedTargetSkillLinkPaths(_0x523ecd,_0x2d4d38)){const _0x3b9404=runtimeSkillCodeFromLink(_0x2d4d38,_0xf14cf6);if(_0x40db25&&!_0x40db25[_0x5b6c41(0xda)](_0x3b9404))continue;if(_0x5e37f8['has'](_0x3b9404))continue;_0x15305a[_0x5b6c41(0xfc)](removeManagedSkillLink(_0xf14cf6,_0x2d4d38,_0x3b9404));}}return _0x15305a;}export function pruneStaleRuntimeSkillCache(_0x500cbc,_0xf401f1={}){const _0x788768=a154_0xbd8b71,_0x7d44cc=new Set([..._0x500cbc[_0x788768(0xdb)]][_0x788768(0xfd)](_0x17cba8=>_0x17cba8[_0x788768(0xec)]())['filter'](Boolean)),_0x595755=_0x500cbc[_0x788768(0xd8)]?new Set([..._0x500cbc['pruneSkillCodes']][_0x788768(0xfd)](_0x430fc6=>_0x430fc6[_0x788768(0xec)]())['filter'](Boolean)):undefined,_0x571aba=_0x500cbc[_0x788768(0xea)]??['personal',_0x788768(0xe8)],_0x15543f=resolve(getRuntimeSkillCacheRoot(_0x500cbc['env'],_0x500cbc[_0x788768(0xf9)],_0xf401f1),safePathSegment(_0x500cbc[_0x788768(0xee)],'appCode')),_0x181b0a=[];for(const _0x47aac1 of _0x571aba){const _0x5134e7=resolve(_0x15543f,_0x47aac1);if(!existsSync(_0x5134e7))continue;for(const _0x4360f0 of readdirSync(_0x5134e7,{'withFileTypes':!![]})){if(!_0x4360f0[_0x788768(0xfa)]())continue;const _0xc579c3=_0x4360f0['name'];if(_0x595755&&!_0x595755[_0x788768(0xda)](_0xc579c3))continue;if(_0x7d44cc['has'](_0xc579c3))continue;const _0x4ac8a7=resolve(_0x5134e7,_0xc579c3),_0x39e34b=readMetadataIfPresent(resolve(_0x4ac8a7,METADATA_FILE));if(_0x39e34b?.[_0x788768(0xee)]!==_0x500cbc[_0x788768(0xee)]||_0x39e34b[_0x788768(0xd6)]!==_0x47aac1||_0x39e34b[_0x788768(0xed)]!==_0xc579c3){_0x181b0a[_0x788768(0xfc)]({'path':_0x4ac8a7,'action':'skipped','reason':_0x788768(0xd5)});continue;}if(isLinkedFromAnyRoot(_0x4ac8a7,_0x500cbc[_0x788768(0xf6)]??[])){_0x181b0a[_0x788768(0xfc)]({'path':_0x4ac8a7,'action':_0x788768(0xe3),'reason':_0x788768(0xf0)});continue;}removeSync(_0x4ac8a7),_0x181b0a[_0x788768(0xfc)]({'path':_0x4ac8a7,'action':_0x788768(0xf1)});}}return _0x181b0a;}export function linkGlobalRuntimeSkills(_0x4c6e7b,_0x388497={}){const _0x5c584e=a154_0xbd8b71,_0x1c0281=resolveSkillSyncPaths(_0x388497),_0xec35ec=[];for(const _0x214225 of _0x4c6e7b){if(_0x214225[_0x5c584e(0xd6)]!==_0x5c584e(0xfb))throw CliErrors[_0x5c584e(0xd3)](_0x5c584e(0x104)+_0x214225[_0x5c584e(0xd6)]);const _0x1433bd=requireSkillCode(_0x214225[_0x5c584e(0xcb)]),_0x35b80e=copyManagedSkillDirectory(_0x214225[_0x5c584e(0xf8)],resolve(_0x1c0281[_0x5c584e(0xd9)],_0x1433bd));_0xec35ec[_0x5c584e(0xfc)]({..._0x35b80e,'contentHash':_0x214225[_0x5c584e(0xd4)]});}return _0xec35ec;}function ensureManagedSymlink(_0x21807d,_0x43728f,_0xa500ec,_0x4e90eb){const _0x6bd61c=a154_0xbd8b71;mkdirSync(dirname(_0x21807d),{'recursive':!![],'mode':0x1c0});if(existsSync(_0x21807d)||isDanglingSymlink(_0x21807d)){const _0x4026db=lstatSync(_0x21807d);if(!_0x4026db[_0x6bd61c(0xe9)]())throw CliErrors['validation'](_0x6bd61c(0xe7)+_0x21807d);const _0x335d9b=resolveSymlinkTarget(_0x21807d);if(!isPathInside(realOrResolved(_0x335d9b),realOrResolved(_0xa500ec['managedRoot'])))throw CliErrors['validation']('Refusing\x20to\x20overwrite\x20unmanaged\x20symlink:\x20'+_0x21807d);if(realOrResolved(_0x335d9b)===realOrResolved(_0x43728f))return{'path':_0x21807d,'target':_0x43728f,'action':'unchanged'};const _0x478b8c=readMetadataIfPresent(resolve(_0x335d9b,METADATA_FILE));if(_0xa500ec[_0x6bd61c(0xd6)]===_0x6bd61c(0xcc)&&(_0x478b8c?.[_0x6bd61c(0xee)]!==_0xa500ec[_0x6bd61c(0xee)]||_0x478b8c[_0x6bd61c(0xed)]!==_0x4e90eb))throw CliErrors[_0x6bd61c(0xd3)]('Refusing\x20to\x20overwrite\x20managed\x20Skill\x20link\x20owned\x20by\x20another\x20app\x20or\x20code:\x20'+_0x21807d);return unlinkSync(_0x21807d),symlinkSync(_0x43728f,_0x21807d,_0x6bd61c(0xf8)),{'path':_0x21807d,'target':_0x43728f,'action':_0x6bd61c(0x105)};}return symlinkSync(_0x43728f,_0x21807d,_0x6bd61c(0xf8)),{'path':_0x21807d,'target':_0x43728f,'action':'created'};}function managedTargetSkillLinkPaths(_0x3cf628,_0x480ed3){const _0x27b1e4=a154_0xbd8b71;if(!existsSync(_0x3cf628))return[];const _0x46bc20=_0x480ed3['appCode']+'--';return readdirSync(_0x3cf628,{'withFileTypes':!![]})[_0x27b1e4(0x103)](_0x1eb987=>_0x480ed3[_0x27b1e4(0xd6)]===_0x27b1e4(0xcc)||_0x1eb987[_0x27b1e4(0xff)]['startsWith'](_0x46bc20))[_0x27b1e4(0xfd)](_0x568d92=>resolve(_0x3cf628,_0x568d92[_0x27b1e4(0xff)]));}function removeManagedSkillLink(_0x2bd7c0,_0x119897,_0x489224){const _0x905c8a=a154_0xbd8b71,_0x50a342=lstatIfPresent(_0x2bd7c0);if(!_0x50a342?.[_0x905c8a(0xe9)]())return{'path':_0x2bd7c0,'action':'skipped','reason':_0x905c8a(0xd1)};const _0x41d86c=resolveSymlinkTarget(_0x2bd7c0);if(!isPathInside(realOrResolved(_0x41d86c),realOrResolved(_0x119897[_0x905c8a(0xdf)])))return{'path':_0x2bd7c0,'action':_0x905c8a(0xe3),'reason':_0x905c8a(0xc9)};const _0x54f4a1=readMetadataIfPresent(resolve(_0x41d86c,METADATA_FILE));if(_0x119897[_0x905c8a(0xd6)]===_0x905c8a(0xcc)&&(_0x54f4a1?.['appCode']!==_0x119897[_0x905c8a(0xee)]||_0x54f4a1[_0x905c8a(0xed)]!==_0x489224))return{'path':_0x2bd7c0,'action':_0x905c8a(0xe3),'reason':_0x905c8a(0xd5)};return unlinkSync(_0x2bd7c0),{'path':_0x2bd7c0,'action':_0x905c8a(0xf1)};}function a154_0xcff4(_0x2da048,_0x49e2b4){_0x2da048=_0x2da048-0xc9;const _0x2f0798=a154_0x2f07();let _0xcff445=_0x2f0798[_0x2da048];return _0xcff445;}function isLinkedFromAnyRoot(_0x13295c,_0x82e3cf){const _0x476667=a154_0xbd8b71,_0x1a7883=realOrResolved(_0x13295c);for(const _0x32b9db of _0x82e3cf){if(!existsSync(_0x32b9db))continue;for(const _0x5a6ae8 of readdirSync(_0x32b9db,{'withFileTypes':!![]})){if(!_0x5a6ae8['isSymbolicLink']())continue;const _0x3c56e2=resolve(_0x32b9db,_0x5a6ae8[_0x476667(0xff)]);if(realOrResolved(resolveSymlinkTarget(_0x3c56e2))===_0x1a7883)return!![];}}return![];}function runtimeSkillLinkName(_0x1ab7ce,_0x2599b9){const _0x27df2=a154_0xbd8b71,_0x34fb82=safePathSegment(_0x2599b9,'skillCode');if(_0x1ab7ce[_0x27df2(0xd6)]===_0x27df2(0xcc)&&RESERVED_PROJECT_SKILL_CODES['has'](_0x34fb82))throw CliErrors['validation'](_0x27df2(0x102)+_0x34fb82);return _0x1ab7ce[_0x27df2(0xd6)]===_0x27df2(0xcc)?_0x34fb82:_0x1ab7ce['appCode']+'--'+_0x34fb82;}function runtimeSkillCodeFromLink(_0x1227b5,_0x1581d3){const _0x57f55a=a154_0xbd8b71,_0xdb4693=basename(_0x1581d3);return _0x1227b5[_0x57f55a(0xd6)]==='project'?_0xdb4693:_0xdb4693[_0x57f55a(0xe4)]((_0x1227b5['appCode']+'--')[_0x57f55a(0x100)]);}export function copyManagedSkillDirectory(_0x253a33,_0x5be75b){const _0x21ec44=a154_0xbd8b71,_0x2c09d3=resolve(_0x5be75b,METADATA_FILE),_0x182679=existsSync(_0x5be75b);if(_0x182679){const _0x228fa5=lstatSync(_0x5be75b);if(_0x228fa5[_0x21ec44(0xe9)]())throw CliErrors[_0x21ec44(0xd3)](_0x21ec44(0xf2)+_0x5be75b);if(!_0x228fa5[_0x21ec44(0xfa)]())throw CliErrors[_0x21ec44(0xd3)]('Refusing\x20to\x20overwrite\x20global\x20Skill\x20path:\x20'+_0x5be75b);const _0x4e4dba=readMetadataIfPresent(_0x2c09d3);if(_0x4e4dba?.[_0x21ec44(0xd6)]!=='builtin')throw CliErrors['validation'](_0x21ec44(0xe0)+_0x5be75b);}ensureDirSync(dirname(_0x5be75b));const _0x21cac=_0x182679?readMetadataIfPresent(_0x2c09d3)?.[_0x21ec44(0xd4)]:undefined,_0x4bf3bd=readMetadataIfPresent(resolve(_0x253a33,METADATA_FILE))?.[_0x21ec44(0xd4)];return _0x182679&&removeSync(_0x5be75b),copySkillDirectory(_0x253a33,_0x5be75b),{'path':_0x5be75b,'target':_0x253a33,'action':!_0x182679?'created':_0x21cac===_0x4bf3bd?_0x21ec44(0xd0):_0x21ec44(0x105)};}function copySkillDirectory(_0x2d9fbb,_0x4c8610){copySync(_0x2d9fbb,_0x4c8610,{'dereference':![],'overwrite':!![],'filter'(_0x1492e1){const _0x3e35dd=a154_0xcff4;if(lstatSync(_0x1492e1)[_0x3e35dd(0xe9)]())throw CliErrors[_0x3e35dd(0xd3)](_0x3e35dd(0xf5)+_0x1492e1);return!![];}});}
1
+ const a154_0x302f20=a154_0x3efc;(function(_0x219b72,_0x2f037c){const _0xb26b91=a154_0x3efc,_0x5c4464=_0x219b72();while(!![]){try{const _0x237f47=-parseInt(_0xb26b91(0x9b))/0x1*(parseInt(_0xb26b91(0xad))/0x2)+parseInt(_0xb26b91(0xba))/0x3*(-parseInt(_0xb26b91(0xb0))/0x4)+-parseInt(_0xb26b91(0xa6))/0x5*(parseInt(_0xb26b91(0xce))/0x6)+-parseInt(_0xb26b91(0xb6))/0x7+parseInt(_0xb26b91(0xd3))/0x8*(-parseInt(_0xb26b91(0xcb))/0x9)+parseInt(_0xb26b91(0xc4))/0xa*(-parseInt(_0xb26b91(0x9c))/0xb)+-parseInt(_0xb26b91(0xb3))/0xc*(-parseInt(_0xb26b91(0xca))/0xd);if(_0x237f47===_0x2f037c)break;else _0x5c4464['push'](_0x5c4464['shift']());}catch(_0x408fd5){_0x5c4464['push'](_0x5c4464['shift']());}}}(a154_0x3710,0xb27a5));import{existsSync,lstatSync,mkdirSync,readdirSync,symlinkSync,unlinkSync}from'node:fs';import{basename,dirname,resolve}from'node:path';function a154_0x3efc(_0x107bc0,_0x3aaadf){_0x107bc0=_0x107bc0-0x9a;const _0x371096=a154_0x3710();let _0x3efc86=_0x371096[_0x107bc0];return _0x3efc86;}import a154_0x1f43e4 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}=a154_0x1f43e4,RESERVED_PROJECT_SKILL_CODES=new Set([a154_0x302f20(0xd5),a154_0x302f20(0xc5),'secret-retriever']);export function linkEffectiveRuntimeSkills(_0x4d741f,_0x593aaf){const _0x53c574=a154_0x302f20,_0x17f736=new Map();for(const _0x31eb8b of _0x4d741f){const _0x569d6c=_0x31eb8b[_0x53c574(0xc0)]['skillCode'];if(!_0x569d6c)continue;const _0x33d774=_0x17f736[_0x53c574(0x9f)](_0x569d6c);(!_0x33d774||_0x31eb8b['scope']===_0x53c574(0xa0))&&_0x17f736['set'](_0x569d6c,_0x31eb8b);}const _0x298545=[];for(const _0x1966a1 of _0x17f736[_0x53c574(0xbd)]()){const _0x33f150=requireSkillCode(_0x1966a1['skill']),_0x3d3a10=readMetadataIfPresent(_0x1966a1[_0x53c574(0x9d)]);if(_0x3d3a10?.[_0x53c574(0xcf)]!==_0x593aaf['appCode']||_0x3d3a10[_0x53c574(0xa3)]!==_0x33f150)throw CliErrors[_0x53c574(0xbf)](_0x53c574(0xc9)+_0x593aaf[_0x53c574(0xcf)]+':\x20'+_0x1966a1[_0x53c574(0x9d)]);const _0x2232ac=runtimeSkillLinkName(_0x593aaf,_0x33f150);for(const _0x13ee72 of _0x593aaf['skillRoots']){_0x298545[_0x53c574(0xd6)](ensureManagedSymlink(resolve(_0x13ee72,_0x2232ac),_0x1966a1[_0x53c574(0xcd)],_0x593aaf,_0x33f150));}}return _0x298545;}export function pruneStaleRuntimeSkillLinks(_0x20eb4e,_0x350549,_0x40d927){const _0x39d169=a154_0x302f20,_0x574ff0=new Set([..._0x350549][_0x39d169(0xd0)](_0x54531f=>_0x54531f[_0x39d169(0xbe)]())[_0x39d169(0xaf)](Boolean)),_0x1d060f=_0x40d927?new Set([..._0x40d927][_0x39d169(0xd0)](_0x1507ca=>_0x1507ca[_0x39d169(0xbe)]())[_0x39d169(0xaf)](Boolean)):undefined,_0x2f3151=[];for(const _0x4daff4 of _0x20eb4e['skillRoots']){for(const _0x2c77d4 of managedTargetSkillLinkPaths(_0x4daff4,_0x20eb4e)){const _0x441448=runtimeSkillCodeFromLink(_0x20eb4e,_0x2c77d4);if(_0x1d060f&&!_0x1d060f['has'](_0x441448))continue;if(_0x574ff0[_0x39d169(0xb8)](_0x441448))continue;_0x2f3151[_0x39d169(0xd6)](removeManagedSkillLink(_0x2c77d4,_0x20eb4e,_0x441448));}}return _0x2f3151;}export function pruneStaleRuntimeSkillCache(_0x240d4f,_0x59e44e={}){const _0x299993=a154_0x302f20,_0x366cb6=new Set([..._0x240d4f[_0x299993(0xbb)]][_0x299993(0xd0)](_0x1cfb0c=>_0x1cfb0c[_0x299993(0xbe)]())['filter'](Boolean)),_0x2ac149=_0x240d4f['pruneSkillCodes']?new Set([..._0x240d4f['pruneSkillCodes']][_0x299993(0xd0)](_0xee1259=>_0xee1259[_0x299993(0xbe)]())[_0x299993(0xaf)](Boolean)):undefined,_0x29ae76=_0x240d4f[_0x299993(0xc2)]??[_0x299993(0xa0),_0x299993(0xa7)],_0x2ebea1=resolve(getRuntimeSkillCacheRoot(_0x240d4f[_0x299993(0xa1)],_0x240d4f['accessKey'],_0x59e44e),safePathSegment(_0x240d4f[_0x299993(0xcf)],'appCode')),_0x3ae3b9=[];for(const _0x1e90b6 of _0x29ae76){const _0x387882=resolve(_0x2ebea1,_0x1e90b6);if(!existsSync(_0x387882))continue;for(const _0x3f6616 of readdirSync(_0x387882,{'withFileTypes':!![]})){if(!_0x3f6616[_0x299993(0xd8)]())continue;const _0x2b3145=_0x3f6616[_0x299993(0xb2)];if(_0x2ac149&&!_0x2ac149[_0x299993(0xb8)](_0x2b3145))continue;if(_0x366cb6[_0x299993(0xb8)](_0x2b3145))continue;const _0x56155d=resolve(_0x387882,_0x2b3145),_0x21ced8=readMetadataIfPresent(resolve(_0x56155d,METADATA_FILE));if(_0x21ced8?.[_0x299993(0xcf)]!==_0x240d4f[_0x299993(0xcf)]||_0x21ced8[_0x299993(0xaa)]!==_0x1e90b6||_0x21ced8[_0x299993(0xa3)]!==_0x2b3145){_0x3ae3b9[_0x299993(0xd6)]({'path':_0x56155d,'action':_0x299993(0xac),'reason':_0x299993(0xb7)});continue;}if(isLinkedFromAnyRoot(_0x56155d,_0x240d4f[_0x299993(0xc1)]??[])){_0x3ae3b9[_0x299993(0xd6)]({'path':_0x56155d,'action':_0x299993(0xac),'reason':_0x299993(0xa9)});continue;}removeSync(_0x56155d),_0x3ae3b9[_0x299993(0xd6)]({'path':_0x56155d,'action':_0x299993(0xb1)});}}return _0x3ae3b9;}export function linkGlobalRuntimeSkills(_0x5d32c1,_0x33ca0b={}){const _0x3a4c2c=a154_0x302f20,_0x5e1cde=resolveSkillSyncPaths(_0x33ca0b),_0x576f3c=[];for(const _0x47a729 of _0x5d32c1){if(_0x47a729[_0x3a4c2c(0xaa)]!==_0x3a4c2c(0xd2))throw CliErrors[_0x3a4c2c(0xbf)](_0x3a4c2c(0xcc)+_0x47a729[_0x3a4c2c(0xaa)]);const _0x71c9fa=requireSkillCode(_0x47a729[_0x3a4c2c(0xc0)]),_0x3b42e0=copyManagedSkillDirectory(_0x47a729['dir'],resolve(_0x5e1cde[_0x3a4c2c(0x9a)],_0x71c9fa));_0x576f3c[_0x3a4c2c(0xd6)]({..._0x3b42e0,'contentHash':_0x47a729[_0x3a4c2c(0xb5)]});}return _0x576f3c;}function ensureManagedSymlink(_0x57c0d1,_0x10f459,_0xd0932,_0x5b0edc){const _0x1f2c02=a154_0x302f20;mkdirSync(dirname(_0x57c0d1),{'recursive':!![],'mode':0x1c0});if(existsSync(_0x57c0d1)||isDanglingSymlink(_0x57c0d1)){const _0x4e855d=lstatSync(_0x57c0d1);if(!_0x4e855d[_0x1f2c02(0xd4)]())throw CliErrors[_0x1f2c02(0xbf)](_0x1f2c02(0xa4)+_0x57c0d1);const _0x48a08c=resolveSymlinkTarget(_0x57c0d1);if(!isPathInside(realOrResolved(_0x48a08c),realOrResolved(_0xd0932[_0x1f2c02(0xd7)])))throw CliErrors[_0x1f2c02(0xbf)](_0x1f2c02(0xb9)+_0x57c0d1);if(realOrResolved(_0x48a08c)===realOrResolved(_0x10f459))return{'path':_0x57c0d1,'target':_0x10f459,'action':_0x1f2c02(0xc3)};const _0x54e05b=readMetadataIfPresent(resolve(_0x48a08c,METADATA_FILE));if(_0xd0932[_0x1f2c02(0xaa)]===_0x1f2c02(0xb4)&&(_0x54e05b?.[_0x1f2c02(0xcf)]!==_0xd0932[_0x1f2c02(0xcf)]||_0x54e05b[_0x1f2c02(0xa3)]!==_0x5b0edc))throw CliErrors[_0x1f2c02(0xbf)](_0x1f2c02(0xa8)+_0x57c0d1);return unlinkSync(_0x57c0d1),symlinkSync(_0x10f459,_0x57c0d1,'dir'),{'path':_0x57c0d1,'target':_0x10f459,'action':_0x1f2c02(0xd1)};}return symlinkSync(_0x10f459,_0x57c0d1,_0x1f2c02(0xcd)),{'path':_0x57c0d1,'target':_0x10f459,'action':_0x1f2c02(0xa5)};}function managedTargetSkillLinkPaths(_0x2dae14,_0x1cf1e5){const _0x59eeed=a154_0x302f20;if(!existsSync(_0x2dae14))return[];const _0x1c0a38=_0x1cf1e5[_0x59eeed(0xcf)]+'--';return readdirSync(_0x2dae14,{'withFileTypes':!![]})['filter'](_0x39fd79=>_0x1cf1e5['scope']===_0x59eeed(0xb4)||_0x39fd79[_0x59eeed(0xb2)]['startsWith'](_0x1c0a38))['map'](_0x87b1e2=>resolve(_0x2dae14,_0x87b1e2['name']));}function removeManagedSkillLink(_0x270db3,_0x40951e,_0x32db47){const _0x3c526e=a154_0x302f20,_0x568ff7=lstatIfPresent(_0x270db3);if(!_0x568ff7?.['isSymbolicLink']())return{'path':_0x270db3,'action':_0x3c526e(0xac),'reason':_0x3c526e(0xbc)};const _0x48d850=resolveSymlinkTarget(_0x270db3);if(!isPathInside(realOrResolved(_0x48d850),realOrResolved(_0x40951e[_0x3c526e(0xd7)])))return{'path':_0x270db3,'action':_0x3c526e(0xac),'reason':'external-symlink'};const _0x3ae252=readMetadataIfPresent(resolve(_0x48d850,METADATA_FILE));if(_0x40951e['scope']===_0x3c526e(0xb4)&&(_0x3ae252?.[_0x3c526e(0xcf)]!==_0x40951e[_0x3c526e(0xcf)]||_0x3ae252['skillCode']!==_0x32db47))return{'path':_0x270db3,'action':'skipped','reason':_0x3c526e(0xb7)};return unlinkSync(_0x270db3),{'path':_0x270db3,'action':_0x3c526e(0xb1)};}function isLinkedFromAnyRoot(_0xcc06e3,_0x1df173){const _0x2f02eb=a154_0x302f20,_0x470191=realOrResolved(_0xcc06e3);for(const _0x167cfe of _0x1df173){if(!existsSync(_0x167cfe))continue;for(const _0x1af311 of readdirSync(_0x167cfe,{'withFileTypes':!![]})){if(!_0x1af311[_0x2f02eb(0xd4)]())continue;const _0x5f1bf7=resolve(_0x167cfe,_0x1af311[_0x2f02eb(0xb2)]);if(realOrResolved(resolveSymlinkTarget(_0x5f1bf7))===_0x470191)return!![];}}return![];}function runtimeSkillLinkName(_0x2ebd9b,_0x4bd991){const _0x5c8998=a154_0x302f20,_0x265234=safePathSegment(_0x4bd991,_0x5c8998(0xa3));if(_0x2ebd9b[_0x5c8998(0xaa)]===_0x5c8998(0xb4)&&RESERVED_PROJECT_SKILL_CODES[_0x5c8998(0xb8)](_0x265234))throw CliErrors['validation'](_0x5c8998(0xc7)+_0x265234);return _0x2ebd9b[_0x5c8998(0xaa)]===_0x5c8998(0xb4)?_0x265234:_0x2ebd9b[_0x5c8998(0xcf)]+'--'+_0x265234;}function runtimeSkillCodeFromLink(_0x368fcc,_0x34a3c0){const _0xc9e558=a154_0x302f20,_0x3411a0=basename(_0x34a3c0);return _0x368fcc[_0xc9e558(0xaa)]===_0xc9e558(0xb4)?_0x3411a0:_0x3411a0[_0xc9e558(0x9e)]((_0x368fcc[_0xc9e558(0xcf)]+'--')[_0xc9e558(0xc8)]);}export function copyManagedSkillDirectory(_0x15a797,_0x1bbeb8){const _0x1e1f87=a154_0x302f20,_0x5a65ab=resolve(_0x1bbeb8,METADATA_FILE),_0x51554f=existsSync(_0x1bbeb8);if(_0x51554f){const _0xd9f328=lstatSync(_0x1bbeb8);if(_0xd9f328[_0x1e1f87(0xd4)]())throw CliErrors[_0x1e1f87(0xbf)](_0x1e1f87(0xae)+_0x1bbeb8);if(!_0xd9f328['isDirectory']())throw CliErrors[_0x1e1f87(0xbf)](_0x1e1f87(0xc6)+_0x1bbeb8);const _0x165e88=readMetadataIfPresent(_0x5a65ab);if(_0x165e88?.[_0x1e1f87(0xaa)]!==_0x1e1f87(0xd2))throw CliErrors['validation'](_0x1e1f87(0xa2)+_0x1bbeb8);}ensureDirSync(dirname(_0x1bbeb8));const _0x34d1d2=_0x51554f?readMetadataIfPresent(_0x5a65ab)?.['contentHash']:undefined,_0x5a16e5=readMetadataIfPresent(resolve(_0x15a797,METADATA_FILE))?.[_0x1e1f87(0xb5)];return _0x51554f&&removeSync(_0x1bbeb8),copySkillDirectory(_0x15a797,_0x1bbeb8),{'path':_0x1bbeb8,'target':_0x15a797,'action':!_0x51554f?_0x1e1f87(0xa5):_0x34d1d2===_0x5a16e5?'unchanged':_0x1e1f87(0xd1)};}function copySkillDirectory(_0x3f7633,_0x241ee8){copySync(_0x3f7633,_0x241ee8,{'dereference':![],'overwrite':!![],'filter'(_0x4ef5b3){const _0x2d27d6=a154_0x3efc;if(lstatSync(_0x4ef5b3)['isSymbolicLink']())throw CliErrors[_0x2d27d6(0xbf)](_0x2d27d6(0xab)+_0x4ef5b3);return!![];}});}function a154_0x3710(){const _0x4646da=['skillCode','Refusing\x20to\x20overwrite\x20unmanaged\x20path:\x20','created','215sFBcsx','company','Refusing\x20to\x20overwrite\x20managed\x20Skill\x20link\x20owned\x20by\x20another\x20app\x20or\x20code:\x20','linked-from-protected-root','scope','Refusing\x20to\x20copy\x20Skill\x20symlink:\x20','skipped','1041494bHSNmk','Refusing\x20to\x20overwrite\x20global\x20Skill\x20symlink:\x20','filter','212aVzkdw','removed','name','29868LbyGDV','project','contentHash','231490diOSQC','metadata-mismatch','has','Refusing\x20to\x20overwrite\x20unmanaged\x20symlink:\x20','47733FbXHlx','activeSkillCodes','not-managed-symlink','values','trim','validation','skill','protectedLinkRoots','scopes','unchanged','70SfiBrv','runtime-observe','Refusing\x20to\x20overwrite\x20global\x20Skill\x20path:\x20','Refusing\x20to\x20shadow\x20reserved\x20Agent\x20Skill\x20in\x20project\x20scope:\x20','length','Refusing\x20to\x20link\x20Skill\x20metadata\x20outside\x20target\x20','23439DxNiBG','12060CqsulE','Only\x20builtin\x20Skills\x20can\x20be\x20linked\x20into\x20the\x20global\x20Skill\x20root:\x20','dir','45042CPEYWq','appCode','map','updated','builtin','8432pOijuD','isSymbolicLink','lovrabet','push','managedRoot','isDirectory','agentsSkillsDir','2mBMrMG','162822XPTNcL','metadataPath','slice','get','personal','env','Refusing\x20to\x20overwrite\x20unmanaged\x20global\x20Skill\x20directory:\x20'];a154_0x3710=function(){return _0x4646da;};return a154_0x3710();}
@@ -1 +1 @@
1
- (function(_0x51aba1,_0x1bbe28){const _0x1b0e72=a155_0x11f1,_0x19c4c5=_0x51aba1();while(!![]){try{const _0xa4bdb2=-parseInt(_0x1b0e72(0x75))/0x1+-parseInt(_0x1b0e72(0x77))/0x2+parseInt(_0x1b0e72(0x85))/0x3*(-parseInt(_0x1b0e72(0x91))/0x4)+parseInt(_0x1b0e72(0x8f))/0x5*(parseInt(_0x1b0e72(0x8e))/0x6)+-parseInt(_0x1b0e72(0x97))/0x7+-parseInt(_0x1b0e72(0x92))/0x8*(parseInt(_0x1b0e72(0x84))/0x9)+parseInt(_0x1b0e72(0x74))/0xa;if(_0xa4bdb2===_0x1bbe28)break;else _0x19c4c5['push'](_0x19c4c5['shift']());}catch(_0x4a4a4e){_0x19c4c5['push'](_0x19c4c5['shift']());}}}(a155_0x4631,0x6d3b8));import{existsSync,readdirSync}from'node:fs';import{resolve}from'node:path';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';function a155_0x11f1(_0x569cb5,_0xf5b85d){_0x569cb5=_0x569cb5-0x6b;const _0x463128=a155_0x4631();let _0x11f199=_0x463128[_0x569cb5];return _0x11f199;}export function listLocalRuntimeSkills(_0x3bac15,_0xa325ff,_0x28cf6e={}){const _0x387e04=a155_0x11f1,_0x35c1c9=safePathSegment(_0x3bac15[_0x387e04(0x6b)],_0x387e04(0x6b));if(_0xa325ff[_0x387e04(0x6b)]!==_0x35c1c9)throw CliErrors[_0x387e04(0x86)](_0x387e04(0x6d)+_0xa325ff[_0x387e04(0x6b)]+_0x387e04(0x83)+_0x35c1c9);const _0x9b11d3=normalizeRuntimeSkillScopes(_0x3bac15[_0x387e04(0x7c)]),_0x38cf8e=new Set(_0x9b11d3),_0x109502=_0x3bac15[_0x387e04(0x9a)]?.[_0x387e04(0x8d)](),_0x207d91=new Map(),_0x1189b0=resolve(getRuntimeSkillCacheRoot(_0x3bac15[_0x387e04(0x7f)],_0x3bac15[_0x387e04(0x6f)],_0x28cf6e),_0x35c1c9);for(const _0x157189 of _0x9b11d3){for(const _0x72059d of localSkillEntryDirs(resolve(_0x1189b0,_0x157189))){collectLocalRuntimeSkill(_0x207d91,_0x72059d,{'appCode':_0x35c1c9,'scopes':_0x38cf8e,'code':_0x109502,'source':_0x387e04(0x87)});}}for(const _0x3969a6 of _0xa325ff['skillRoots']){for(const _0x1797ee of localSkillLinkCandidates(_0x3969a6,_0xa325ff,_0x38cf8e)){collectLocalRuntimeSkill(_0x207d91,_0x1797ee,{'appCode':_0x35c1c9,'scopes':_0x38cf8e,'code':_0x109502,'source':_0x387e04(0x73),'linkedPath':_0x1797ee});}}return Array[_0x387e04(0x89)](_0x207d91[_0x387e04(0x79)]())[_0x387e04(0x93)](compareLocalRuntimeSkills);}function a155_0x4631(){const _0x9da080=['52236fnkMSC','6jdOqMA','validation','cache','linkedPath','from','get','linkedPaths','tags','trim','985416kJjuqp','5kXwrxn','isSymbolicLink','141716YzFQAh','376ZnYBNU','sort','skillMdPath','localeCompare','project','2603062tdWfnB','metadataPath','map','code','appCode','cacheDir','Runtime\x20Skill\x20install\x20target\x20app\x20mismatch:\x20','isArray','accessKey','isDirectory','includes','builtin','link','15533900tyxNkF','259287PlAWgC','push','590822tPOGQy','filter','values','startsWith','set','scopes','scope','dir','env','skillCode','name','source','\x20!=\x20'];a155_0x4631=function(){return _0x9da080;};return a155_0x4631();}function localSkillEntryDirs(_0x160842){const _0x56adfa=a155_0x11f1;if(!existsSync(_0x160842))return[];return readdirSync(_0x160842,{'withFileTypes':!![]})[_0x56adfa(0x78)](_0x5791d3=>_0x5791d3[_0x56adfa(0x70)]()||_0x5791d3['isSymbolicLink']())[_0x56adfa(0x99)](_0x5e4f2c=>resolve(_0x160842,_0x5e4f2c['name']));}function localSkillLinkCandidates(_0xd005bf,_0x2276f0,_0x3e816d){const _0x21972c=a155_0x11f1;if(!existsSync(_0xd005bf))return[];const _0x745af=_0x2276f0['appCode']+'--';return readdirSync(_0xd005bf,{'withFileTypes':!![]})[_0x21972c(0x78)](_0x3331f9=>_0x3331f9['isDirectory']()||_0x3331f9[_0x21972c(0x90)]())[_0x21972c(0x78)](_0x33a02b=>_0x2276f0[_0x21972c(0x7d)]===_0x21972c(0x96)||_0x33a02b['name'][_0x21972c(0x7a)](_0x745af)||_0x3e816d['has'](_0x21972c(0x72)))[_0x21972c(0x99)](_0x572b41=>resolve(_0xd005bf,_0x572b41[_0x21972c(0x81)]));}function collectLocalRuntimeSkill(_0x1bb151,_0x5bf195,_0x548e07){const _0x465a1b=a155_0x11f1,_0x10baba=resolve(_0x5bf195,METADATA_FILE),_0x2ee410=readMetadataIfPresent(_0x10baba);if(!_0x2ee410)return;if(_0x2ee410['appCode']!==_0x548e07[_0x465a1b(0x6b)])return;if(!isRuntimeSkillScope(_0x2ee410[_0x465a1b(0x7d)])||!_0x548e07[_0x465a1b(0x7c)]['has'](_0x2ee410[_0x465a1b(0x7d)]))return;const _0x3e6744=_0x2ee410['skillCode']?.[_0x465a1b(0x8d)]();if(!_0x3e6744)return;if(_0x548e07[_0x465a1b(0x9a)]&&_0x3e6744!==_0x548e07[_0x465a1b(0x9a)])return;const _0x20c91d=_0x2ee410[_0x465a1b(0x7d)]+':'+_0x3e6744,_0x16d621=_0x548e07['linkedPath']?[_0x548e07[_0x465a1b(0x88)]]:[],_0x169621=_0x1bb151[_0x465a1b(0x8a)](_0x20c91d);if(_0x169621){_0x548e07['source']===_0x465a1b(0x87)&&(_0x169621[_0x465a1b(0x7e)]=_0x5bf195,_0x169621[_0x465a1b(0x6c)]=_0x5bf195,_0x169621[_0x465a1b(0x94)]=resolve(_0x5bf195,SKILL_FILE),_0x169621[_0x465a1b(0x98)]=_0x10baba);for(const _0x27cf6b of _0x16d621){!_0x169621['linkedPaths'][_0x465a1b(0x71)](_0x27cf6b)&&_0x169621[_0x465a1b(0x8b)][_0x465a1b(0x76)](_0x27cf6b);}_0x169621['linkedPaths'][_0x465a1b(0x93)]();return;}_0x1bb151[_0x465a1b(0x7b)](_0x20c91d,{..._0x2ee410,'tags':Array[_0x465a1b(0x6e)](_0x2ee410[_0x465a1b(0x8c)])?_0x2ee410[_0x465a1b(0x8c)]:[],'scope':_0x2ee410['scope'],'source':'local','dir':_0x5bf195,'cacheDir':_0x548e07[_0x465a1b(0x82)]===_0x465a1b(0x87)?_0x5bf195:undefined,'skillMdPath':resolve(_0x5bf195,SKILL_FILE),'metadataPath':_0x10baba,'linkedPaths':_0x16d621});}function compareLocalRuntimeSkills(_0x1aba8f,_0x4e55a9){const _0x80a4fc=a155_0x11f1,_0x5cc9ef={'personal':0x0,'company':0x1,'builtin':0x2};return _0x5cc9ef[_0x1aba8f[_0x80a4fc(0x7d)]]-_0x5cc9ef[_0x4e55a9[_0x80a4fc(0x7d)]]||_0x1aba8f['skillCode'][_0x80a4fc(0x95)](_0x4e55a9[_0x80a4fc(0x80)])||_0x1aba8f[_0x80a4fc(0x7e)][_0x80a4fc(0x95)](_0x4e55a9[_0x80a4fc(0x7e)]);}
1
+ function a155_0x568a(){const _0x49673e=['name','isSymbolicLink','8RhXWhA','appCode','47425dcFSkn','\x20!=\x20','project','210DHAKaS','scopes','from','423790oFibtu','values','54879JKCiMz','scope','cacheDir','skillCode','trim','local','cache','filter','set','skillMdPath','accessKey','1794483pHqfEW','has','tags','map','env','code','isDirectory','linkedPath','link','2832EroWRT','894383WGojTZ','source','localeCompare','dir','34DZqMhS','builtin','linkedPaths','sort','push','get','validation','1292572bMduGI'];a155_0x568a=function(){return _0x49673e;};return a155_0x568a();}(function(_0xead70f,_0x1e6beb){const _0x145de1=a155_0x1bc4,_0xfdcfba=_0xead70f();while(!![]){try{const _0x1b1a8f=parseInt(_0x145de1(0x104))/0x1*(-parseInt(_0x145de1(0x109))/0x2)+-parseInt(_0x145de1(0xf0))/0x3+-parseInt(_0x145de1(0x110))/0x4+parseInt(_0x145de1(0xe8))/0x5*(parseInt(_0x145de1(0xeb))/0x6)+parseInt(_0x145de1(0x105))/0x7+-parseInt(_0x145de1(0x113))/0x8*(-parseInt(_0x145de1(0xfb))/0x9)+-parseInt(_0x145de1(0xee))/0xa;if(_0x1b1a8f===_0x1e6beb)break;else _0xfdcfba['push'](_0xfdcfba['shift']());}catch(_0x433863){_0xfdcfba['push'](_0xfdcfba['shift']());}}}(a155_0x568a,0x37764));import{existsSync,readdirSync}from'node:fs';import{resolve}from'node:path';import{CliErrors}from'../../errors.js';function a155_0x1bc4(_0x33b191,_0x316022){_0x33b191=_0x33b191-0xe7;const _0x568aa3=a155_0x568a();let _0x1bc4ed=_0x568aa3[_0x33b191];return _0x1bc4ed;}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(_0x2c293a,_0x3e165f,_0x542231={}){const _0x3691a8=a155_0x1bc4,_0x44f9c5=safePathSegment(_0x2c293a['appCode'],_0x3691a8(0xe7));if(_0x3e165f[_0x3691a8(0xe7)]!==_0x44f9c5)throw CliErrors[_0x3691a8(0x10f)]('Runtime\x20Skill\x20install\x20target\x20app\x20mismatch:\x20'+_0x3e165f[_0x3691a8(0xe7)]+_0x3691a8(0xe9)+_0x44f9c5);const _0x53bf2b=normalizeRuntimeSkillScopes(_0x2c293a[_0x3691a8(0xec)]),_0x386fbe=new Set(_0x53bf2b),_0x188392=_0x2c293a[_0x3691a8(0x100)]?.[_0x3691a8(0xf4)](),_0x1d2e28=new Map(),_0x24552f=resolve(getRuntimeSkillCacheRoot(_0x2c293a[_0x3691a8(0xff)],_0x2c293a[_0x3691a8(0xfa)],_0x542231),_0x44f9c5);for(const _0x41bcc9 of _0x53bf2b){for(const _0x5c2266 of localSkillEntryDirs(resolve(_0x24552f,_0x41bcc9))){collectLocalRuntimeSkill(_0x1d2e28,_0x5c2266,{'appCode':_0x44f9c5,'scopes':_0x386fbe,'code':_0x188392,'source':_0x3691a8(0xf6)});}}for(const _0x528070 of _0x3e165f['skillRoots']){for(const _0x3392a0 of localSkillLinkCandidates(_0x528070,_0x3e165f,_0x386fbe)){collectLocalRuntimeSkill(_0x1d2e28,_0x3392a0,{'appCode':_0x44f9c5,'scopes':_0x386fbe,'code':_0x188392,'source':_0x3691a8(0x103),'linkedPath':_0x3392a0});}}return Array[_0x3691a8(0xed)](_0x1d2e28[_0x3691a8(0xef)]())[_0x3691a8(0x10c)](compareLocalRuntimeSkills);}function localSkillEntryDirs(_0x21d30a){const _0x18b358=a155_0x1bc4;if(!existsSync(_0x21d30a))return[];return readdirSync(_0x21d30a,{'withFileTypes':!![]})[_0x18b358(0xf7)](_0x1be743=>_0x1be743[_0x18b358(0x101)]()||_0x1be743[_0x18b358(0x112)]())[_0x18b358(0xfe)](_0xfc9115=>resolve(_0x21d30a,_0xfc9115[_0x18b358(0x111)]));}function localSkillLinkCandidates(_0x1e529b,_0x57b30e,_0x255e93){const _0x284de6=a155_0x1bc4;if(!existsSync(_0x1e529b))return[];const _0x150a0d=_0x57b30e[_0x284de6(0xe7)]+'--';return readdirSync(_0x1e529b,{'withFileTypes':!![]})[_0x284de6(0xf7)](_0xc67486=>_0xc67486['isDirectory']()||_0xc67486[_0x284de6(0x112)]())[_0x284de6(0xf7)](_0x5fba0b=>_0x57b30e[_0x284de6(0xf1)]===_0x284de6(0xea)||_0x5fba0b[_0x284de6(0x111)]['startsWith'](_0x150a0d)||_0x255e93[_0x284de6(0xfc)](_0x284de6(0x10a)))['map'](_0x2f410e=>resolve(_0x1e529b,_0x2f410e[_0x284de6(0x111)]));}function collectLocalRuntimeSkill(_0x54b142,_0x532ae1,_0x31f03f){const _0xce1094=a155_0x1bc4,_0x2ca0ee=resolve(_0x532ae1,METADATA_FILE),_0x2612b2=readMetadataIfPresent(_0x2ca0ee);if(!_0x2612b2)return;if(_0x2612b2[_0xce1094(0xe7)]!==_0x31f03f[_0xce1094(0xe7)])return;if(!isRuntimeSkillScope(_0x2612b2[_0xce1094(0xf1)])||!_0x31f03f['scopes']['has'](_0x2612b2['scope']))return;const _0x5a6912=_0x2612b2['skillCode']?.['trim']();if(!_0x5a6912)return;if(_0x31f03f[_0xce1094(0x100)]&&_0x5a6912!==_0x31f03f[_0xce1094(0x100)])return;const _0x140286=_0x2612b2[_0xce1094(0xf1)]+':'+_0x5a6912,_0x20e911=_0x31f03f[_0xce1094(0x102)]?[_0x31f03f['linkedPath']]:[],_0x10f2bd=_0x54b142[_0xce1094(0x10e)](_0x140286);if(_0x10f2bd){_0x31f03f[_0xce1094(0x106)]===_0xce1094(0xf6)&&(_0x10f2bd['dir']=_0x532ae1,_0x10f2bd[_0xce1094(0xf2)]=_0x532ae1,_0x10f2bd[_0xce1094(0xf9)]=resolve(_0x532ae1,SKILL_FILE),_0x10f2bd['metadataPath']=_0x2ca0ee);for(const _0x3849d2 of _0x20e911){!_0x10f2bd['linkedPaths']['includes'](_0x3849d2)&&_0x10f2bd[_0xce1094(0x10b)][_0xce1094(0x10d)](_0x3849d2);}_0x10f2bd[_0xce1094(0x10b)][_0xce1094(0x10c)]();return;}_0x54b142[_0xce1094(0xf8)](_0x140286,{..._0x2612b2,'tags':Array['isArray'](_0x2612b2[_0xce1094(0xfd)])?_0x2612b2[_0xce1094(0xfd)]:[],'scope':_0x2612b2[_0xce1094(0xf1)],'source':_0xce1094(0xf5),'dir':_0x532ae1,'cacheDir':_0x31f03f[_0xce1094(0x106)]==='cache'?_0x532ae1:undefined,'skillMdPath':resolve(_0x532ae1,SKILL_FILE),'metadataPath':_0x2ca0ee,'linkedPaths':_0x20e911});}function compareLocalRuntimeSkills(_0x2f08c5,_0x20e035){const _0x278eb9=a155_0x1bc4,_0x5c5b8b={'personal':0x0,'company':0x1,'builtin':0x2};return _0x5c5b8b[_0x2f08c5[_0x278eb9(0xf1)]]-_0x5c5b8b[_0x20e035[_0x278eb9(0xf1)]]||_0x2f08c5[_0x278eb9(0xf3)][_0x278eb9(0x107)](_0x20e035[_0x278eb9(0xf3)])||_0x2f08c5['dir'][_0x278eb9(0x107)](_0x20e035[_0x278eb9(0x108)]);}
@@ -1 +1 @@
1
- (function(_0x43c6f1,_0x2abdd7){const _0xab2275=a156_0x1851,_0x37e92b=_0x43c6f1();while(!![]){try{const _0x5973fc=-parseInt(_0xab2275(0x168))/0x1*(parseInt(_0xab2275(0x173))/0x2)+-parseInt(_0xab2275(0x163))/0x3*(-parseInt(_0xab2275(0x15d))/0x4)+-parseInt(_0xab2275(0x171))/0x5*(-parseInt(_0xab2275(0x188))/0x6)+parseInt(_0xab2275(0x185))/0x7*(-parseInt(_0xab2275(0x15e))/0x8)+parseInt(_0xab2275(0x15c))/0x9+parseInt(_0xab2275(0x16c))/0xa*(-parseInt(_0xab2275(0x167))/0xb)+parseInt(_0xab2275(0x169))/0xc;if(_0x5973fc===_0x2abdd7)break;else _0x37e92b['push'](_0x37e92b['shift']());}catch(_0x4e5e69){_0x37e92b['push'](_0x37e92b['shift']());}}}(a156_0x1894,0xb3b21));import{readFileSync,readdirSync,realpathSync}from'node:fs';function a156_0x1894(){const _0x5e7754=['isFile','255122GTUhfI','validation','values','1242GHelxD','trim','name','toLowerCase','6973155uYkDTU','4972AVVlxt','24bcKbjm','isBuffer','path','startsWith','isDirectory','840MutEwx','includes','Skill\x20file\x20content\x20must\x20be\x20text\x20or\x20bytes:\x20','sort','449537sHOvAR','247MQNejK','3878148SxFmmO','has','isArray','170dRfdQH','sha256','push','content','add','28005XUojpS','from','8626gKuwvr','set','bytes','length','Skill\x20file\x20size\x20is\x20invalid:\x20','utf8','test','object','split','Duplicate\x20Skill\x20file\x20path:\x20','toString','size','string','localeCompare','Unsafe\x20Skill\x20file\x20path:\x20','Skill\x20file\x20path\x20must\x20be\x20text.','isSymbolicLink'];a156_0x1894=function(){return _0x5e7754;};return a156_0x1894();}import{relative,resolve}from'node:path';import{CliErrors}from'../../errors.js';import{IGNORED_DIR_NAMES,IGNORED_FILE_NAMES,SKILL_FILE}from'./constants.js';function a156_0x1851(_0x1f5e44,_0x1fe8f2){_0x1f5e44=_0x1f5e44-0x15b;const _0x1894b9=a156_0x1894();let _0x1851bf=_0x1894b9[_0x1f5e44];return _0x1851bf;}export function fileContent(_0x590dfa){const _0x1f1555=a156_0x1851;return _0x590dfa['bytes']??Buffer[_0x1f1555(0x172)](_0x590dfa[_0x1f1555(0x16f)]??'',_0x1f1555(0x178));}export function fileText(_0x55a2e3){const _0x444b43=a156_0x1851;return fileContent(_0x55a2e3)[_0x444b43(0x17d)](_0x444b43(0x178));}export function normalizeLocalFiles(_0x3eecfb){const _0x1d16a0=a156_0x1851;if(!Array[_0x1d16a0(0x16b)](_0x3eecfb)||_0x3eecfb[_0x1d16a0(0x176)]===0x0)return[];const _0x3d681f=new Map();for(const _0x439008 of _0x3eecfb){if(!_0x439008||typeof _0x439008!==_0x1d16a0(0x17a)||typeof _0x439008[_0x1d16a0(0x160)]!==_0x1d16a0(0x17f))throw CliErrors[_0x1d16a0(0x186)](_0x1d16a0(0x182));const _0x2d4943=normalizeSkillRelativePath(_0x439008[_0x1d16a0(0x160)]);if(_0x3d681f[_0x1d16a0(0x16a)](_0x2d4943))throw CliErrors[_0x1d16a0(0x186)](_0x1d16a0(0x17c)+_0x2d4943);if(_0x439008[_0x1d16a0(0x175)]!==undefined&&!Buffer[_0x1d16a0(0x15f)](_0x439008[_0x1d16a0(0x175)]))throw CliErrors[_0x1d16a0(0x186)]('Skill\x20file\x20bytes\x20must\x20be\x20a\x20Buffer:\x20'+_0x2d4943);if(_0x439008[_0x1d16a0(0x175)]===undefined&&typeof _0x439008[_0x1d16a0(0x16f)]!==_0x1d16a0(0x17f))throw CliErrors[_0x1d16a0(0x186)](_0x1d16a0(0x165)+_0x2d4943);const _0x301a39=fileContent(_0x439008);_0x3d681f[_0x1d16a0(0x174)](_0x2d4943,{'path':_0x2d4943,'bytes':_0x301a39});}return Array[_0x1d16a0(0x172)](_0x3d681f[_0x1d16a0(0x187)]())['sort'](compareSkillFiles);}export function normalizeManifestFiles(_0x4c1375){const _0x508795=a156_0x1851;if(!Array[_0x508795(0x16b)](_0x4c1375)||_0x4c1375[_0x508795(0x176)]===0x0)return[];const _0x1f3454=new Map();for(const _0x2a5910 of _0x4c1375){if(!_0x2a5910||typeof _0x2a5910!==_0x508795(0x17a)||typeof _0x2a5910[_0x508795(0x160)]!==_0x508795(0x17f))throw CliErrors[_0x508795(0x186)](_0x508795(0x182));const _0x4ec4fe=normalizeSkillRelativePath(_0x2a5910['path']);if(_0x1f3454[_0x508795(0x16a)](_0x4ec4fe))throw CliErrors[_0x508795(0x186)]('Duplicate\x20Skill\x20file\x20path:\x20'+_0x4ec4fe);if(!isSha256Hex(_0x2a5910[_0x508795(0x16d)]))throw CliErrors[_0x508795(0x186)]('Skill\x20file\x20sha256\x20is\x20invalid:\x20'+_0x4ec4fe);if(!Number['isSafeInteger'](_0x2a5910['size'])||_0x2a5910[_0x508795(0x17e)]<0x0)throw CliErrors[_0x508795(0x186)](_0x508795(0x177)+_0x4ec4fe);_0x1f3454['set'](_0x4ec4fe,{'path':_0x4ec4fe,'sha256':_0x2a5910[_0x508795(0x16d)][_0x508795(0x15b)](),'size':_0x2a5910[_0x508795(0x17e)]});}return Array[_0x508795(0x172)](_0x1f3454['values']())[_0x508795(0x166)](compareSkillFiles);}export function scanSkillDirectory(_0x4bdf8e,_0x4f68ec={}){const _0x4c8e15=realpathSync(_0x4bdf8e),_0x562a59=canonicalExcludedFilePaths(_0x4f68ec['excludedFilePaths']),_0x3bf2bb=[];function _0x55dd3c(_0x2f7f71){const _0x252420=a156_0x1851,_0x41fa6c=readdirSync(_0x2f7f71,{'withFileTypes':!![]})[_0x252420(0x166)]((_0x1d39c0,_0x1b42ac)=>_0x1d39c0[_0x252420(0x18a)][_0x252420(0x180)](_0x1b42ac['name']));for(const _0x451802 of _0x41fa6c){if(_0x451802['isDirectory']()&&IGNORED_DIR_NAMES[_0x252420(0x16a)](_0x451802[_0x252420(0x18a)]))continue;if(IGNORED_FILE_NAMES['has'](_0x451802[_0x252420(0x18a)]))continue;const _0x52feb3=resolve(_0x2f7f71,_0x451802[_0x252420(0x18a)]);if(isExcludedFilePath(_0x52feb3,_0x562a59))continue;if(_0x451802[_0x252420(0x183)]())throw CliErrors['validation']('Skill\x20directory\x20contains\x20unsupported\x20symlink:\x20'+_0x52feb3);const _0x372d7e=toPosixPath(relative(_0x4c8e15,_0x52feb3));if(_0x451802[_0x252420(0x162)]()){_0x55dd3c(_0x52feb3);continue;}if(!_0x451802[_0x252420(0x184)]())continue;validateSkillRelativePath(_0x372d7e);const _0x51711b=readFileSync(_0x52feb3);_0x3bf2bb[_0x252420(0x16e)]({'path':_0x372d7e,'bytes':_0x51711b});}}return _0x55dd3c(_0x4c8e15),normalizeLocalFiles(_0x3bf2bb);}function canonicalExcludedFilePaths(_0x461e15){const _0x58418f=a156_0x1851,_0xca1e9d=new Set();for(const _0x2a8175 of _0x461e15??[]){const _0x1244ca=resolve(_0x2a8175);_0xca1e9d['add'](_0x1244ca);try{_0xca1e9d[_0x58418f(0x170)](realpathSync(_0x1244ca));}catch{}}return _0xca1e9d;}function isExcludedFilePath(_0x5f0b5c,_0x147bbe){const _0x21d608=a156_0x1851;if(_0x147bbe[_0x21d608(0x16a)](_0x5f0b5c))return!![];if(_0x147bbe[_0x21d608(0x17e)]===0x0)return![];try{return _0x147bbe['has'](realpathSync(_0x5f0b5c));}catch{return![];}}export function compareSkillFiles(_0x5b217b,_0x1386ce){const _0x3704c2=a156_0x1851;if(_0x5b217b['path']===SKILL_FILE)return _0x1386ce['path']===SKILL_FILE?0x0:-0x1;if(_0x1386ce[_0x3704c2(0x160)]===SKILL_FILE)return 0x1;return Buffer['compare'](Buffer['from'](_0x5b217b[_0x3704c2(0x160)],_0x3704c2(0x178)),Buffer['from'](_0x1386ce['path'],'utf8'));}export function normalizeSkillRelativePath(_0x5b5110){const _0x3d5ea6=a156_0x1851,_0x5f0302=toPosixPath(_0x5b5110[_0x3d5ea6(0x189)]());return validateSkillRelativePath(_0x5f0302),_0x5f0302;}export function validateSkillRelativePath(_0x57da9e){const _0x2ce156=a156_0x1851;if(!_0x57da9e||_0x57da9e[_0x2ce156(0x161)]('/')||_0x57da9e[_0x2ce156(0x164)]('//'))throw CliErrors[_0x2ce156(0x186)](_0x2ce156(0x181)+_0x57da9e);for(const _0x2c64f8 of _0x57da9e[_0x2ce156(0x17b)]('/')){if(!_0x2c64f8||_0x2c64f8==='.'||_0x2c64f8==='..')throw CliErrors[_0x2ce156(0x186)]('Unsafe\x20Skill\x20file\x20path:\x20'+_0x57da9e);}}export function toPosixPath(_0x55f658){return _0x55f658['replace'](/\\/g,'/');}export function isSha256Hex(_0x38e71a){const _0x4c81f0=a156_0x1851;return typeof _0x38e71a===_0x4c81f0(0x17f)&&/^[a-fA-F0-9]{64}$/[_0x4c81f0(0x179)](_0x38e71a);}
1
+ (function(_0x7cd5b4,_0x4d15ac){const _0x1b4bb5=a156_0x255c,_0x1d3a62=_0x7cd5b4();while(!![]){try{const _0x54fb4d=-parseInt(_0x1b4bb5(0x127))/0x1+parseInt(_0x1b4bb5(0x124))/0x2*(parseInt(_0x1b4bb5(0x12f))/0x3)+parseInt(_0x1b4bb5(0x12a))/0x4*(-parseInt(_0x1b4bb5(0x121))/0x5)+parseInt(_0x1b4bb5(0x136))/0x6+parseInt(_0x1b4bb5(0x122))/0x7+-parseInt(_0x1b4bb5(0x126))/0x8+-parseInt(_0x1b4bb5(0x12c))/0x9;if(_0x54fb4d===_0x4d15ac)break;else _0x1d3a62['push'](_0x1d3a62['shift']());}catch(_0x29e7b6){_0x1d3a62['push'](_0x1d3a62['shift']());}}}(a156_0xb1dd,0xa85f5));function a156_0xb1dd(){const _0x2c8f3e=['length','295492tldArq','string','4796208tXVKxy','isSafeInteger','path','3196683yfzrXJ','toString','Skill\x20file\x20path\x20must\x20be\x20text.','sha256','set','Skill\x20directory\x20contains\x20unsupported\x20symlink:\x20','isFile','1111698daBzAG','size','push','isArray','bytes','trim','utf8','add','object','sort','isDirectory','name','has','Skill\x20file\x20sha256\x20is\x20invalid:\x20','toLowerCase','Skill\x20file\x20content\x20must\x20be\x20text\x20or\x20bytes:\x20','compare','isSymbolicLink','replace','content','Duplicate\x20Skill\x20file\x20path:\x20','validation','55psneja','9525768CJvfaF','from','2ZBTyJR','values','187928VeIHNt','553009xmcMwZ','test'];a156_0xb1dd=function(){return _0x2c8f3e;};return a156_0xb1dd();}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(_0x181128){const _0x111833=a156_0x255c;return _0x181128[_0x111833(0x13a)]??Buffer[_0x111833(0x123)](_0x181128['content']??'',_0x111833(0x13c));}export function fileText(_0x56118e){const _0x3a3fa3=a156_0x255c;return fileContent(_0x56118e)[_0x3a3fa3(0x130)](_0x3a3fa3(0x13c));}export function normalizeLocalFiles(_0x43839c){const _0x198bbe=a156_0x255c;if(!Array[_0x198bbe(0x139)](_0x43839c)||_0x43839c[_0x198bbe(0x129)]===0x0)return[];const _0x51664d=new Map();for(const _0xbe4166 of _0x43839c){if(!_0xbe4166||typeof _0xbe4166!=='object'||typeof _0xbe4166['path']!==_0x198bbe(0x12b))throw CliErrors[_0x198bbe(0x120)](_0x198bbe(0x131));const _0x5cbdbc=normalizeSkillRelativePath(_0xbe4166[_0x198bbe(0x12e)]);if(_0x51664d['has'](_0x5cbdbc))throw CliErrors['validation'](_0x198bbe(0x11f)+_0x5cbdbc);if(_0xbe4166[_0x198bbe(0x13a)]!==undefined&&!Buffer['isBuffer'](_0xbe4166[_0x198bbe(0x13a)]))throw CliErrors[_0x198bbe(0x120)]('Skill\x20file\x20bytes\x20must\x20be\x20a\x20Buffer:\x20'+_0x5cbdbc);if(_0xbe4166[_0x198bbe(0x13a)]===undefined&&typeof _0xbe4166[_0x198bbe(0x11e)]!=='string')throw CliErrors[_0x198bbe(0x120)](_0x198bbe(0x145)+_0x5cbdbc);const _0xb9dc31=fileContent(_0xbe4166);_0x51664d[_0x198bbe(0x133)](_0x5cbdbc,{'path':_0x5cbdbc,'bytes':_0xb9dc31});}return Array[_0x198bbe(0x123)](_0x51664d['values']())[_0x198bbe(0x13f)](compareSkillFiles);}export function normalizeManifestFiles(_0x524b38){const _0x185df9=a156_0x255c;if(!Array[_0x185df9(0x139)](_0x524b38)||_0x524b38[_0x185df9(0x129)]===0x0)return[];const _0x3dfdf4=new Map();for(const _0x136adf of _0x524b38){if(!_0x136adf||typeof _0x136adf!==_0x185df9(0x13e)||typeof _0x136adf['path']!==_0x185df9(0x12b))throw CliErrors['validation'](_0x185df9(0x131));const _0x1d25c5=normalizeSkillRelativePath(_0x136adf[_0x185df9(0x12e)]);if(_0x3dfdf4['has'](_0x1d25c5))throw CliErrors[_0x185df9(0x120)](_0x185df9(0x11f)+_0x1d25c5);if(!isSha256Hex(_0x136adf[_0x185df9(0x132)]))throw CliErrors['validation'](_0x185df9(0x143)+_0x1d25c5);if(!Number[_0x185df9(0x12d)](_0x136adf[_0x185df9(0x137)])||_0x136adf[_0x185df9(0x137)]<0x0)throw CliErrors[_0x185df9(0x120)]('Skill\x20file\x20size\x20is\x20invalid:\x20'+_0x1d25c5);_0x3dfdf4[_0x185df9(0x133)](_0x1d25c5,{'path':_0x1d25c5,'sha256':_0x136adf[_0x185df9(0x132)][_0x185df9(0x144)](),'size':_0x136adf[_0x185df9(0x137)]});}return Array['from'](_0x3dfdf4[_0x185df9(0x125)]())[_0x185df9(0x13f)](compareSkillFiles);}export function scanSkillDirectory(_0x309f7d,_0x25800c={}){const _0x586e65=realpathSync(_0x309f7d),_0x1c3042=canonicalExcludedFilePaths(_0x25800c['excludedFilePaths']),_0x62519b=[];function _0x5bdebf(_0x5839e1){const _0x17d0b7=a156_0x255c,_0x558093=readdirSync(_0x5839e1,{'withFileTypes':!![]})[_0x17d0b7(0x13f)]((_0x3b5f31,_0xad2b91)=>_0x3b5f31[_0x17d0b7(0x141)]['localeCompare'](_0xad2b91[_0x17d0b7(0x141)]));for(const _0x4b6733 of _0x558093){if(_0x4b6733[_0x17d0b7(0x140)]()&&IGNORED_DIR_NAMES[_0x17d0b7(0x142)](_0x4b6733[_0x17d0b7(0x141)]))continue;if(IGNORED_FILE_NAMES['has'](_0x4b6733[_0x17d0b7(0x141)]))continue;const _0x8a99c6=resolve(_0x5839e1,_0x4b6733[_0x17d0b7(0x141)]);if(isExcludedFilePath(_0x8a99c6,_0x1c3042))continue;if(_0x4b6733[_0x17d0b7(0x11c)]())throw CliErrors[_0x17d0b7(0x120)](_0x17d0b7(0x134)+_0x8a99c6);const _0x5a7c8e=toPosixPath(relative(_0x586e65,_0x8a99c6));if(_0x4b6733[_0x17d0b7(0x140)]()){_0x5bdebf(_0x8a99c6);continue;}if(!_0x4b6733[_0x17d0b7(0x135)]())continue;validateSkillRelativePath(_0x5a7c8e);const _0x59284b=readFileSync(_0x8a99c6);_0x62519b[_0x17d0b7(0x138)]({'path':_0x5a7c8e,'bytes':_0x59284b});}}return _0x5bdebf(_0x586e65),normalizeLocalFiles(_0x62519b);}function canonicalExcludedFilePaths(_0x13a558){const _0x30b76d=a156_0x255c,_0x426e63=new Set();for(const _0xc4e581 of _0x13a558??[]){const _0x1ef4d6=resolve(_0xc4e581);_0x426e63[_0x30b76d(0x13d)](_0x1ef4d6);try{_0x426e63[_0x30b76d(0x13d)](realpathSync(_0x1ef4d6));}catch{}}return _0x426e63;}function isExcludedFilePath(_0x4845d6,_0x37197f){const _0x171b93=a156_0x255c;if(_0x37197f['has'](_0x4845d6))return!![];if(_0x37197f[_0x171b93(0x137)]===0x0)return![];try{return _0x37197f[_0x171b93(0x142)](realpathSync(_0x4845d6));}catch{return![];}}export function compareSkillFiles(_0x45a247,_0x448519){const _0x23a254=a156_0x255c;if(_0x45a247[_0x23a254(0x12e)]===SKILL_FILE)return _0x448519[_0x23a254(0x12e)]===SKILL_FILE?0x0:-0x1;if(_0x448519[_0x23a254(0x12e)]===SKILL_FILE)return 0x1;return Buffer[_0x23a254(0x11b)](Buffer[_0x23a254(0x123)](_0x45a247['path'],_0x23a254(0x13c)),Buffer['from'](_0x448519['path'],_0x23a254(0x13c)));}function a156_0x255c(_0x466d5f,_0x3e96bc){_0x466d5f=_0x466d5f-0x11b;const _0xb1dd00=a156_0xb1dd();let _0x255c0d=_0xb1dd00[_0x466d5f];return _0x255c0d;}export function normalizeSkillRelativePath(_0x7d55ed){const _0x35ad5c=a156_0x255c,_0x12cf91=toPosixPath(_0x7d55ed[_0x35ad5c(0x13b)]());return validateSkillRelativePath(_0x12cf91),_0x12cf91;}export function validateSkillRelativePath(_0x2fab08){const _0x28ef95=a156_0x255c;if(!_0x2fab08||_0x2fab08['startsWith']('/')||_0x2fab08['includes']('//'))throw CliErrors[_0x28ef95(0x120)]('Unsafe\x20Skill\x20file\x20path:\x20'+_0x2fab08);for(const _0x147f47 of _0x2fab08['split']('/')){if(!_0x147f47||_0x147f47==='.'||_0x147f47==='..')throw CliErrors['validation']('Unsafe\x20Skill\x20file\x20path:\x20'+_0x2fab08);}}export function toPosixPath(_0x521337){const _0x4cb69b=a156_0x255c;return _0x521337[_0x4cb69b(0x11d)](/\\/g,'/');}export function isSha256Hex(_0x539197){const _0x59b6d7=a156_0x255c;return typeof _0x539197===_0x59b6d7(0x12b)&&/^[a-fA-F0-9]{64}$/[_0x59b6d7(0x128)](_0x539197);}
@@ -1 +1 @@
1
- (function(_0x163936,_0x4110b2){const _0xab849a=a157_0x31b7,_0x36ed11=_0x163936();while(!![]){try{const _0x542395=-parseInt(_0xab849a(0x1fd))/0x1*(-parseInt(_0xab849a(0x21c))/0x2)+parseInt(_0xab849a(0x210))/0x3+-parseInt(_0xab849a(0x200))/0x4+-parseInt(_0xab849a(0x1fb))/0x5+-parseInt(_0xab849a(0x21e))/0x6+-parseInt(_0xab849a(0x20d))/0x7*(-parseInt(_0xab849a(0x208))/0x8)+-parseInt(_0xab849a(0x1fe))/0x9;if(_0x542395===_0x4110b2)break;else _0x36ed11['push'](_0x36ed11['shift']());}catch(_0x7a9f5c){_0x36ed11['push'](_0x36ed11['shift']());}}}(a157_0x33c7,0x347cf));import{existsSync,lstatSync,mkdirSync,readFileSync,rmSync}from'node:fs';import{dirname,resolve}from'node:path';import{isCollection,isMap,isNode,parseDocument,visit}from'yaml';function a157_0x33c7(){const _0xf3580=['test','entries','340407zEEaaf','find','length','toString','name:\x20','paths','appCode','scope','flow','trim','trimEnd','filter','274tuNcpm','contents','1093572fAGYal','example','validation','slice','status','description','name','replace','displayName:\x20','contentHash','force','schemaVersion','displayName','version','packageBytes','Push\x20the\x20directory\x20first,\x20then\x20rerun\x20skill\x20install.\x20Changed\x20file:\x20','accessKey','isFile','skillCode','\x0a---\x0a\x0a','---','keys','utf8','has','183315hVVEoC','pulledAt','2887rKOZVf','234630aYLcPk','join','877444GNnkxc','Local\x20Skill\x20files\x20have\x20unpushed\x20edits:\x20','path','errors','Managed\x20file\x20was\x20removed\x20locally:\x20','delete','fileHashes','skillName','1362872ZcVoLp','Remote\x20Skill\x20would\x20overwrite\x20a\x20local\x20non-file\x20path:\x20','---\x0a','map','env','7gCZirA'];a157_0x33c7=function(){return _0xf3580;};return a157_0x33c7();}function a157_0x31b7(_0xf55e9e,_0x205ac3){_0xf55e9e=_0xf55e9e-0x1e8;const _0x33c7f0=a157_0x33c7();let _0x31b77c=_0x33c7f0[_0xf55e9e];return _0x31b77c;}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';import{getRuntimeSkillDir}from'./paths.js';import{extractDownloadedPackage,requirePackageBytes}from'./zip-package.js';export function materializeRuntimeSkill(_0x2442a1,_0x108fe0,_0x5ec250){const _0xb1145a=a157_0x31b7,_0x241f79=requireSkillCode(_0x2442a1),_0x48abd1=requirePackageBytes(_0x241f79,_0x5ec250[_0xb1145a(0x1f1)]),_0x1e191e=extractDownloadedPackage(_0x48abd1),_0x1d40c6=_0x1e191e[_0xb1145a(0x211)](_0x1e7071=>_0x1e7071[_0xb1145a(0x202)]===SKILL_FILE);if(!_0x1d40c6)throw CliErrors[_0xb1145a(0x220)]('Runtime\x20Skill\x20package\x20is\x20missing\x20'+SKILL_FILE+':\x20'+_0x241f79);const _0x3e1196=withMaterializedSkillFrontmatter(_0x1e191e,_0x2442a1,_0x241f79),_0x13d18e=_0x3e1196[_0xb1145a(0x211)](_0x405985=>_0x405985[_0xb1145a(0x202)]===SKILL_FILE),_0x22452d=fileText(_0x13d18e),_0x2c8073=getRuntimeSkillDir(_0x5ec250[_0xb1145a(0x20c)],_0x5ec250[_0xb1145a(0x1f3)],_0x5ec250[_0xb1145a(0x216)],_0x108fe0,_0x241f79,_0x5ec250[_0xb1145a(0x215)]),_0x273652=resolve(_0x2c8073,SKILL_FILE),_0x4fb079=resolve(_0x2c8073,METADATA_FILE),_0x4a3f96=contentHash(_0x22452d),_0x268080=readMetadataIfPresent(_0x4fb079)?.[_0xb1145a(0x206)];ensurePulledFilesCanBeOverwritten(_0x2c8073,_0x4fb079,_0x3e1196,_0x5ec250[_0xb1145a(0x1ed)]===!![]),mkdirSync(_0x2c8073,{'recursive':!![],'mode':0x1c0});const _0x1e9a6c=existsSync(_0x273652)?readFileSync(_0x273652,_0xb1145a(0x1f9)):undefined;return materializeFiles(_0x2c8073,_0x3e1196),removeStaleManagedFiles(_0x2c8073,_0x268080,_0x3e1196),writeJsonAtomic(_0x4fb079,buildMetadata(_0x2442a1,_0x108fe0,_0x5ec250['appCode'],_0x4a3f96,_0x5ec250[_0xb1145a(0x1fc)],_0x3e1196,_0x48abd1)),{'skill':_0x2442a1,'scope':_0x108fe0,'dir':_0x2c8073,'skillMdPath':_0x273652,'metadataPath':_0x4fb079,'contentHash':_0x4a3f96,'changed':_0x1e9a6c!==_0x22452d};}export function reuseMaterializedRuntimeSkill(_0x359e07,_0x432795,_0x5b6306){const _0x2b49cc=a157_0x31b7,_0xee8e30=_0x359e07[_0x2b49cc(0x1f0)]?.[_0x2b49cc(0x219)]();if(!_0xee8e30)return undefined;const _0x4ec556=requireSkillCode(_0x359e07),_0x2d6239=getRuntimeSkillDir(_0x5b6306[_0x2b49cc(0x20c)],_0x5b6306[_0x2b49cc(0x1f3)],_0x5b6306[_0x2b49cc(0x216)],_0x432795,_0x4ec556,_0x5b6306[_0x2b49cc(0x215)]),_0x43ee5f=resolve(_0x2d6239,SKILL_FILE),_0x40b645=resolve(_0x2d6239,METADATA_FILE),_0x2e0aaf=readMetadataIfPresent(_0x40b645);if(!_0x2e0aaf||_0x2e0aaf[_0x2b49cc(0x1ee)]!==0x2||_0x2e0aaf[_0x2b49cc(0x216)]!==_0x5b6306[_0x2b49cc(0x216)]||_0x2e0aaf[_0x2b49cc(0x217)]!==_0x432795||_0x2e0aaf[_0x2b49cc(0x1f5)]!==_0x4ec556||_0x2e0aaf[_0x2b49cc(0x1f0)]!==_0xee8e30||_0x2e0aaf['id']!==_0x359e07['id']||_0x2e0aaf['skillName']!==_0x359e07['skillName']||_0x2e0aaf[_0x2b49cc(0x1e8)]!==_0x359e07[_0x2b49cc(0x1e8)]||_0x2e0aaf['example']!==_0x359e07[_0x2b49cc(0x21f)]||_0x2e0aaf[_0x2b49cc(0x222)]!==_0x359e07[_0x2b49cc(0x222)]||!_0x2e0aaf[_0x2b49cc(0x1ec)]||!_0x2e0aaf[_0x2b49cc(0x206)]||!Object['hasOwn'](_0x2e0aaf['fileHashes'],SKILL_FILE))return undefined;for(const [_0x1fdca8,_0x19b851]of Object[_0x2b49cc(0x20f)](_0x2e0aaf['fileHashes'])){if(!/^[a-f0-9]{64}$/[_0x2b49cc(0x20e)](_0x19b851))return undefined;const _0x471211=resolveManagedFilePath(_0x2d6239,_0x1fdca8);if(!existsSync(_0x471211)||!lstatSync(_0x471211)[_0x2b49cc(0x1f4)]())return undefined;if(bufferSha256(readFileSync(_0x471211))!==_0x19b851)return undefined;}return{'skill':_0x359e07,'scope':_0x432795,'dir':_0x2d6239,'skillMdPath':_0x43ee5f,'metadataPath':_0x40b645,'contentHash':_0x2e0aaf[_0x2b49cc(0x1ec)],'changed':![]};}function withMaterializedSkillFrontmatter(_0x14ec1b,_0x3b4d4a,_0x576543){const _0x9618c3=a157_0x31b7,_0x1a6570=skillDisplayName(_0x3b4d4a,_0x576543),_0x3a3b10=_0x3b4d4a[_0x9618c3(0x1e8)]?.[_0x9618c3(0x219)]()||_0x1a6570||_0x576543;return normalizeLocalFiles(_0x14ec1b)[_0x9618c3(0x20b)](_0x1184bc=>{const _0x18d9bb=_0x9618c3,_0x40d7dd=fileText(_0x1184bc);if(_0x1184bc[_0x18d9bb(0x202)]!==SKILL_FILE)return _0x1184bc;if(hasYamlFrontmatter(_0x40d7dd))return{'path':_0x1184bc[_0x18d9bb(0x202)],'content':withSyncedDisplayName(_0x40d7dd,_0x1a6570)};return{'path':_0x1184bc[_0x18d9bb(0x202)],'content':prependSkillFrontmatter(_0x40d7dd,{'name':_0x576543,'displayName':_0x1a6570,'description':_0x3a3b10})};});}function hasYamlFrontmatter(_0x1864d1){const _0xca089b=a157_0x31b7;return/^\uFEFF?---\s*\r?\n/[_0xca089b(0x20e)](_0x1864d1);}function prependSkillFrontmatter(_0x5e24c8,_0x44d66c){const _0x4be27c=a157_0x31b7,_0xeaf7a6=_0x5e24c8[_0x4be27c(0x1ea)](/^\uFEFF/,'');return['---',_0x4be27c(0x214)+yamlString(_0x44d66c[_0x4be27c(0x1e9)]),_0x44d66c[_0x4be27c(0x1ef)]?_0x4be27c(0x1eb)+yamlString(_0x44d66c[_0x4be27c(0x1ef)]):undefined,'description:\x20'+yamlString(_0x44d66c['description']),_0x4be27c(0x1f7),'',_0xeaf7a6][_0x4be27c(0x21b)](_0x572287=>_0x572287!==undefined)[_0x4be27c(0x1ff)]('\x0a');}function yamlString(_0x34589d){const _0x466e19=a157_0x31b7;return JSON['stringify'](_0x34589d['replace'](/\r/g,'')[_0x466e19(0x219)]());}function skillDisplayName(_0x2bf8f0,_0x5a1c05){const _0x2baca9=a157_0x31b7,_0x13af9d=_0x2bf8f0[_0x2baca9(0x207)]?.['trim']();return _0x13af9d||_0x5a1c05;}function withSyncedDisplayName(_0xb666f9,_0xddc29c){const _0xd4c821=a157_0x31b7,_0x5b84ea=_0xb666f9['match'](/^(\uFEFF?)---\s*\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/);if(!_0x5b84ea)return _0xb666f9;const _0x54fe08=_0x5b84ea[0x1]??'',_0x273837=_0x5b84ea[0x2]??'',_0x30279f=parseDocument(_0x273837);if(_0x30279f[_0xd4c821(0x203)][_0xd4c821(0x212)]>0x0||!isMap(_0x30279f[_0xd4c821(0x21d)]))return _0xb666f9;if(_0xddc29c)_0x30279f['set']('displayName',_0xddc29c);else{if(_0x30279f[_0xd4c821(0x1fa)](_0xd4c821(0x1ef)))_0x30279f[_0xd4c821(0x205)]('displayName');else return _0xb666f9;}forceBlockCollections(_0x30279f[_0xd4c821(0x21d)]);const _0xe6ae9d=_0x30279f[_0xd4c821(0x213)]({'lineWidth':0x0})[_0xd4c821(0x21a)](),_0x380d6a=_0xb666f9[_0xd4c821(0x221)](_0x5b84ea[0x0]['length'])[_0xd4c821(0x1ea)](/^\r?\n/,'');return _0x54fe08+_0xd4c821(0x20a)+_0xe6ae9d+_0xd4c821(0x1f6)+_0x380d6a;}function forceBlockCollections(_0x312c04){if(!isNode(_0x312c04))return;visit(_0x312c04,(_0x306cf8,_0x57b830)=>{const _0x1cf2a9=a157_0x31b7;isCollection(_0x57b830)&&(_0x57b830[_0x1cf2a9(0x218)]=![]);});}function ensurePulledFilesCanBeOverwritten(_0x5da8b4,_0x8aa7e7,_0x2eeb6f,_0x5b2d5a){const _0x23fcc1=a157_0x31b7;if(_0x5b2d5a||!existsSync(_0x8aa7e7))return;const _0x9d5c92=readMetadataIfPresent(_0x8aa7e7);if(!_0x9d5c92)return;const _0x5649ae=_0x9d5c92['fileHashes']&&Object[_0x23fcc1(0x1f8)](_0x9d5c92[_0x23fcc1(0x206)])['length']>0x0?_0x9d5c92[_0x23fcc1(0x206)]:undefined;if(_0x5649ae)for(const [_0x47a7fd,_0x50bdf3]of Object['entries'](_0x5649ae)){const _0x2180c1=resolveManagedFilePath(_0x5da8b4,_0x47a7fd);if(!existsSync(_0x2180c1))throw CliErrors[_0x23fcc1(0x220)](_0x23fcc1(0x201)+_0x5da8b4,_0x23fcc1(0x204)+_0x47a7fd);const _0x1b17d4=lstatSync(_0x2180c1);if(!_0x1b17d4[_0x23fcc1(0x1f4)]())throw CliErrors[_0x23fcc1(0x220)](_0x23fcc1(0x201)+_0x5da8b4,'Managed\x20file\x20is\x20no\x20longer\x20a\x20regular\x20file:\x20'+_0x47a7fd);const _0x327033=bufferSha256(readFileSync(_0x2180c1));if(_0x327033!==_0x50bdf3)throw CliErrors[_0x23fcc1(0x220)](_0x23fcc1(0x201)+_0x5da8b4+'.\x20Changed\x20file:\x20'+_0x47a7fd,_0x23fcc1(0x1f2)+_0x47a7fd);}else{const _0x42a987=resolve(_0x5da8b4,SKILL_FILE);if(existsSync(_0x42a987)&&_0x9d5c92['contentHash']){const _0x4bd7d7=contentHash(readFileSync(_0x42a987,_0x23fcc1(0x1f9)));if(_0x4bd7d7!==_0x9d5c92[_0x23fcc1(0x1ec)])throw CliErrors[_0x23fcc1(0x220)]('Local\x20SKILL.md\x20has\x20unpushed\x20edits:\x20'+_0x42a987,'Push\x20the\x20directory\x20first,\x20then\x20rerun\x20skill\x20install.');}}for(const _0x4a43ce of normalizeLocalFiles(_0x2eeb6f)){if(_0x5649ae?.[_0x4a43ce[_0x23fcc1(0x202)]])continue;if(!_0x5649ae&&_0x4a43ce[_0x23fcc1(0x202)]===SKILL_FILE)continue;const _0x52d476=resolveManagedFilePath(_0x5da8b4,_0x4a43ce[_0x23fcc1(0x202)]);if(!existsSync(_0x52d476))continue;const _0x3ff14f=lstatSync(_0x52d476);if(!_0x3ff14f['isFile']())throw CliErrors['validation'](_0x23fcc1(0x201)+_0x5da8b4,_0x23fcc1(0x209)+_0x4a43ce[_0x23fcc1(0x202)]);const _0x521e12=bufferSha256(readFileSync(_0x52d476));if(_0x521e12!==fileHash(_0x4a43ce))throw CliErrors[_0x23fcc1(0x220)](_0x23fcc1(0x201)+_0x5da8b4,'Remote\x20Skill\x20would\x20overwrite\x20an\x20unmanaged\x20local\x20file:\x20'+_0x4a43ce[_0x23fcc1(0x202)]);}}function materializeFiles(_0x50d146,_0x5ae596){for(const _0x391fef of normalizeLocalFiles(_0x5ae596)){const _0x1a5151=resolveManagedFilePath(_0x50d146,_0x391fef['path']);mkdirSync(dirname(_0x1a5151),{'recursive':!![],'mode':0x1c0}),writeBytesAtomic(_0x1a5151,fileContent(_0x391fef),0x180);}}function removeStaleManagedFiles(_0x2e1c8a,_0x27dabd,_0x331b20){const _0x6d4d67=a157_0x31b7;if(!_0x27dabd)return;const _0x4e3793=new Set(normalizeLocalFiles(_0x331b20)['map'](_0x4c8291=>_0x4c8291[_0x6d4d67(0x202)]));for(const _0x9ee4c5 of Object['keys'](_0x27dabd)){if(_0x4e3793[_0x6d4d67(0x1fa)](_0x9ee4c5))continue;const _0xfa04dc=resolveManagedFilePath(_0x2e1c8a,_0x9ee4c5);existsSync(_0xfa04dc)&&lstatSync(_0xfa04dc)['isFile']()&&rmSync(_0xfa04dc,{'force':!![]});}}
1
+ (function(_0x1790f2,_0x22b1e1){const _0x56fd2c=a157_0x55d5,_0x36c60a=_0x1790f2();while(!![]){try{const _0x1e26ae=parseInt(_0x56fd2c(0x1e7))/0x1*(parseInt(_0x56fd2c(0x1f1))/0x2)+-parseInt(_0x56fd2c(0x208))/0x3*(parseInt(_0x56fd2c(0x1d9))/0x4)+parseInt(_0x56fd2c(0x1da))/0x5*(parseInt(_0x56fd2c(0x20f))/0x6)+-parseInt(_0x56fd2c(0x1e5))/0x7+parseInt(_0x56fd2c(0x1ec))/0x8+-parseInt(_0x56fd2c(0x1fe))/0x9*(-parseInt(_0x56fd2c(0x1ed))/0xa)+parseInt(_0x56fd2c(0x205))/0xb*(-parseInt(_0x56fd2c(0x1ee))/0xc);if(_0x1e26ae===_0x22b1e1)break;else _0x36c60a['push'](_0x36c60a['shift']());}catch(_0x52f95d){_0x36c60a['push'](_0x36c60a['shift']());}}}(a157_0x2298,0x841ba));import{existsSync,lstatSync,mkdirSync,readFileSync,rmSync}from'node:fs';import{dirname,resolve}from'node:path';function a157_0x55d5(_0x4b0f8e,_0x5e5e9f){_0x4b0f8e=_0x4b0f8e-0x1d7;const _0x229818=a157_0x2298();let _0x55d5bc=_0x229818[_0x4b0f8e];return _0x55d5bc;}function a157_0x2298(){const _0x5ae052=['length','---\x0a','Push\x20the\x20directory\x20first,\x20then\x20rerun\x20skill\x20install.\x20Changed\x20file:\x20','4028136sfTLiu','470JpjpJt','8787360LmfSbr','\x0a---\x0a\x0a','join','12490RWYGdf','contents','name:\x20','path','toString','version','test','trimEnd','has','schemaVersion','displayName','---','keys','186696NxZTpw','Managed\x20file\x20is\x20no\x20longer\x20a\x20regular\x20file:\x20','status','skillCode','stringify','packageBytes','set','11JkqYzl','fileHashes','trim','289269uzkfaF','validation','Push\x20the\x20directory\x20first,\x20then\x20rerun\x20skill\x20install.','find','utf8','entries','match','1938LvRgat','Managed\x20file\x20was\x20removed\x20locally:\x20','accessKey','appCode','replace','.\x20Changed\x20file:\x20','scope','force','8MAsToU','3670bClMIF','paths','isFile','description:\x20','Local\x20Skill\x20files\x20have\x20unpushed\x20edits:\x20','env','contentHash','Local\x20SKILL.md\x20has\x20unpushed\x20edits:\x20','filter','map','example','2969309TkEkhN','pulledAt','28YrXRZF','description'];a157_0x2298=function(){return _0x5ae052;};return a157_0x2298();}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';import{getRuntimeSkillDir}from'./paths.js';import{extractDownloadedPackage,requirePackageBytes}from'./zip-package.js';export function materializeRuntimeSkill(_0x2cfb8b,_0x1da3b2,_0xbb994c){const _0x647638=a157_0x55d5,_0x153293=requireSkillCode(_0x2cfb8b),_0x11e69f=requirePackageBytes(_0x153293,_0xbb994c[_0x647638(0x203)]),_0x2d37f8=extractDownloadedPackage(_0x11e69f),_0x4b6c75=_0x2d37f8[_0x647638(0x20b)](_0x3175ff=>_0x3175ff['path']===SKILL_FILE);if(!_0x4b6c75)throw CliErrors[_0x647638(0x209)]('Runtime\x20Skill\x20package\x20is\x20missing\x20'+SKILL_FILE+':\x20'+_0x153293);const _0x46f45d=withMaterializedSkillFrontmatter(_0x2d37f8,_0x2cfb8b,_0x153293),_0x457596=_0x46f45d['find'](_0x5abe86=>_0x5abe86['path']===SKILL_FILE),_0x27aa33=fileText(_0x457596),_0x13232e=getRuntimeSkillDir(_0xbb994c['env'],_0xbb994c[_0x647638(0x211)],_0xbb994c[_0x647638(0x212)],_0x1da3b2,_0x153293,_0xbb994c[_0x647638(0x1db)]),_0x20b193=resolve(_0x13232e,SKILL_FILE),_0x5d5ef6=resolve(_0x13232e,METADATA_FILE),_0x19683b=contentHash(_0x27aa33),_0xf2c14e=readMetadataIfPresent(_0x5d5ef6)?.[_0x647638(0x206)];ensurePulledFilesCanBeOverwritten(_0x13232e,_0x5d5ef6,_0x46f45d,_0xbb994c[_0x647638(0x1d8)]===!![]),mkdirSync(_0x13232e,{'recursive':!![],'mode':0x1c0});const _0x13749d=existsSync(_0x20b193)?readFileSync(_0x20b193,_0x647638(0x20c)):undefined;return materializeFiles(_0x13232e,_0x46f45d),removeStaleManagedFiles(_0x13232e,_0xf2c14e,_0x46f45d),writeJsonAtomic(_0x5d5ef6,buildMetadata(_0x2cfb8b,_0x1da3b2,_0xbb994c[_0x647638(0x212)],_0x19683b,_0xbb994c[_0x647638(0x1e6)],_0x46f45d,_0x11e69f)),{'skill':_0x2cfb8b,'scope':_0x1da3b2,'dir':_0x13232e,'skillMdPath':_0x20b193,'metadataPath':_0x5d5ef6,'contentHash':_0x19683b,'changed':_0x13749d!==_0x27aa33};}export function reuseMaterializedRuntimeSkill(_0x26e7ab,_0x289097,_0x3b8479){const _0x442b58=a157_0x55d5,_0xb30fb1=_0x26e7ab['version']?.[_0x442b58(0x207)]();if(!_0xb30fb1)return undefined;const _0x3784cb=requireSkillCode(_0x26e7ab),_0x2a4c70=getRuntimeSkillDir(_0x3b8479[_0x442b58(0x1df)],_0x3b8479[_0x442b58(0x211)],_0x3b8479[_0x442b58(0x212)],_0x289097,_0x3784cb,_0x3b8479[_0x442b58(0x1db)]),_0x2cd646=resolve(_0x2a4c70,SKILL_FILE),_0x438c9b=resolve(_0x2a4c70,METADATA_FILE),_0x3eed39=readMetadataIfPresent(_0x438c9b);if(!_0x3eed39||_0x3eed39[_0x442b58(0x1fa)]!==0x2||_0x3eed39[_0x442b58(0x212)]!==_0x3b8479['appCode']||_0x3eed39[_0x442b58(0x1d7)]!==_0x289097||_0x3eed39[_0x442b58(0x201)]!==_0x3784cb||_0x3eed39[_0x442b58(0x1f6)]!==_0xb30fb1||_0x3eed39['id']!==_0x26e7ab['id']||_0x3eed39['skillName']!==_0x26e7ab['skillName']||_0x3eed39[_0x442b58(0x1e8)]!==_0x26e7ab[_0x442b58(0x1e8)]||_0x3eed39['example']!==_0x26e7ab[_0x442b58(0x1e4)]||_0x3eed39[_0x442b58(0x200)]!==_0x26e7ab[_0x442b58(0x200)]||!_0x3eed39['contentHash']||!_0x3eed39[_0x442b58(0x206)]||!Object['hasOwn'](_0x3eed39[_0x442b58(0x206)],SKILL_FILE))return undefined;for(const [_0x3c6bf5,_0x228a16]of Object['entries'](_0x3eed39['fileHashes'])){if(!/^[a-f0-9]{64}$/['test'](_0x228a16))return undefined;const _0x5b85b5=resolveManagedFilePath(_0x2a4c70,_0x3c6bf5);if(!existsSync(_0x5b85b5)||!lstatSync(_0x5b85b5)[_0x442b58(0x1dc)]())return undefined;if(bufferSha256(readFileSync(_0x5b85b5))!==_0x228a16)return undefined;}return{'skill':_0x26e7ab,'scope':_0x289097,'dir':_0x2a4c70,'skillMdPath':_0x2cd646,'metadataPath':_0x438c9b,'contentHash':_0x3eed39[_0x442b58(0x1e0)],'changed':![]};}function withMaterializedSkillFrontmatter(_0x3d483e,_0x85a306,_0x323c44){const _0x160a93=a157_0x55d5,_0x1ee79f=skillDisplayName(_0x85a306,_0x323c44),_0x130535=_0x85a306['description']?.[_0x160a93(0x207)]()||_0x1ee79f||_0x323c44;return normalizeLocalFiles(_0x3d483e)[_0x160a93(0x1e3)](_0x2169f9=>{const _0x31ecf5=_0x160a93,_0x5b925d=fileText(_0x2169f9);if(_0x2169f9['path']!==SKILL_FILE)return _0x2169f9;if(hasYamlFrontmatter(_0x5b925d))return{'path':_0x2169f9[_0x31ecf5(0x1f4)],'content':withSyncedDisplayName(_0x5b925d,_0x1ee79f)};return{'path':_0x2169f9[_0x31ecf5(0x1f4)],'content':prependSkillFrontmatter(_0x5b925d,{'name':_0x323c44,'displayName':_0x1ee79f,'description':_0x130535})};});}function hasYamlFrontmatter(_0x543674){const _0x438bdf=a157_0x55d5;return/^\uFEFF?---\s*\r?\n/[_0x438bdf(0x1f7)](_0x543674);}function prependSkillFrontmatter(_0x4def24,_0x3acf44){const _0x382fd7=a157_0x55d5,_0x1d4dc7=_0x4def24[_0x382fd7(0x213)](/^\uFEFF/,'');return[_0x382fd7(0x1fc),_0x382fd7(0x1f3)+yamlString(_0x3acf44['name']),_0x3acf44[_0x382fd7(0x1fb)]?'displayName:\x20'+yamlString(_0x3acf44[_0x382fd7(0x1fb)]):undefined,_0x382fd7(0x1dd)+yamlString(_0x3acf44[_0x382fd7(0x1e8)]),'---','',_0x1d4dc7][_0x382fd7(0x1e2)](_0x36cf35=>_0x36cf35!==undefined)[_0x382fd7(0x1f0)]('\x0a');}function yamlString(_0x219da1){const _0x33af1d=a157_0x55d5;return JSON[_0x33af1d(0x202)](_0x219da1[_0x33af1d(0x213)](/\r/g,'')[_0x33af1d(0x207)]());}function skillDisplayName(_0x23d641,_0x3074c1){const _0x4c9f5b=a157_0x55d5,_0x40c37e=_0x23d641['skillName']?.[_0x4c9f5b(0x207)]();return _0x40c37e||_0x3074c1;}function withSyncedDisplayName(_0x308a84,_0x43574f){const _0x4dd9ec=a157_0x55d5,_0x138532=_0x308a84[_0x4dd9ec(0x20e)](/^(\uFEFF?)---\s*\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/);if(!_0x138532)return _0x308a84;const _0x31b4a5=_0x138532[0x1]??'',_0x532d3f=_0x138532[0x2]??'',_0x3a4a25=parseDocument(_0x532d3f);if(_0x3a4a25['errors'][_0x4dd9ec(0x1e9)]>0x0||!isMap(_0x3a4a25['contents']))return _0x308a84;if(_0x43574f)_0x3a4a25[_0x4dd9ec(0x204)](_0x4dd9ec(0x1fb),_0x43574f);else{if(_0x3a4a25[_0x4dd9ec(0x1f9)](_0x4dd9ec(0x1fb)))_0x3a4a25['delete']('displayName');else return _0x308a84;}forceBlockCollections(_0x3a4a25[_0x4dd9ec(0x1f2)]);const _0x1567c5=_0x3a4a25[_0x4dd9ec(0x1f5)]({'lineWidth':0x0})[_0x4dd9ec(0x1f8)](),_0x2e04f5=_0x308a84['slice'](_0x138532[0x0]['length'])['replace'](/^\r?\n/,'');return _0x31b4a5+_0x4dd9ec(0x1ea)+_0x1567c5+_0x4dd9ec(0x1ef)+_0x2e04f5;}function forceBlockCollections(_0x5161f1){if(!isNode(_0x5161f1))return;visit(_0x5161f1,(_0x32295a,_0x1c6ef6)=>{isCollection(_0x1c6ef6)&&(_0x1c6ef6['flow']=![]);});}function ensurePulledFilesCanBeOverwritten(_0x27d4ef,_0xff8cdb,_0x9d53c9,_0x1d7c03){const _0x72b663=a157_0x55d5;if(_0x1d7c03||!existsSync(_0xff8cdb))return;const _0x4b241d=readMetadataIfPresent(_0xff8cdb);if(!_0x4b241d)return;const _0x26ebfe=_0x4b241d[_0x72b663(0x206)]&&Object[_0x72b663(0x1fd)](_0x4b241d[_0x72b663(0x206)])['length']>0x0?_0x4b241d['fileHashes']:undefined;if(_0x26ebfe)for(const [_0x4e78ce,_0x2e2bc3]of Object[_0x72b663(0x20d)](_0x26ebfe)){const _0x4a5c7c=resolveManagedFilePath(_0x27d4ef,_0x4e78ce);if(!existsSync(_0x4a5c7c))throw CliErrors['validation'](_0x72b663(0x1de)+_0x27d4ef,_0x72b663(0x210)+_0x4e78ce);const _0x5cf45f=lstatSync(_0x4a5c7c);if(!_0x5cf45f[_0x72b663(0x1dc)]())throw CliErrors[_0x72b663(0x209)](_0x72b663(0x1de)+_0x27d4ef,_0x72b663(0x1ff)+_0x4e78ce);const _0x2d1646=bufferSha256(readFileSync(_0x4a5c7c));if(_0x2d1646!==_0x2e2bc3)throw CliErrors[_0x72b663(0x209)](_0x72b663(0x1de)+_0x27d4ef+_0x72b663(0x214)+_0x4e78ce,_0x72b663(0x1eb)+_0x4e78ce);}else{const _0x52a967=resolve(_0x27d4ef,SKILL_FILE);if(existsSync(_0x52a967)&&_0x4b241d[_0x72b663(0x1e0)]){const _0x1e89ce=contentHash(readFileSync(_0x52a967,_0x72b663(0x20c)));if(_0x1e89ce!==_0x4b241d[_0x72b663(0x1e0)])throw CliErrors[_0x72b663(0x209)](_0x72b663(0x1e1)+_0x52a967,_0x72b663(0x20a));}}for(const _0x5a98bd of normalizeLocalFiles(_0x9d53c9)){if(_0x26ebfe?.[_0x5a98bd[_0x72b663(0x1f4)]])continue;if(!_0x26ebfe&&_0x5a98bd['path']===SKILL_FILE)continue;const _0xa96e95=resolveManagedFilePath(_0x27d4ef,_0x5a98bd[_0x72b663(0x1f4)]);if(!existsSync(_0xa96e95))continue;const _0x11503d=lstatSync(_0xa96e95);if(!_0x11503d[_0x72b663(0x1dc)]())throw CliErrors[_0x72b663(0x209)]('Local\x20Skill\x20files\x20have\x20unpushed\x20edits:\x20'+_0x27d4ef,'Remote\x20Skill\x20would\x20overwrite\x20a\x20local\x20non-file\x20path:\x20'+_0x5a98bd[_0x72b663(0x1f4)]);const _0x5a5b6a=bufferSha256(readFileSync(_0xa96e95));if(_0x5a5b6a!==fileHash(_0x5a98bd))throw CliErrors['validation'](_0x72b663(0x1de)+_0x27d4ef,'Remote\x20Skill\x20would\x20overwrite\x20an\x20unmanaged\x20local\x20file:\x20'+_0x5a98bd['path']);}}function materializeFiles(_0x129df9,_0x53a9e1){const _0x4f71a7=a157_0x55d5;for(const _0x498c8e of normalizeLocalFiles(_0x53a9e1)){const _0x5e6aba=resolveManagedFilePath(_0x129df9,_0x498c8e[_0x4f71a7(0x1f4)]);mkdirSync(dirname(_0x5e6aba),{'recursive':!![],'mode':0x1c0}),writeBytesAtomic(_0x5e6aba,fileContent(_0x498c8e),0x180);}}function removeStaleManagedFiles(_0x2885da,_0x35e7bd,_0x1aac2f){const _0x4a2b1a=a157_0x55d5;if(!_0x35e7bd)return;const _0x871e4b=new Set(normalizeLocalFiles(_0x1aac2f)[_0x4a2b1a(0x1e3)](_0x299f36=>_0x299f36[_0x4a2b1a(0x1f4)]));for(const _0x1498c6 of Object[_0x4a2b1a(0x1fd)](_0x35e7bd)){if(_0x871e4b['has'](_0x1498c6))continue;const _0x168273=resolveManagedFilePath(_0x2885da,_0x1498c6);existsSync(_0x168273)&&lstatSync(_0x168273)[_0x4a2b1a(0x1dc)]()&&rmSync(_0x168273,{'force':!![]});}}