@lovrabet/lovrabet-cli 2.1.17 → 2.1.18-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cli.d.ts +21 -0
- package/lib/cli.js +1 -1
- package/lib/commands/api-doc/index.d.ts +38 -0
- package/lib/commands/api-doc/index.js +1 -1
- package/lib/commands/app/cache.d.ts +61 -0
- package/lib/commands/app/cache.js +1 -1
- package/lib/commands/app/definitions.d.ts +26 -0
- package/lib/commands/app/definitions.js +1 -1
- package/lib/commands/app/eligibility.d.ts +16 -0
- package/lib/commands/app/eligibility.js +1 -1
- package/lib/commands/app/mock-loader.d.ts +41 -0
- package/lib/commands/app/mock-loader.js +1 -1
- package/lib/commands/app/remote-source.d.ts +66 -0
- package/lib/commands/app/remote-source.js +1 -1
- package/lib/commands/app/shared.d.ts +38 -0
- package/lib/commands/app/shared.js +1 -1
- package/lib/commands/app-config/get.d.ts +2 -0
- package/lib/commands/app-config/get.js +1 -1
- package/lib/commands/app-config/index.d.ts +2 -0
- package/lib/commands/app-config/index.js +1 -1
- package/lib/commands/artifact/index.d.ts +9 -0
- package/lib/commands/artifact/index.js +1 -1
- package/lib/commands/auth/device.d.ts +31 -0
- package/lib/commands/auth/device.js +1 -1
- package/lib/commands/auth/index.d.ts +23 -0
- package/lib/commands/auth/index.js +1 -1
- package/lib/commands/auth/prompt.d.ts +33 -0
- package/lib/commands/auth/prompt.js +1 -1
- package/lib/commands/bff/detail.d.ts +8 -0
- package/lib/commands/bff/detail.js +1 -1
- package/lib/commands/bff/exec.d.ts +19 -0
- package/lib/commands/bff/exec.js +1 -1
- package/lib/commands/bff/index.d.ts +15 -0
- package/lib/commands/bff/index.js +1 -1
- package/lib/commands/cli-skill/index.d.ts +9 -0
- package/lib/commands/cli-skill/index.js +1 -1
- package/lib/commands/common/config-policy.d.ts +80 -0
- package/lib/commands/common/config-policy.js +1 -1
- package/lib/commands/common/constraints.d.ts +67 -0
- package/lib/commands/common/constraints.js +1 -1
- package/lib/commands/common/flags.d.ts +41 -0
- package/lib/commands/common/flags.js +1 -1
- package/lib/commands/common/local-file.d.ts +6 -0
- package/lib/commands/common/local-file.js +1 -1
- package/lib/commands/config/definitions.d.ts +21 -0
- package/lib/commands/config/definitions.js +1 -1
- package/lib/commands/config/shared.d.ts +17 -0
- package/lib/commands/config/shared.js +1 -1
- package/lib/commands/data/index.d.ts +27 -0
- package/lib/commands/data/index.js +1 -1
- package/lib/commands/dataset/detail.d.ts +26 -0
- package/lib/commands/dataset/detail.js +1 -1
- package/lib/commands/dataset/index.d.ts +10 -0
- package/lib/commands/dataset/index.js +1 -1
- package/lib/commands/dataset/list.d.ts +18 -0
- package/lib/commands/dataset/list.js +1 -1
- package/lib/commands/dataset/sdk-doc.d.ts +6 -0
- package/lib/commands/dataset/sdk-doc.js +1 -1
- package/lib/commands/doctor.d.ts +23 -0
- package/lib/commands/doctor.js +1 -1
- package/lib/commands/file/index.d.ts +2 -0
- package/lib/commands/file/index.js +1 -1
- package/lib/commands/init.d.ts +32 -0
- package/lib/commands/init.js +1 -1
- package/lib/commands/kb/index.d.ts +8 -0
- package/lib/commands/kb/index.js +1 -1
- package/lib/commands/logs/index.d.ts +20 -0
- package/lib/commands/logs/index.js +1 -1
- package/lib/commands/ocr/index.d.ts +2 -0
- package/lib/commands/ocr/index.js +1 -1
- package/lib/commands/personal-bff/index.d.ts +5 -0
- package/lib/commands/personal-bff/index.js +1 -1
- package/lib/commands/registry.d.ts +56 -0
- package/lib/commands/registry.js +1 -1
- package/lib/commands/schedule/index.d.ts +2 -0
- package/lib/commands/schedule/index.js +1 -0
- package/lib/commands/schema.d.ts +18 -0
- package/lib/commands/schema.js +1 -1
- package/lib/commands/service/dynamic.d.ts +18 -0
- package/lib/commands/service/dynamic.js +1 -1
- package/lib/commands/service/function-name-adapter.d.ts +13 -0
- package/lib/commands/service/function-name-adapter.js +1 -1
- package/lib/commands/service/index.d.ts +2 -0
- package/lib/commands/service/index.js +1 -1
- package/lib/commands/service/registry.d.ts +102 -0
- package/lib/commands/service/registry.js +1 -1
- package/lib/commands/skill/commands/create.d.ts +2 -0
- package/lib/commands/skill/commands/create.js +1 -1
- package/lib/commands/skill/commands/install.d.ts +2 -0
- package/lib/commands/skill/commands/install.js +1 -1
- package/lib/commands/skill/commands/list.d.ts +2 -0
- package/lib/commands/skill/commands/list.js +1 -1
- package/lib/commands/skill/commands/push.d.ts +2 -0
- package/lib/commands/skill/commands/push.js +1 -1
- package/lib/commands/skill/commands/validate.d.ts +2 -0
- package/lib/commands/skill/commands/validate.js +1 -1
- package/lib/commands/skill/flags.d.ts +13 -0
- package/lib/commands/skill/flags.js +1 -1
- package/lib/commands/skill/index.d.ts +9 -0
- package/lib/commands/skill/index.js +1 -1
- package/lib/commands/skill/manifest-helpers.d.ts +5 -0
- package/lib/commands/skill/manifest-helpers.js +1 -1
- package/lib/commands/skill/push-execute.d.ts +49 -0
- package/lib/commands/skill/push-execute.js +1 -1
- package/lib/commands/skill/push-flow-helpers.d.ts +80 -0
- package/lib/commands/skill/push-flow-helpers.js +1 -1
- package/lib/commands/skill/push-retarget.d.ts +9 -0
- package/lib/commands/skill/push-retarget.js +1 -1
- package/lib/commands/skill/scopes.d.ts +13 -0
- package/lib/commands/skill/scopes.js +1 -1
- package/lib/commands/skill/summary.d.ts +6 -0
- package/lib/commands/skill/summary.js +1 -1
- package/lib/commands/skill/templates.d.ts +23 -0
- package/lib/commands/skill/templates.js +1 -1
- package/lib/commands/skill/validate.d.ts +20 -0
- package/lib/commands/skill/validate.js +1 -1
- package/lib/commands/sql/detail.d.ts +13 -0
- package/lib/commands/sql/detail.js +1 -1
- package/lib/commands/sql/exec.d.ts +21 -0
- package/lib/commands/sql/exec.js +1 -1
- package/lib/commands/sql/index.d.ts +9 -0
- package/lib/commands/sql/index.js +1 -1
- package/lib/commands/update.d.ts +10 -0
- package/lib/commands/update.js +1 -1
- package/lib/commands/workspace/index.d.ts +10 -0
- package/lib/commands/workspace/index.js +1 -1
- package/lib/config/schema.d.ts +108 -0
- package/lib/config/schema.js +1 -1
- package/lib/constant/app.d.ts +13 -0
- package/lib/constant/app.js +1 -1
- package/lib/constant/auth-mode.d.ts +28 -0
- package/lib/constant/auth-mode.js +1 -1
- package/lib/constant/cli.d.ts +86 -0
- package/lib/constant/cli.js +1 -1
- package/lib/constant/defaults.d.ts +45 -0
- package/lib/constant/defaults.js +1 -1
- package/lib/constant/distribution.d.ts +12 -0
- package/lib/constant/distribution.js +1 -1
- package/lib/constant/domain.d.ts +57 -0
- package/lib/constant/domain.js +1 -1
- package/lib/constant/env.d.ts +56 -0
- package/lib/constant/env.js +1 -1
- package/lib/constant/output.d.ts +13 -0
- package/lib/constant/output.js +1 -1
- package/lib/constant/product.d.ts +79 -0
- package/lib/constant/product.js +1 -1
- package/lib/constant/risk.d.ts +14 -0
- package/lib/constant/risk.js +1 -1
- package/lib/constant/url.d.ts +14 -0
- package/lib/constant/url.js +1 -1
- package/lib/context.d.ts +287 -0
- package/lib/context.js +1 -1
- package/lib/core/api-client.d.ts +451 -0
- package/lib/core/api-client.js +1 -1
- package/lib/core/db-resolver.d.ts +39 -0
- package/lib/core/db-resolver.js +1 -1
- package/lib/core/sdk-client.d.ts +62 -0
- package/lib/core/sdk-client.js +1 -1
- package/lib/errors.d.ts +25 -0
- package/lib/errors.js +1 -1
- package/lib/framework/build-all-flags.d.ts +24 -0
- package/lib/framework/build-all-flags.js +1 -1
- package/lib/framework/dryrun.d.ts +64 -0
- package/lib/framework/dryrun.js +1 -1
- package/lib/framework/flags.d.ts +19 -0
- package/lib/framework/flags.js +1 -1
- package/lib/framework/help.d.ts +21 -0
- package/lib/framework/help.js +1 -1
- package/lib/framework/index.d.ts +10 -0
- package/lib/framework/index.js +1 -1
- package/lib/framework/output.d.ts +10 -0
- package/lib/framework/output.js +1 -1
- package/lib/framework/preparse.d.ts +64 -0
- package/lib/framework/preparse.js +1 -1
- package/lib/framework/rate-limit.d.ts +10 -0
- package/lib/framework/rate-limit.js +1 -1
- package/lib/framework/response.d.ts +10 -0
- package/lib/framework/response.js +1 -1
- package/lib/framework/runner-confirmation.d.ts +46 -0
- package/lib/framework/runner-confirmation.js +1 -1
- package/lib/framework/runner-error.d.ts +28 -0
- package/lib/framework/runner-error.js +1 -1
- package/lib/framework/runner.d.ts +102 -0
- package/lib/framework/runner.js +1 -1
- package/lib/framework/schema-export.d.ts +29 -0
- package/lib/framework/schema-export.js +1 -1
- package/lib/framework/service-order.d.ts +4 -0
- package/lib/framework/service-order.js +1 -1
- package/lib/framework/types.d.ts +108 -0
- package/lib/framework/types.js +1 -1
- package/lib/generated/build-info.d.ts +4 -0
- package/lib/generated/build-info.js +1 -1
- package/lib/help.d.ts +25 -0
- package/lib/help.js +1 -1
- package/lib/runtime/event.d.ts +16 -0
- package/lib/runtime/event.js +1 -0
- package/lib/runtime/index.d.ts +13 -0
- package/lib/runtime/index.js +1 -0
- package/lib/runtime/queue.d.ts +6 -0
- package/lib/runtime/queue.js +1 -0
- package/lib/runtime/resolve.d.ts +14 -0
- package/lib/runtime/resolve.js +1 -0
- package/lib/runtime/types.d.ts +59 -0
- package/lib/runtime/types.js +1 -0
- package/lib/skills/npx-skills-add.d.ts +42 -0
- package/lib/skills/npx-skills-add.js +1 -1
- package/lib/skills/runtime-skill-sync/constants.d.ts +4 -0
- package/lib/skills/runtime-skill-sync/constants.js +1 -1
- package/lib/skills/runtime-skill-sync/fs-utils.d.ts +21 -0
- package/lib/skills/runtime-skill-sync/fs-utils.js +1 -1
- package/lib/skills/runtime-skill-sync/hashing.d.ts +9 -0
- package/lib/skills/runtime-skill-sync/hashing.js +1 -1
- package/lib/skills/runtime-skill-sync/links.d.ts +18 -0
- package/lib/skills/runtime-skill-sync/links.js +1 -1
- package/lib/skills/runtime-skill-sync/list-local.d.ts +3 -0
- package/lib/skills/runtime-skill-sync/list-local.js +1 -1
- package/lib/skills/runtime-skill-sync/local-files.d.ts +25 -0
- package/lib/skills/runtime-skill-sync/local-files.js +1 -1
- package/lib/skills/runtime-skill-sync/materialize.d.ts +11 -0
- package/lib/skills/runtime-skill-sync/materialize.js +1 -1
- package/lib/skills/runtime-skill-sync/metadata.d.ts +7 -0
- package/lib/skills/runtime-skill-sync/metadata.js +1 -1
- package/lib/skills/runtime-skill-sync/paths.d.ts +11 -0
- package/lib/skills/runtime-skill-sync/paths.js +1 -1
- package/lib/skills/runtime-skill-sync/push.d.ts +33 -0
- package/lib/skills/runtime-skill-sync/push.js +1 -1
- package/lib/skills/runtime-skill-sync/scopes.d.ts +5 -0
- package/lib/skills/runtime-skill-sync/scopes.js +1 -1
- package/lib/skills/runtime-skill-sync/types.d.ts +105 -0
- package/lib/skills/runtime-skill-sync/zip-codec.d.ts +9 -0
- package/lib/skills/runtime-skill-sync/zip-codec.js +1 -1
- package/lib/skills/runtime-skill-sync/zip-package.d.ts +15 -0
- package/lib/skills/runtime-skill-sync/zip-package.js +1 -1
- package/lib/skills/runtime-skill-sync.d.ts +15 -0
- package/lib/skills/runtime-skill-sync.js +1 -1
- package/lib/utils/apply-jq-filter.d.ts +25 -0
- package/lib/utils/apply-jq-filter.js +1 -1
- package/lib/utils/logger.d.ts +73 -0
- package/lib/utils/logger.js +1 -1
- package/lib/utils/lossless-json.d.ts +21 -0
- package/lib/utils/lossless-json.js +1 -1
- package/lib/utils/params.d.ts +65 -0
- package/lib/utils/params.js +1 -1
- package/lib/utils/platform.d.ts +17 -0
- package/lib/utils/platform.js +1 -1
- package/lib/utils/update-notice.d.ts +10 -0
- package/lib/utils/update-notice.js +1 -1
- package/lib/utils/version.d.ts +18 -0
- package/lib/utils/version.js +1 -1
- package/lib/utils/write-cli-side-channel.d.ts +6 -0
- package/lib/utils/write-cli-side-channel.js +1 -1
- package/package.json +9 -1
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 本文件负责把 CLI 命令定义和执行结果转换为稳定的 Lovrabet 写入成功事件。
|
|
3
|
+
* 事件只保留前端展示所需的最小字段,避免把命令参数或敏感业务数据写入 metadata。
|
|
4
|
+
*/
|
|
5
|
+
import type { CommandDefinition, CommandResult } from "../framework/types.js";
|
|
6
|
+
import type { LovrabetStructuredMetadata } from "../runtime/types.js";
|
|
7
|
+
/**
|
|
8
|
+
* 将命令的 service 与多段 command 规范化为稳定的点分 operation。
|
|
9
|
+
*/
|
|
10
|
+
export declare function canonicalLovrabetOperation(definition: Pick<CommandDefinition, "service" | "command">): string;
|
|
11
|
+
/**
|
|
12
|
+
* 仅为成功执行的 write 或 high-risk-write 命令生成 v1 结构化事件。
|
|
13
|
+
*
|
|
14
|
+
* read、dry-run 和失败结果均不产生完成事件;专属 subject 由命令定义按白名单提取。
|
|
15
|
+
*/
|
|
16
|
+
export declare function createLovrabetWriteMetadata(definition: CommandDefinition, operation: string, result: CommandResult, dryRun: boolean): LovrabetStructuredMetadata | undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(_0x52e099,_0xbc8c4a){const _0x2a7fbd=a97_0x5e74,_0x4bf26e=_0x52e099();while(!![]){try{const _0x4645e9=-parseInt(_0x2a7fbd(0x1ae))/0x1+parseInt(_0x2a7fbd(0x1b2))/0x2*(parseInt(_0x2a7fbd(0x1aa))/0x3)+-parseInt(_0x2a7fbd(0x1b1))/0x4+parseInt(_0x2a7fbd(0x1b4))/0x5+parseInt(_0x2a7fbd(0x1b5))/0x6*(parseInt(_0x2a7fbd(0x1b0))/0x7)+-parseInt(_0x2a7fbd(0x1ac))/0x8*(parseInt(_0x2a7fbd(0x1ad))/0x9)+parseInt(_0x2a7fbd(0x1b3))/0xa;if(_0x4645e9===_0xbc8c4a)break;else _0x4bf26e['push'](_0x4bf26e['shift']());}catch(_0x5e0f86){_0x4bf26e['push'](_0x4bf26e['shift']());}}}(a97_0x3067,0x582bb));export function canonicalLovrabetOperation(_0x560641){const _0x4fa7f3=a97_0x5e74;return[_0x560641['service'],..._0x560641[_0x4fa7f3(0x1b6)][_0x4fa7f3(0x1ab)]()[_0x4fa7f3(0x1af)](/\s+/)]['filter'](Boolean)[_0x4fa7f3(0x1b7)]('.');}function a97_0x5e74(_0x537324,_0x47e6fe){_0x537324=_0x537324-0x1a8;const _0x306763=a97_0x3067();let _0x5e74ef=_0x306763[_0x537324];return _0x5e74ef;}export function createLovrabetWriteMetadata(_0x466ebe,_0x345840,_0x545f8d,_0x4088db){const _0x2abe1b=a97_0x5e74;if(_0x4088db||_0x545f8d['ok']!==!![]||_0x466ebe[_0x2abe1b(0x1a9)]!==_0x2abe1b(0x1b9)&&_0x466ebe[_0x2abe1b(0x1a9)]!==_0x2abe1b(0x1a8))return undefined;const _0x51d5a1=_0x466ebe['writeEventSubject']?.(_0x545f8d),_0x571f46={'type':_0x2abe1b(0x1b8),'operation':_0x345840,'risk':_0x466ebe[_0x2abe1b(0x1a9)],..._0x51d5a1?{'subject':_0x51d5a1}:{}};return{'lovrabet':{'schemaVersion':0x1,'event':_0x571f46}};}function a97_0x3067(){const _0x32e2d8=['command','join','lovrabet.write.completed','write','high-risk-write','risk','369579OJyXLj','trim','3776NpTHYg','12474vQxzYc','480618dumIZy','split','17311nwvJOa','2843680aCooaD','2pRTrBV','12080440zqIPPo','2461625mInoGc','930AXbArA'];a97_0x3067=function(){return _0x32e2d8;};return a97_0x3067();}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 本文件是 Lovrabet CLI 的嵌入式运行时入口。
|
|
3
|
+
* 它串联 argv 解析、原生确认、命令执行、结果展示、成功事件生成和全局状态清理。
|
|
4
|
+
*/
|
|
5
|
+
import type { InvokeLovrabetOptions, InvokeLovrabetResult } from "../runtime/types.js";
|
|
6
|
+
export type { InvokeLovrabetOptions, InvokeLovrabetResult, LovrabetConfirmationAdapter, LovrabetConfirmationRequest, LovrabetPresentationAdapter, LovrabetPresentationRequest, LovrabetStructuredMetadata, LovrabetWriteCompletedEvent, } from "../runtime/types.js";
|
|
7
|
+
/**
|
|
8
|
+
* 通过与终端 CLI 相同的 registry 和 runner 执行一组 Lovrabet argv。
|
|
9
|
+
*
|
|
10
|
+
* write 命令在副作用发生前调用确认适配器;成功后返回可供 OpenCode 持久化的 metadata。
|
|
11
|
+
* 整个调用生命周期会串行执行,以隔离进程级认证和 SDK 状态。
|
|
12
|
+
*/
|
|
13
|
+
export declare function invokeLovrabet(argv: readonly string[], options: InvokeLovrabetOptions): Promise<InvokeLovrabetResult>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(_0x19e43d,_0x3426f4){const _0x14dc0d=a98_0x407b,_0x2be634=_0x19e43d();while(!![]){try{const _0x2c6c29=-parseInt(_0x14dc0d(0x145))/0x1+-parseInt(_0x14dc0d(0x143))/0x2+-parseInt(_0x14dc0d(0x146))/0x3+-parseInt(_0x14dc0d(0x141))/0x4+-parseInt(_0x14dc0d(0x148))/0x5*(parseInt(_0x14dc0d(0x15b))/0x6)+-parseInt(_0x14dc0d(0x161))/0x7+parseInt(_0x14dc0d(0x140))/0x8;if(_0x2c6c29===_0x3426f4)break;else _0x2be634['push'](_0x2be634['shift']());}catch(_0x511b03){_0x2be634['push'](_0x2be634['shift']());}}}(a98_0x46d9,0x518a2));function a98_0x407b(_0x21ee47,_0xc2608){_0x21ee47=_0x21ee47-0x13f;const _0x46d97b=a98_0x46d9();let _0x407bca=_0x46d97b[_0x21ee47];return _0x407bca;}import{buildConfigFromFlags,initGlobalEnvironment}from'../context.js';import{createLovrabetRunnerAdapter,createPipelineEnv,finalizeLovrabetRuntimeState,runCommand}from'../framework/runner.js';import{canonicalLovrabetOperation,createLovrabetWriteMetadata}from'../runtime/event.js';import{resolveLovrabetInvocation}from'../runtime/resolve.js';import{runSerialized}from'../runtime/queue.js';function a98_0x46d9(){const _0x16f5e2=['reason','Lovrabet\x20invocation\x20aborted.','16145312QqaIGT','2530368MkyObj','command','418048cviSsP','riskLevel','332685DyvRMk','387756wHVVmu','AbortError','977395zzavsu','message','high-risk-write','rawFlags','aborted','args','stringify','confirm','presentation','isNonInteractive','definition','yes','data','signal','present','description','dryRun','format','Lovrabet\x20invocation\x20completed\x20without\x20a\x20captured\x20command\x20result.','6zVuJCW','write','Embedded\x20Lovrabet\x20confirmation\x20must\x20run\x20inside\x20execute.','execute','result','risk','1296022ADECqg'];a98_0x46d9=function(){return _0x16f5e2;};return a98_0x46d9();}const defaultPresentation={'present'({result:_0x5c46ed,command:_0x3e84cb,risk:_0x130952,dryRun:_0x3f84f5}){const _0x10dd07=a98_0x407b;return JSON[_0x10dd07(0x14e)]({'ok':_0x5c46ed['ok'],'command':_0x3e84cb,'risk':_0x130952,..._0x3f84f5?{'dryRun':!![]}:{},..._0x5c46ed[_0x10dd07(0x154)]!==undefined?{'data':_0x5c46ed['data']}:{},..._0x5c46ed[_0x10dd07(0x149)]?{'message':_0x5c46ed[_0x10dd07(0x149)]}:{}});}};export async function invokeLovrabet(_0x2cb1d8,_0x964791){return runSerialized(async()=>{const _0x133261=a98_0x407b;throwIfAborted(_0x964791['signal']);const _0x3ecc9f=await resolveLovrabetInvocation(_0x2cb1d8),_0x1fdba9=canonicalLovrabetOperation(_0x3ecc9f['definition']),_0x481518={},_0x33e8a7=buildConfigFromFlags(_0x3ecc9f['rawFlags']);await initGlobalEnvironment(_0x33e8a7);const _0x19e4de=createPipelineEnv(_0x33e8a7,{..._0x3ecc9f[_0x133261(0x14b)],'yes':_0x3ecc9f['definition'][_0x133261(0x160)]===_0x133261(0x14a)?!![]:_0x3ecc9f[_0x133261(0x14b)][_0x133261(0x153)],'nonInteractive':!![]});_0x19e4de[_0x133261(0x14d)]=_0x3ecc9f[_0x133261(0x14d)],_0x19e4de[_0x133261(0x151)]=!![],_0x19e4de[_0x133261(0x144)]=_0x133261(0x14a);const _0x463f23=withEmbeddedLifecycle(_0x3ecc9f[_0x133261(0x152)],_0x1fdba9,_0x964791),_0x12e0f1=createLovrabetRunnerAdapter({'formatOutput'(_0x119dab,_0xbbaf3f){const _0x1873df=_0x133261;_0x481518[_0x1873df(0x15f)]=_0x119dab,_0x481518['command']=_0xbbaf3f[_0x1873df(0x142)],_0x481518[_0x1873df(0x160)]=_0xbbaf3f[_0x1873df(0x160)],_0x481518['format']=_0xbbaf3f['format'],_0x481518[_0x1873df(0x158)]=_0xbbaf3f[_0x1873df(0x158)]===!![];},async 'confirmHighRisk'(){const _0x162e40=_0x133261;throw new Error(_0x162e40(0x15d));}});try{await runCommand(_0x463f23,_0x19e4de,_0x12e0f1);if(!_0x481518[_0x133261(0x15f)]||!_0x481518[_0x133261(0x142)]||!_0x481518[_0x133261(0x160)]||!_0x481518[_0x133261(0x159)])throw new Error(_0x133261(0x15a));const _0x368c22=_0x964791[_0x133261(0x150)]??defaultPresentation,_0x48ccdb=_0x481518[_0x133261(0x158)]===!![],_0x115d8f={'result':_0x481518[_0x133261(0x15f)],'command':_0x481518['command'],'operation':_0x1fdba9,'risk':_0x481518['risk'],'format':_0x481518[_0x133261(0x159)],'dryRun':_0x48ccdb},_0x1a480c=createLovrabetWriteMetadata(_0x3ecc9f['definition'],_0x1fdba9,_0x481518[_0x133261(0x15f)],_0x48ccdb);let _0x422e86;try{_0x422e86=await _0x368c22['present'](_0x115d8f);}catch(_0x3427e8){if(!_0x1a480c||_0x368c22===defaultPresentation)throw _0x3427e8;_0x422e86=await defaultPresentation[_0x133261(0x156)](_0x115d8f);}return{'operation':_0x1fdba9,'risk':_0x481518[_0x133261(0x160)],'mode':_0x48ccdb?'dry-run':'execute','result':_0x481518[_0x133261(0x15f)],'output':_0x422e86,..._0x1a480c?{'metadata':_0x1a480c}:{}};}finally{await finalizeLovrabetRuntimeState();}});}function withEmbeddedLifecycle(_0x31093d,_0x2b6903,_0x5de98f){return{..._0x31093d,async 'execute'(_0x101509){const _0x45e848=a98_0x407b;return throwIfAborted(_0x5de98f[_0x45e848(0x155)]),(_0x31093d[_0x45e848(0x160)]===_0x45e848(0x15c)||_0x31093d[_0x45e848(0x160)]===_0x45e848(0x14a))&&await _0x5de98f['confirmation'][_0x45e848(0x14f)]({'operation':_0x2b6903,'risk':_0x31093d['risk'],'description':_0x31093d[_0x45e848(0x157)],..._0x5de98f[_0x45e848(0x155)]?{'signal':_0x5de98f[_0x45e848(0x155)]}:{}}),throwIfAborted(_0x5de98f[_0x45e848(0x155)]),_0x31093d[_0x45e848(0x15e)](_0x101509);}};}function throwIfAborted(_0x3009ba){const _0x36cb71=a98_0x407b;if(_0x3009ba?.[_0x36cb71(0x14c)])throw _0x3009ba[_0x36cb71(0x162)]instanceof Error?_0x3009ba['reason']:new DOMException(_0x36cb71(0x13f),_0x36cb71(0x147));}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const a99_0x54964c=a99_0x4e8d;(function(_0x2de021,_0x1e0fc9){const _0x33ea66=a99_0x4e8d,_0x30c677=_0x2de021();while(!![]){try{const _0x4e6d59=-parseInt(_0x33ea66(0x151))/0x1*(-parseInt(_0x33ea66(0x148))/0x2)+-parseInt(_0x33ea66(0x147))/0x3+-parseInt(_0x33ea66(0x14c))/0x4+-parseInt(_0x33ea66(0x14d))/0x5+-parseInt(_0x33ea66(0x150))/0x6+-parseInt(_0x33ea66(0x14b))/0x7*(parseInt(_0x33ea66(0x14f))/0x8)+parseInt(_0x33ea66(0x14e))/0x9;if(_0x4e6d59===_0x1e0fc9)break;else _0x30c677['push'](_0x30c677['shift']());}catch(_0x317eec){_0x30c677['push'](_0x30c677['shift']());}}}(a99_0x4b9e,0xabc93));let tail=Promise[a99_0x54964c(0x14a)]();function a99_0x4b9e(){const _0x32540f=['548IgegkD','3880524IvreNA','458jEucaW','catch','resolve','351932ZjFNdJ','4198004iisely','1732320OIjPIG','51791688DCTXCb','208kSHopW','7079040yGmbzY'];a99_0x4b9e=function(){return _0x32540f;};return a99_0x4b9e();}function a99_0x4e8d(_0x209837,_0x1efc8f){_0x209837=_0x209837-0x147;const _0x4b9ed1=a99_0x4b9e();let _0x4e8daa=_0x4b9ed1[_0x209837];return _0x4e8daa;}export async function runSerialized(_0x39a501){const _0x395093=a99_0x54964c,_0x2e9648=tail;let _0xe7ed0b;tail=new Promise(_0xd046f8=>{_0xe7ed0b=_0xd046f8;}),await _0x2e9648[_0x395093(0x149)](()=>undefined);try{return await _0x39a501();}finally{_0xe7ed0b();}}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 本文件负责将原生工具传入的 CLI argv 解析为真实命令定义、参数和规范化 flags。
|
|
3
|
+
* 静态命令与动态 Service Tree 命令都复用终端 CLI 的 registry 和 flag 修正规则。
|
|
4
|
+
*/
|
|
5
|
+
import type { CommandDefinition } from "../framework/types.js";
|
|
6
|
+
export interface ResolvedLovrabetInvocation {
|
|
7
|
+
definition: CommandDefinition;
|
|
8
|
+
rawFlags: Record<string, any>;
|
|
9
|
+
args: string[];
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* 解析一次嵌入式 Lovrabet 调用,并返回 runner 可直接消费的命令定义、flags 和位置参数。
|
|
13
|
+
*/
|
|
14
|
+
export declare function resolveLovrabetInvocation(argv: readonly string[]): Promise<ResolvedLovrabetInvocation>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(_0x390770,_0xb255c0){const _0x37d21a=a100_0x36c9,_0x3ce0fe=_0x390770();while(!![]){try{const _0x20090a=-parseInt(_0x37d21a(0xba))/0x1+parseInt(_0x37d21a(0xad))/0x2+-parseInt(_0x37d21a(0xac))/0x3+-parseInt(_0x37d21a(0xb7))/0x4+-parseInt(_0x37d21a(0xb6))/0x5*(parseInt(_0x37d21a(0xbc))/0x6)+parseInt(_0x37d21a(0xaf))/0x7*(parseInt(_0x37d21a(0xb3))/0x8)+parseInt(_0x37d21a(0xab))/0x9*(parseInt(_0x37d21a(0xb2))/0xa);if(_0x20090a===_0xb255c0)break;else _0x3ce0fe['push'](_0x3ce0fe['shift']());}catch(_0x2414ff){_0x3ce0fe['push'](_0x3ce0fe['shift']());}}}(a100_0x2484,0x3999c));function a100_0x2484(){const _0x7a94b5=['defaultCommand','validation','18185LnYSce','1156368UNixnh','input','unknownCommand','76644BLOdhm','assign','342noQgcM','join','definition','flags','2102913mGwKil','1263882oDkTgg','172746YVGLLg','Lovrabet\x20argv\x20must\x20include\x20a\x20service\x20and\x20command.','259TxnJiq','../framework/preparse.js','slice','30Ihljkv','95768CeisCF'];a100_0x2484=function(){return _0x7a94b5;};return a100_0x2484();}import a100_0x37df2f from'meow';import{findDefinition,getServiceEntry,isKnownService}from'../commands/registry.js';import{resolveDynamicServiceCommand}from'../commands/service/dynamic.js';import{buildMeowFlags}from'../constant/cli.js';import{CliErrors}from'../errors.js';function a100_0x36c9(_0x565558,_0x5746e1){_0x565558=_0x565558-0xa9;const _0x2484ad=a100_0x2484();let _0x36c9e2=_0x2484ad[_0x565558];return _0x36c9e2;}export async function resolveLovrabetInvocation(_0x23e38c){const _0x3fdb48=a100_0x36c9,_0x198f1e=a100_0x37df2f('',{'importMeta':import.meta,'argv':_0x23e38c,'flags':buildMeowFlags(),'autoHelp':![],'autoVersion':![]}),_0x542b8f=[..._0x198f1e[_0x3fdb48(0xb8)]],_0x5e4c88=_0x198f1e[_0x3fdb48(0xaa)];await correctFlags(_0x5e4c88);const _0x1804cd=_0x542b8f[0x0];if(!_0x1804cd)throw CliErrors[_0x3fdb48(0xb5)](_0x3fdb48(0xae));if(!isKnownService(_0x1804cd)){const _0x91f621=resolveDynamicServiceCommand(_0x542b8f,_0x5e4c88);if(!_0x91f621)throw CliErrors['unknownCommand'](_0x542b8f[_0x3fdb48(0xbd)]('\x20'));return Object[_0x3fdb48(0xbb)](_0x5e4c88,_0x91f621[_0x3fdb48(0xaa)]),{'definition':_0x91f621[_0x3fdb48(0xa9)],'rawFlags':_0x5e4c88,'args':_0x91f621['args']};}const _0x24e9cd=getServiceEntry(_0x1804cd),_0x1e0eaf=_0x542b8f[0x1]||_0x24e9cd[_0x3fdb48(0xb4)];if(!_0x1e0eaf)throw CliErrors['validation']('Lovrabet\x20argv\x20must\x20include\x20a\x20command\x20for\x20service\x20\x22'+_0x1804cd+'\x22.');const _0x588f6a=findDefinition(_0x1804cd,_0x1e0eaf);if(!_0x588f6a)throw CliErrors[_0x3fdb48(0xb9)](_0x1804cd+'\x20'+_0x1e0eaf);return{'definition':_0x588f6a,'rawFlags':_0x5e4c88,'args':_0x542b8f[_0x3fdb48(0xb1)](0x2)};}async function correctFlags(_0x22da12){const _0x3313b0=a100_0x36c9;try{const {correctFlags:_0x4df722}=await import(_0x3313b0(0xb0)),{getAllDefinitions:_0x2614d6}=await import('../commands/registry.js'),_0x338332=_0x2614d6()['flatMap'](_0x3fdb54=>_0x3fdb54[_0x3313b0(0xaa)]??[]),_0x9b4c28=_0x4df722(_0x22da12,_0x338332);Object[_0x3313b0(0xbb)](_0x22da12,_0x9b4c28['flags']);}catch{}}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 本文件定义 Lovrabet 嵌入式运行时的公共契约,包括确认、展示、执行结果和写入事件结构。
|
|
3
|
+
* 这些类型构成 CLI runtime subpath 与 Coworker OpenCode 适配层之间的稳定边界。
|
|
4
|
+
*/
|
|
5
|
+
import type { CommandResult, OutputFormat, Risk } from "../framework/types.js";
|
|
6
|
+
export interface LovrabetConfirmationRequest {
|
|
7
|
+
operation: string;
|
|
8
|
+
risk: Extract<Risk, "write" | "high-risk-write">;
|
|
9
|
+
description: string;
|
|
10
|
+
signal?: AbortSignal;
|
|
11
|
+
}
|
|
12
|
+
export interface LovrabetConfirmationAdapter {
|
|
13
|
+
/** 在写入副作用发生前请求调用方确认;拒绝时应通过抛错终止执行。 */
|
|
14
|
+
confirm(request: LovrabetConfirmationRequest): Promise<void>;
|
|
15
|
+
}
|
|
16
|
+
export interface LovrabetPresentationRequest {
|
|
17
|
+
result: CommandResult;
|
|
18
|
+
command: string;
|
|
19
|
+
operation: string;
|
|
20
|
+
risk: Risk;
|
|
21
|
+
format: OutputFormat;
|
|
22
|
+
dryRun: boolean;
|
|
23
|
+
}
|
|
24
|
+
export interface LovrabetPresentationAdapter {
|
|
25
|
+
/** 将结构化命令结果转换为原生工具需要展示的文本。 */
|
|
26
|
+
present(request: LovrabetPresentationRequest): string | Promise<string>;
|
|
27
|
+
}
|
|
28
|
+
export interface LovrabetWriteCompletedEvent {
|
|
29
|
+
type: "lovrabet.write.completed";
|
|
30
|
+
operation: string;
|
|
31
|
+
risk: Extract<Risk, "write" | "high-risk-write">;
|
|
32
|
+
subject?: {
|
|
33
|
+
kind: string;
|
|
34
|
+
id: string;
|
|
35
|
+
action: string;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
export interface LovrabetStructuredMetadata {
|
|
39
|
+
lovrabet: {
|
|
40
|
+
schemaVersion: 1;
|
|
41
|
+
event: LovrabetWriteCompletedEvent;
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
export interface InvokeLovrabetOptions {
|
|
45
|
+
confirmation: LovrabetConfirmationAdapter;
|
|
46
|
+
/**
|
|
47
|
+
* 自定义展示失败时,已成功的写入会降级为默认 JSON 输出,避免把已完成副作用误报为执行失败。
|
|
48
|
+
*/
|
|
49
|
+
presentation?: LovrabetPresentationAdapter;
|
|
50
|
+
signal?: AbortSignal;
|
|
51
|
+
}
|
|
52
|
+
export interface InvokeLovrabetResult {
|
|
53
|
+
operation: string;
|
|
54
|
+
risk: Risk;
|
|
55
|
+
mode: "execute" | "dry-run";
|
|
56
|
+
result: CommandResult;
|
|
57
|
+
output: string;
|
|
58
|
+
metadata?: LovrabetStructuredMetadata;
|
|
59
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Official `skills` CLI integration used by `lovrabet cli-skill install`.
|
|
3
|
+
*
|
|
4
|
+
* The runtime CLI currently only needs the `npx skills add <repo> -g -y`
|
|
5
|
+
* flow, so this module intentionally keeps the surface area narrow.
|
|
6
|
+
*/
|
|
7
|
+
/** Source repository consumed by the public `skills` ecosystem. */
|
|
8
|
+
export declare const LOVRABET_SKILL_SOURCE: "lovrabet/lovrabet-cli";
|
|
9
|
+
/** Skip flag used by tests or offline automation. */
|
|
10
|
+
export declare const LOVRABET_SKIP_NPX_SKILLS_ENV: string;
|
|
11
|
+
/**
|
|
12
|
+
* Result of invoking the external `skills` installer.
|
|
13
|
+
*/
|
|
14
|
+
export interface RunNpxSkillsAddResult {
|
|
15
|
+
ok: boolean;
|
|
16
|
+
status: number | null;
|
|
17
|
+
error?: string;
|
|
18
|
+
/** `true` when execution was intentionally skipped via env var. */
|
|
19
|
+
skipped?: boolean;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Runtime options for the external `skills` installer.
|
|
23
|
+
*/
|
|
24
|
+
export interface RunNpxSkillsAddOptions {
|
|
25
|
+
/** Child stdio mode. `inherit` for local use, `pipe` for tests/CI. */
|
|
26
|
+
stdio?: "inherit" | "pipe";
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Returns whether the external `skills` invocation should be skipped.
|
|
30
|
+
*
|
|
31
|
+
* @returns `true` when the product-scoped skip env var is set to `1`.
|
|
32
|
+
*/
|
|
33
|
+
export declare function shouldSkipNpxSkillsAdd(): boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Installs the published CLI Built-in Skill globally through the official `skills` CLI.
|
|
36
|
+
*
|
|
37
|
+
* @param projectRoot - Working directory for the spawned process.
|
|
38
|
+
* @param source - Published skill source.
|
|
39
|
+
* @param options - Execution options.
|
|
40
|
+
* @returns Spawn outcome and optional error summary.
|
|
41
|
+
*/
|
|
42
|
+
export declare function runNpxSkillsAddGlobal(projectRoot: string, source?: string, options?: RunNpxSkillsAddOptions): RunNpxSkillsAddResult;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a102_0x32fba3=a102_0x31ad;(function(_0x58e635,_0x3e75a3){const _0xb63595=a102_0x31ad,_0x27b2ba=_0x58e635();while(!![]){try{const _0x153a09=parseInt(_0xb63595(0x1e9))/0x1+parseInt(_0xb63595(0x1f7))/0x2+parseInt(_0xb63595(0x1fb))/0x3+-parseInt(_0xb63595(0x1e8))/0x4+parseInt(_0xb63595(0x1ea))/0x5+parseInt(_0xb63595(0x1f1))/0x6*(-parseInt(_0xb63595(0x1ec))/0x7)+-parseInt(_0xb63595(0x1ee))/0x8;if(_0x153a09===_0x3e75a3)break;else _0x27b2ba['push'](_0x27b2ba['shift']());}catch(_0x3b16e5){_0x27b2ba['push'](_0x27b2ba['shift']());}}}(a102_0x2515,0xbcb95));import{spawnSync}from'node:child_process';import{resolveNpmBin}from'../utils/platform.js';import{LOVRABET_SKILL_SOURCE as a102_0x27025c}from'../constant/distribution.js';import{PRODUCT_CONFIG,productEnvName}from'../constant/product.js';export const LOVRABET_SKILL_SOURCE=a102_0x27025c;function a102_0x31ad(_0x1d89e0,_0x2cb5c8){_0x1d89e0=_0x1d89e0-0x1e7;const _0x2515f4=a102_0x2515();let _0x31ad79=_0x2515f4[_0x1d89e0];return _0x31ad79;}function a102_0x2515(){const _0x4614a5=['exit\x20','inherit','62106tdOWkn','npx','log','trim','pipe','skipNpxSkillsEnvSuffix','2680926SMZzHo','toString','status','unknown','2872440gPQTQN','stdout','stderr','2330252UcQOZZ','1097723rJnvEF','248575WgsDZE','stdio','609vNEKIJ','add','9514144OTSREL'];a102_0x2515=function(){return _0x4614a5;};return a102_0x2515();}export const LOVRABET_SKIP_NPX_SKILLS_ENV=productEnvName(PRODUCT_CONFIG[a102_0x32fba3(0x1f6)]);export function shouldSkipNpxSkillsAdd(){return process.env[LOVRABET_SKIP_NPX_SKILLS_ENV]==='1';}export function runNpxSkillsAddGlobal(_0x4c2dfd,_0x29ee01=LOVRABET_SKILL_SOURCE,_0x263b8b){const _0x1d30b8=a102_0x32fba3;if(shouldSkipNpxSkillsAdd())return{'ok':!![],'status':0x0,'skipped':!![]};const _0x118ebb=_0x263b8b?.[_0x1d30b8(0x1eb)]??_0x1d30b8(0x1f0),_0x37c748=resolveNpmBin(_0x1d30b8(0x1f2)),_0x50ffc9=['skills',_0x1d30b8(0x1ed),_0x29ee01,'-g','-y'],_0x403f5d=[_0x37c748,..._0x50ffc9]['join']('\x20');console[_0x1d30b8(0x1f3)]('*\x20'+_0x403f5d);const _0x33ea61=spawnSync(_0x37c748,_0x50ffc9,{'cwd':_0x4c2dfd,'stdio':_0x118ebb,'env':process.env,'shell':![]});if(_0x33ea61['status']===0x0)return{'ok':!![],'status':0x0};let _0x26f9bb=_0x1d30b8(0x1ef)+(_0x33ea61[_0x1d30b8(0x1f9)]??_0x1d30b8(0x1fa));if(_0x118ebb===_0x1d30b8(0x1f5)){const _0x198bf6=_0x33ea61[_0x1d30b8(0x1e7)]?_0x33ea61['stderr'][_0x1d30b8(0x1f8)]()['trim']():'',_0x31a5da=_0x33ea61[_0x1d30b8(0x1fc)]?_0x33ea61['stdout'][_0x1d30b8(0x1f8)]()[_0x1d30b8(0x1f4)]():'';if(_0x198bf6)_0x26f9bb=_0x198bf6;else{if(_0x31a5da)_0x26f9bb=_0x31a5da;}}return{'ok':![],'status':_0x33ea61[_0x1d30b8(0x1f9)]??null,'error':_0x26f9bb};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a103_0x42b0(_0x49fc75,_0x2d33b4){_0x49fc75=_0x49fc75-0x19a;const _0x56ec34=a103_0x56ec();let _0x42b04e=_0x56ec34[_0x49fc75];return _0x42b04e;}const a103_0x35a7ef=a103_0x42b0;(function(_0x1fb65f,_0x5f981f){const _0x27ce0e=a103_0x42b0,_0x1ef667=_0x1fb65f();while(!![]){try{const _0x2d79a6=parseInt(_0x27ce0e(0x1a7))/0x1+-parseInt(_0x27ce0e(0x1a6))/0x2+-parseInt(_0x27ce0e(0x1a4))/0x3*(parseInt(_0x27ce0e(0x1a3))/0x4)+parseInt(_0x27ce0e(0x1a1))/0x5+parseInt(_0x27ce0e(0x1ac))/0x6*(parseInt(_0x27ce0e(0x1a9))/0x7)+-parseInt(_0x27ce0e(0x19c))/0x8*(-parseInt(_0x27ce0e(0x19b))/0x9)+parseInt(_0x27ce0e(0x19a))/0xa*(-parseInt(_0x27ce0e(0x19e))/0xb);if(_0x2d79a6===_0x5f981f)break;else _0x1ef667['push'](_0x1ef667['shift']());}catch(_0x387f0f){_0x1ef667['push'](_0x1ef667['shift']());}}}(a103_0x56ec,0xa4741));export const METADATA_FILE=a103_0x35a7ef(0x1a5);function a103_0x56ec(){const _0xa5ee29=['.git','767081NKiwcS','.next','node_modules','6EBrYiQ','dist','12408430XWXfuP','72IzaiGM','1103992GwkZHl','.svn','11ThANJK','.cache','.turbo','5086365TlauTm','.hg','2577956XJUjlG','3wWZWbM','lovrabet.skill.json','1085758kAPCPJ','870964ubjlMX'];a103_0x56ec=function(){return _0xa5ee29;};return a103_0x56ec();}export const SKILL_FILE='SKILL.md';export const IGNORED_FILE_NAMES=new Set([METADATA_FILE,'.DS_Store']);export const IGNORED_DIR_NAMES=new Set([a103_0x35a7ef(0x1a8),a103_0x35a7ef(0x1a2),a103_0x35a7ef(0x19d),a103_0x35a7ef(0x1ab),a103_0x35a7ef(0x1aa),a103_0x35a7ef(0x1ad),'build','coverage',a103_0x35a7ef(0x1a0),a103_0x35a7ef(0x19f)]);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { lstatSync } from "node:fs";
|
|
2
|
+
/** Resolves a managed Skill file path and rejects traversal or symlink writes. */
|
|
3
|
+
export declare function resolveManagedFilePath(dir: string, relativePath: string): string;
|
|
4
|
+
/** Walks a managed relative path and refuses to write through any symlink. */
|
|
5
|
+
export declare function ensureNoSymlinkInManagedPath(root: string, relativePath: string): void;
|
|
6
|
+
/** Detects a symlink path even when its target no longer exists. */
|
|
7
|
+
export declare function isDanglingSymlink(path: string): boolean;
|
|
8
|
+
/** Resolves a symlink target relative to the symlink parent when needed. */
|
|
9
|
+
export declare function resolveSymlinkTarget(linkPath: string): string;
|
|
10
|
+
/** Checks whether a child path is equal to or nested inside a parent path. */
|
|
11
|
+
export declare function isPathInside(child: string, parent: string): boolean;
|
|
12
|
+
/** Returns a real path when it exists, otherwise the absolute resolved path. */
|
|
13
|
+
export declare function realOrResolved(path: string): string;
|
|
14
|
+
/** Reads lstat metadata and returns undefined when the path is absent. */
|
|
15
|
+
export declare function lstatIfPresent(path: string): ReturnType<typeof lstatSync> | undefined;
|
|
16
|
+
/** Writes UTF-8 content through the same atomic byte-write path. */
|
|
17
|
+
export declare function writeTextAtomic(path: string, content: string, mode: number): void;
|
|
18
|
+
/** Writes bytes to a temp file and renames it into place atomically. */
|
|
19
|
+
export declare function writeBytesAtomic(path: string, content: Buffer, mode: number): void;
|
|
20
|
+
/** Writes formatted JSON metadata with owner-readable permissions. */
|
|
21
|
+
export declare function writeJsonAtomic(path: string, value: unknown): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x202192,_0x1a789f){const _0x4e3130=a104_0x2430,_0x2c46d6=_0x202192();while(!![]){try{const _0x205a10=parseInt(_0x4e3130(0x8b))/0x1+parseInt(_0x4e3130(0x7c))/0x2+parseInt(_0x4e3130(0x83))/0x3+parseInt(_0x4e3130(0x8a))/0x4+-parseInt(_0x4e3130(0x86))/0x5+-parseInt(_0x4e3130(0x85))/0x6+parseInt(_0x4e3130(0x89))/0x7*(-parseInt(_0x4e3130(0x7d))/0x8);if(_0x205a10===_0x1a789f)break;else _0x2c46d6['push'](_0x2c46d6['shift']());}catch(_0x4d37d2){_0x2c46d6['push'](_0x2c46d6['shift']());}}}(a104_0x4ac4,0xa59c3));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(_0x41f494,_0x1d88e3){const _0x1634ee=a104_0x2430,_0x39a350=normalizeSkillRelativePath(_0x1d88e3),_0x541b89=realOrResolved(_0x41f494),_0x3becae=resolve(_0x541b89,..._0x39a350['split']('/'));if(!isPathInside(_0x3becae,_0x541b89))throw CliErrors[_0x1634ee(0x84)](_0x1634ee(0x87)+_0x1d88e3);return ensureNoSymlinkInManagedPath(_0x541b89,_0x39a350),_0x3becae;}export function ensureNoSymlinkInManagedPath(_0x2fd195,_0x4ddfff){const _0x286f26=a104_0x2430;let _0x493383=_0x2fd195;for(const _0x106d82 of _0x4ddfff[_0x286f26(0x79)]('/')){_0x493383=resolve(_0x493383,_0x106d82);const _0x4b8f51=lstatIfPresent(_0x493383);if(_0x4b8f51?.[_0x286f26(0x7e)]())throw CliErrors[_0x286f26(0x84)](_0x286f26(0x80)+_0x4ddfff);}}function a104_0x4ac4(){const _0x103677=['189RBAlsY','380408mbqshf','760885rhOfXa','split','stringify','startsWith','243222UYPPZp','74488kRYMXy','isSymbolicLink','endsWith','Refusing\x20to\x20write\x20through\x20Skill\x20symlink\x20path:\x20','from','utf8','4001118rRzpTf','validation','2731428iyUUvc','4631650FKYMfq','Unsafe\x20Skill\x20file\x20path:\x20','.tmp'];a104_0x4ac4=function(){return _0x103677;};return a104_0x4ac4();}function a104_0x2430(_0x2744e3,_0x36abc9){_0x2744e3=_0x2744e3-0x79;const _0x4ac496=a104_0x4ac4();let _0x243037=_0x4ac496[_0x2744e3];return _0x243037;}export function isDanglingSymlink(_0x5b3bf9){const _0x40575c=a104_0x2430;try{return lstatSync(_0x5b3bf9)[_0x40575c(0x7e)]();}catch{return![];}}export function resolveSymlinkTarget(_0x9e1999){const _0x5145fa=readlinkSync(_0x9e1999);return isAbsolute(_0x5145fa)?_0x5145fa:resolve(dirname(_0x9e1999),_0x5145fa);}export function isPathInside(_0x450017,_0x277257){const _0x2a70c8=a104_0x2430,_0x25028d=_0x450017[_0x2a70c8(0x7f)](sep)?_0x450017:''+_0x450017+sep,_0x152b49=_0x277257[_0x2a70c8(0x7f)](sep)?_0x277257:''+_0x277257+sep;return _0x450017===_0x277257||_0x25028d[_0x2a70c8(0x7b)](_0x152b49);}export function realOrResolved(_0x1bf1d7){try{return realpathSync(_0x1bf1d7);}catch{return resolve(_0x1bf1d7);}}export function lstatIfPresent(_0x225e8e){try{return lstatSync(_0x225e8e);}catch{return undefined;}}export function writeTextAtomic(_0x17c032,_0x27f5a2,_0x1858e8){const _0x4ccfd6=a104_0x2430;writeBytesAtomic(_0x17c032,Buffer[_0x4ccfd6(0x81)](_0x27f5a2,_0x4ccfd6(0x82)),_0x1858e8);}export function writeBytesAtomic(_0x4e098b,_0x3b3762,_0x13d3b7){const _0x4bdeac=a104_0x2430,_0x3e12c0=_0x4e098b+_0x4bdeac(0x88);try{writeFileSync(_0x3e12c0,_0x3b3762,{'mode':_0x13d3b7}),renameSync(_0x3e12c0,_0x4e098b);}catch(_0x3db164){try{rmSync(_0x3e12c0,{'force':!![]});}catch{}throw _0x3db164;}}export function writeJsonAtomic(_0x3dc0db,_0x5694ef){const _0x3411c5=a104_0x2430;writeTextAtomic(_0x3dc0db,JSON[_0x3411c5(0x7a)](_0x5694ef,null,0x2)+'\x0a',0x180);}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { LocalSkillFile, RuntimeSkillFile } from "./types.js";
|
|
2
|
+
/** Computes the stable content hash used by metadata and change detection. */
|
|
3
|
+
export declare function contentHash(content: string): string;
|
|
4
|
+
/** Hashes a local Skill file entry regardless of whether it is text or bytes. */
|
|
5
|
+
export declare function fileHash(file: LocalSkillFile): string;
|
|
6
|
+
/** Computes a SHA-256 digest for raw package or file bytes. */
|
|
7
|
+
export declare function bufferSha256(buffer: Buffer): string;
|
|
8
|
+
/** Builds the deterministic tree hash for a normalized Skill manifest. */
|
|
9
|
+
export declare function fileTreeHash(files: RuntimeSkillFile[]): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x4065d6,_0x33a32f){const _0x935723=a105_0x4711,_0x574663=_0x4065d6();while(!![]){try{const _0x2d60dc=-parseInt(_0x935723(0x1b6))/0x1+-parseInt(_0x935723(0x1bc))/0x2*(-parseInt(_0x935723(0x1be))/0x3)+parseInt(_0x935723(0x1ba))/0x4*(-parseInt(_0x935723(0x1b5))/0x5)+-parseInt(_0x935723(0x1bb))/0x6+-parseInt(_0x935723(0x1b3))/0x7+parseInt(_0x935723(0x1b9))/0x8*(-parseInt(_0x935723(0x1c2))/0x9)+-parseInt(_0x935723(0x1c3))/0xa*(-parseInt(_0x935723(0x1b8))/0xb);if(_0x2d60dc===_0x33a32f)break;else _0x574663['push'](_0x574663['shift']());}catch(_0x2b32bf){_0x574663['push'](_0x574663['shift']());}}}(a105_0x33d1,0xe91e4));import{createHash}from'node:crypto';import{fileContent,normalizeManifestFiles}from'./local-files.js';function a105_0x4711(_0x48bd0d,_0x17551a){_0x48bd0d=_0x48bd0d-0x1b3;const _0x33d1c6=a105_0x33d1();let _0x4711c0=_0x33d1c6[_0x48bd0d];return _0x4711c0;}export function contentHash(_0x327f99){const _0x537cd7=a105_0x4711;return createHash(_0x537cd7(0x1b7))[_0x537cd7(0x1b4)](_0x327f99)['digest']('hex');}function a105_0x33d1(){const _0x488973=['295077RNBstx','hex','path','size','1557oQWlBB','7033090KkWFnp','10648687EJkwbb','update','1525715nRpzXR','1421728KOWomK','sha256','77cyJUmO','13880cVZcvB','16AFXpbc','3519384seqRcd','22lTMKlp','digest'];a105_0x33d1=function(){return _0x488973;};return a105_0x33d1();}export function fileHash(_0xc89c6d){return bufferSha256(fileContent(_0xc89c6d));}export function bufferSha256(_0x6c062d){const _0x4cfd14=a105_0x4711;return createHash(_0x4cfd14(0x1b7))[_0x4cfd14(0x1b4)](_0x6c062d)[_0x4cfd14(0x1bd)](_0x4cfd14(0x1bf));}export function fileTreeHash(_0xa9c48b){const _0x28b80b=a105_0x4711,_0x52e99b=createHash('sha256');for(const _0x45065f of normalizeManifestFiles(_0xa9c48b)){_0x52e99b['update'](_0x45065f[_0x28b80b(0x1c0)]),_0x52e99b['update']('\x00'),_0x52e99b['update'](_0x45065f[_0x28b80b(0x1b7)]),_0x52e99b['update']('\x00'),_0x52e99b['update'](String(_0x45065f[_0x28b80b(0x1c1)])),_0x52e99b['update']('\x00');}return _0x52e99b[_0x28b80b(0x1bd)]('hex');}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { GlobalRuntimeSkillLinkResult, LinkRuntimeSkillResult, MaterializedRuntimeSkill, PruneRuntimeSkillResult, RuntimeSkillScope, SkillSyncPathsOptions } from "./types.js";
|
|
2
|
+
/** Links the effective runtime Skill version into each agent Skill root. */
|
|
3
|
+
export declare function linkEffectiveRuntimeSkills(materialized: MaterializedRuntimeSkill[], appCode: string, options?: SkillSyncPathsOptions): LinkRuntimeSkillResult[];
|
|
4
|
+
/** Removes managed app Skill links that no longer point to active Skill codes. */
|
|
5
|
+
export declare function pruneStaleRuntimeSkillLinks(appCode: string, activeSkillCodes: Iterable<string>, options?: SkillSyncPathsOptions, pruneSkillCodes?: Iterable<string>): PruneRuntimeSkillResult[];
|
|
6
|
+
/** Removes stale managed cache directories whose metadata still matches the app. */
|
|
7
|
+
export declare function pruneStaleRuntimeSkillCache(input: {
|
|
8
|
+
env: "production" | "development" | "daily";
|
|
9
|
+
accessKey: string;
|
|
10
|
+
appCode: string;
|
|
11
|
+
activeSkillCodes: Iterable<string>;
|
|
12
|
+
pruneSkillCodes?: Iterable<string>;
|
|
13
|
+
scopes?: Array<Extract<RuntimeSkillScope, "personal" | "company">>;
|
|
14
|
+
}, options?: SkillSyncPathsOptions): PruneRuntimeSkillResult[];
|
|
15
|
+
/** Copies builtin Skills into the global agent Skill root as real directories. */
|
|
16
|
+
export declare function linkGlobalRuntimeSkills(materialized: MaterializedRuntimeSkill[], options?: SkillSyncPathsOptions): GlobalRuntimeSkillLinkResult[];
|
|
17
|
+
/** Replaces a builtin global Skill directory with a managed copy. */
|
|
18
|
+
export declare function copyManagedSkillDirectory(sourceDir: string, targetDir: string): LinkRuntimeSkillResult;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x11e4e7,_0x5e065a){const _0xa220fa=a106_0x3839,_0x28ff4d=_0x11e4e7();while(!![]){try{const _0x298385=-parseInt(_0xa220fa(0xfd))/0x1*(-parseInt(_0xa220fa(0x117))/0x2)+-parseInt(_0xa220fa(0x107))/0x3+parseInt(_0xa220fa(0x11c))/0x4+-parseInt(_0xa220fa(0x119))/0x5+parseInt(_0xa220fa(0x11f))/0x6+parseInt(_0xa220fa(0x102))/0x7+parseInt(_0xa220fa(0x10f))/0x8;if(_0x298385===_0x5e065a)break;else _0x28ff4d['push'](_0x28ff4d['shift']());}catch(_0x3561ff){_0x28ff4d['push'](_0x28ff4d['shift']());}}}(a106_0x37f6,0x3715b));import{existsSync,lstatSync,mkdirSync,readdirSync,symlinkSync,unlinkSync}from'node:fs';import{basename,dirname,resolve}from'node:path';import a106_0x3ef653 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,runtimeAgentSkillRoots,safePathSegment}from'./paths.js';const {copySync,ensureDirSync,removeSync}=a106_0x3ef653;export function linkEffectiveRuntimeSkills(_0x5de07e,_0x2d947f,_0x2fcdd8={}){const _0x15f408=a106_0x3839,_0x5d7706=new Map();for(const _0x7d902b of _0x5de07e){const _0x674ace=_0x7d902b[_0x15f408(0x11a)][_0x15f408(0xf9)];if(!_0x674ace)continue;const _0x143ee=_0x5d7706[_0x15f408(0xfc)](_0x674ace);(!_0x143ee||_0x7d902b['scope']===_0x15f408(0xfb))&&_0x5d7706[_0x15f408(0x11b)](_0x674ace,_0x7d902b);}const _0x307396=[],_0x2245cb=resolveSkillSyncPaths(_0x2fcdd8);for(const _0xf80a08 of _0x5d7706[_0x15f408(0x100)]()){const _0x5c9b33=requireSkillCode(_0xf80a08[_0x15f408(0x11a)]),_0x43d3b8=_0x2d947f+'--'+_0x5c9b33;for(const _0x4cee54 of runtimeAgentSkillRoots(_0x2245cb)){_0x307396[_0x15f408(0x105)](ensureManagedSymlink(resolve(_0x4cee54,_0x43d3b8),_0xf80a08[_0x15f408(0x112)],_0x2245cb[_0x15f408(0xf0)]));}}return _0x307396;}export function pruneStaleRuntimeSkillLinks(_0x57f9ee,_0x377f4e,_0x10f876={},_0x3d900c){const _0x5ee30d=a106_0x3839,_0xd0143e=resolveSkillSyncPaths(_0x10f876),_0x2df84b=new Set([..._0x377f4e]['map'](_0x4727d6=>_0x4727d6['trim']())['filter'](Boolean)),_0x1a44a3=_0x3d900c?new Set([..._0x3d900c][_0x5ee30d(0xf8)](_0x4738cc=>_0x4738cc[_0x5ee30d(0x11d)]())['filter'](Boolean)):undefined,_0x9ffe27=[];for(const _0x468312 of runtimeAgentSkillRoots(_0xd0143e)){for(const _0x2e94e1 of managedAppSkillLinkPaths(_0x468312,_0x57f9ee)){const _0x1aca53=basename(_0x2e94e1)[_0x5ee30d(0x109)]((_0x57f9ee+'--')['length']);if(_0x1a44a3&&!_0x1a44a3[_0x5ee30d(0xfa)](_0x1aca53))continue;if(_0x2df84b[_0x5ee30d(0xfa)](_0x1aca53))continue;_0x9ffe27[_0x5ee30d(0x105)](removeManagedSkillLink(_0x2e94e1,_0xd0143e[_0x5ee30d(0xf0)]));}}return _0x9ffe27;}export function pruneStaleRuntimeSkillCache(_0x2ac18a,_0x574ca9={}){const _0x29911d=a106_0x3839,_0xc88f8e=new Set([..._0x2ac18a[_0x29911d(0x101)]][_0x29911d(0xf8)](_0x36ce94=>_0x36ce94['trim']())[_0x29911d(0x108)](Boolean)),_0x5119d6=_0x2ac18a[_0x29911d(0xfe)]?new Set([..._0x2ac18a[_0x29911d(0xfe)]][_0x29911d(0xf8)](_0x3d7d0d=>_0x3d7d0d[_0x29911d(0x11d)]())[_0x29911d(0x108)](Boolean)):undefined,_0x2c2aae=_0x2ac18a[_0x29911d(0xf2)]??[_0x29911d(0xfb),_0x29911d(0x115)],_0x3341b1=resolve(getRuntimeSkillCacheRoot(_0x2ac18a[_0x29911d(0xf6)],_0x2ac18a[_0x29911d(0x10b)],_0x574ca9),safePathSegment(_0x2ac18a[_0x29911d(0xf7)],_0x29911d(0xf7))),_0x2afa37=[];for(const _0x473d17 of _0x2c2aae){const _0x13919c=resolve(_0x3341b1,_0x473d17);if(!existsSync(_0x13919c))continue;for(const _0x146001 of readdirSync(_0x13919c,{'withFileTypes':!![]})){if(!_0x146001['isDirectory']())continue;const _0x3543ea=_0x146001[_0x29911d(0x10e)];if(_0x5119d6&&!_0x5119d6[_0x29911d(0xfa)](_0x3543ea))continue;if(_0xc88f8e[_0x29911d(0xfa)](_0x3543ea))continue;const _0x44bece=resolve(_0x13919c,_0x3543ea),_0x1c4bac=readMetadataIfPresent(resolve(_0x44bece,METADATA_FILE));if(_0x1c4bac?.['appCode']!==_0x2ac18a['appCode']||_0x1c4bac[_0x29911d(0x10c)]!==_0x473d17||_0x1c4bac[_0x29911d(0xf9)]!==_0x3543ea){_0x2afa37[_0x29911d(0x105)]({'path':_0x44bece,'action':_0x29911d(0xf1),'reason':_0x29911d(0xf3)});continue;}removeSync(_0x44bece),_0x2afa37[_0x29911d(0x105)]({'path':_0x44bece,'action':_0x29911d(0x10d)});}}return _0x2afa37;}export function linkGlobalRuntimeSkills(_0x2c3389,_0x112db3={}){const _0x4ee4b6=a106_0x3839,_0x51a4d3=resolveSkillSyncPaths(_0x112db3),_0x157c68=[];for(const _0x2d8da5 of _0x2c3389){if(_0x2d8da5['scope']!==_0x4ee4b6(0xef))throw CliErrors[_0x4ee4b6(0x118)](_0x4ee4b6(0x110)+_0x2d8da5[_0x4ee4b6(0x10c)]);const _0x1018e8=requireSkillCode(_0x2d8da5['skill']),_0x1fc1ac=copyManagedSkillDirectory(_0x2d8da5[_0x4ee4b6(0x112)],resolve(_0x51a4d3['agentsSkillsDir'],_0x1018e8));_0x157c68[_0x4ee4b6(0x105)]({..._0x1fc1ac,'contentHash':_0x2d8da5['contentHash']});}return _0x157c68;}function a106_0x37f6(){const _0x1107ac=['get','2ykSopp','pruneSkillCodes','contentHash','values','activeSkillCodes','2745155LddEAL','Refusing\x20to\x20overwrite\x20global\x20Skill\x20path:\x20','unchanged','push','Refusing\x20to\x20copy\x20Skill\x20symlink:\x20','1085937JUjmQg','filter','slice','isSymbolicLink','accessKey','scope','removed','name','247392aZyDDF','Only\x20builtin\x20Skills\x20can\x20be\x20linked\x20into\x20the\x20global\x20Skill\x20root:\x20','Refusing\x20to\x20overwrite\x20global\x20Skill\x20symlink:\x20','dir','startsWith','isDirectory','company','Refusing\x20to\x20overwrite\x20unmanaged\x20path:\x20','6108HKhvxL','validation','1072945fmmUAb','skill','set','1105328bkhihL','trim','external-symlink','579996NxHsoQ','Refusing\x20to\x20overwrite\x20unmanaged\x20symlink:\x20','builtin','managedRoot','skipped','scopes','metadata-mismatch','created','updated','env','appCode','map','skillCode','has','personal'];a106_0x37f6=function(){return _0x1107ac;};return a106_0x37f6();}function ensureManagedSymlink(_0x4e3964,_0x37a6fa,_0x55fdaa){const _0x508375=a106_0x3839;mkdirSync(dirname(_0x4e3964),{'recursive':!![],'mode':0x1c0});if(existsSync(_0x4e3964)||isDanglingSymlink(_0x4e3964)){const _0x3f94df=lstatSync(_0x4e3964);if(!_0x3f94df[_0x508375(0x10a)]())throw CliErrors['validation'](_0x508375(0x116)+_0x4e3964);const _0x223867=resolveSymlinkTarget(_0x4e3964);if(!isPathInside(realOrResolved(_0x223867),realOrResolved(_0x55fdaa)))throw CliErrors[_0x508375(0x118)](_0x508375(0xee)+_0x4e3964);if(realOrResolved(_0x223867)===realOrResolved(_0x37a6fa))return{'path':_0x4e3964,'target':_0x37a6fa,'action':_0x508375(0x104)};return unlinkSync(_0x4e3964),symlinkSync(_0x37a6fa,_0x4e3964,'dir'),{'path':_0x4e3964,'target':_0x37a6fa,'action':_0x508375(0xf5)};}return symlinkSync(_0x37a6fa,_0x4e3964,_0x508375(0x112)),{'path':_0x4e3964,'target':_0x37a6fa,'action':_0x508375(0xf4)};}function managedAppSkillLinkPaths(_0x58bf20,_0x5d156f){const _0x4d87a6=a106_0x3839;if(!existsSync(_0x58bf20))return[];const _0x5b4f96=_0x5d156f+'--';return readdirSync(_0x58bf20,{'withFileTypes':!![]})['filter'](_0x2a06aa=>_0x2a06aa['name'][_0x4d87a6(0x113)](_0x5b4f96))[_0x4d87a6(0xf8)](_0x2f7a18=>resolve(_0x58bf20,_0x2f7a18['name']));}function removeManagedSkillLink(_0x1c31fe,_0x2d2d99){const _0x47a1dd=a106_0x3839,_0x28abed=lstatIfPresent(_0x1c31fe);if(!_0x28abed?.[_0x47a1dd(0x10a)]())return{'path':_0x1c31fe,'action':_0x47a1dd(0xf1),'reason':'not-managed-symlink'};const _0x20d672=resolveSymlinkTarget(_0x1c31fe);if(!isPathInside(realOrResolved(_0x20d672),realOrResolved(_0x2d2d99)))return{'path':_0x1c31fe,'action':_0x47a1dd(0xf1),'reason':_0x47a1dd(0x11e)};return unlinkSync(_0x1c31fe),{'path':_0x1c31fe,'action':'removed'};}export function copyManagedSkillDirectory(_0x18d9a9,_0x246ff9){const _0x3a0279=a106_0x3839,_0x55a77d=resolve(_0x246ff9,METADATA_FILE),_0x2cbecf=existsSync(_0x246ff9);if(_0x2cbecf){const _0x475fc8=lstatSync(_0x246ff9);if(_0x475fc8[_0x3a0279(0x10a)]())throw CliErrors['validation'](_0x3a0279(0x111)+_0x246ff9);if(!_0x475fc8[_0x3a0279(0x114)]())throw CliErrors[_0x3a0279(0x118)](_0x3a0279(0x103)+_0x246ff9);const _0x3ca3bb=readMetadataIfPresent(_0x55a77d);if(_0x3ca3bb?.['scope']!==_0x3a0279(0xef))throw CliErrors[_0x3a0279(0x118)]('Refusing\x20to\x20overwrite\x20unmanaged\x20global\x20Skill\x20directory:\x20'+_0x246ff9);}ensureDirSync(dirname(_0x246ff9));const _0x5770e6=_0x2cbecf?readMetadataIfPresent(_0x55a77d)?.[_0x3a0279(0xff)]:undefined,_0x11b4d2=readMetadataIfPresent(resolve(_0x18d9a9,METADATA_FILE))?.[_0x3a0279(0xff)];return _0x2cbecf&&removeSync(_0x246ff9),copySkillDirectory(_0x18d9a9,_0x246ff9),{'path':_0x246ff9,'target':_0x18d9a9,'action':!_0x2cbecf?'created':_0x5770e6===_0x11b4d2?_0x3a0279(0x104):_0x3a0279(0xf5)};}function a106_0x3839(_0x570692,_0x4052c6){_0x570692=_0x570692-0xee;const _0x37f694=a106_0x37f6();let _0x38395c=_0x37f694[_0x570692];return _0x38395c;}function copySkillDirectory(_0x586108,_0x41d879){copySync(_0x586108,_0x41d879,{'dereference':![],'overwrite':!![],'filter'(_0x2ec424){const _0x5c07f2=a106_0x3839;if(lstatSync(_0x2ec424)[_0x5c07f2(0x10a)]())throw CliErrors[_0x5c07f2(0x118)](_0x5c07f2(0x106)+_0x2ec424);return!![];}});}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { LocalRuntimeSkillItem, LocalRuntimeSkillListInput, SkillSyncPathsOptions } from "./types.js";
|
|
2
|
+
/** Lists locally cached and linked runtime Skills for one app context. */
|
|
3
|
+
export declare function listLocalRuntimeSkills(input: LocalRuntimeSkillListInput, options?: SkillSyncPathsOptions): LocalRuntimeSkillItem[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x1344d2,_0x1863fd){const _0x1f8aaa=a107_0x2fdb,_0x24f027=_0x1344d2();while(!![]){try{const _0x236e9f=-parseInt(_0x1f8aaa(0xaa))/0x1*(parseInt(_0x1f8aaa(0xa6))/0x2)+-parseInt(_0x1f8aaa(0xa5))/0x3*(parseInt(_0x1f8aaa(0x9a))/0x4)+parseInt(_0x1f8aaa(0xab))/0x5+parseInt(_0x1f8aaa(0x82))/0x6+-parseInt(_0x1f8aaa(0xa4))/0x7*(parseInt(_0x1f8aaa(0x98))/0x8)+parseInt(_0x1f8aaa(0x97))/0x9*(parseInt(_0x1f8aaa(0x99))/0xa)+-parseInt(_0x1f8aaa(0x90))/0xb;if(_0x236e9f===_0x1863fd)break;else _0x24f027['push'](_0x24f027['shift']());}catch(_0x25da23){_0x24f027['push'](_0x24f027['shift']());}}}(a107_0x4b4d,0x9830c));import{existsSync,readdirSync}from'node:fs';import{resolve}from'node:path';import{METADATA_FILE,SKILL_FILE}from'./constants.js';import{readMetadataIfPresent}from'./metadata.js';import{getRuntimeSkillCacheRoot,resolveSkillSyncPaths,runtimeAgentSkillRoots,safePathSegment}from'./paths.js';function a107_0x4b4d(){const _0xc5a28=['tags','local','9jATEUO','1720nrvCbO','7762360erzuMr','4iFMOZx','includes','push','linkedPaths','sort','code','from','get','localeCompare','appCode','4858hEyzxb','2096769BfOEsr','4SYVDHp','isSymbolicLink','name','env','232474aIFMsp','5806715jnhIEJ','7265394QLbXMQ','trim','scopes','map','startsWith','has','scope','source','metadataPath','skillCode','isDirectory','cache','values','cacheDir','13332275cujxhF','dir','skillMdPath','filter','accessKey'];a107_0x4b4d=function(){return _0xc5a28;};return a107_0x4b4d();}import{isRuntimeSkillScope,normalizeRuntimeSkillScopes}from'./scopes.js';export function listLocalRuntimeSkills(_0x22bba5,_0x5bd8a0={}){const _0x27b85c=a107_0x2fdb,_0x1e6288=safePathSegment(_0x22bba5[_0x27b85c(0xa3)],_0x27b85c(0xa3)),_0x97b9c5=normalizeRuntimeSkillScopes(_0x22bba5[_0x27b85c(0x84)]),_0x5f4576=new Set(_0x97b9c5),_0x4402a9=_0x22bba5[_0x27b85c(0x9f)]?.['trim'](),_0x29b216=new Map(),_0x5c1d42=resolve(getRuntimeSkillCacheRoot(_0x22bba5[_0x27b85c(0xa9)],_0x22bba5[_0x27b85c(0x94)],_0x5bd8a0),_0x1e6288);for(const _0x3cdb0f of _0x97b9c5){for(const _0x4f6699 of localSkillEntryDirs(resolve(_0x5c1d42,_0x3cdb0f))){collectLocalRuntimeSkill(_0x29b216,_0x4f6699,{'appCode':_0x1e6288,'scopes':_0x5f4576,'code':_0x4402a9,'source':'cache'});}}const _0x482c0e=resolveSkillSyncPaths(_0x5bd8a0);for(const _0x4ccf69 of runtimeAgentSkillRoots(_0x482c0e)){for(const _0x5148e3 of localSkillLinkCandidates(_0x4ccf69,_0x1e6288,_0x5f4576)){collectLocalRuntimeSkill(_0x29b216,_0x5148e3,{'appCode':_0x1e6288,'scopes':_0x5f4576,'code':_0x4402a9,'source':'link','linkedPath':_0x5148e3});}}return Array[_0x27b85c(0xa0)](_0x29b216[_0x27b85c(0x8e)]())['sort'](compareLocalRuntimeSkills);}function a107_0x2fdb(_0x2b5d9a,_0x4d353a){_0x2b5d9a=_0x2b5d9a-0x82;const _0x4b4d2c=a107_0x4b4d();let _0x2fdbfa=_0x4b4d2c[_0x2b5d9a];return _0x2fdbfa;}function localSkillEntryDirs(_0x17f004){const _0x597d7e=a107_0x2fdb;if(!existsSync(_0x17f004))return[];return readdirSync(_0x17f004,{'withFileTypes':!![]})[_0x597d7e(0x93)](_0x318c77=>_0x318c77[_0x597d7e(0x8c)]()||_0x318c77[_0x597d7e(0xa7)]())[_0x597d7e(0x85)](_0xcea646=>resolve(_0x17f004,_0xcea646['name']));}function localSkillLinkCandidates(_0x145477,_0x5235ce,_0x191b34){const _0x32eb63=a107_0x2fdb;if(!existsSync(_0x145477))return[];const _0x305a30=_0x5235ce+'--';return readdirSync(_0x145477,{'withFileTypes':!![]})[_0x32eb63(0x93)](_0x48cdcc=>_0x48cdcc[_0x32eb63(0x8c)]()||_0x48cdcc[_0x32eb63(0xa7)]())[_0x32eb63(0x93)](_0x4bb6d6=>_0x4bb6d6[_0x32eb63(0xa8)][_0x32eb63(0x86)](_0x305a30)||_0x191b34[_0x32eb63(0x87)]('builtin'))[_0x32eb63(0x85)](_0x7fba9e=>resolve(_0x145477,_0x7fba9e[_0x32eb63(0xa8)]));}function collectLocalRuntimeSkill(_0x44b7e7,_0x11fd23,_0x2d36c8){const _0x3e0f6e=a107_0x2fdb,_0x1f5188=resolve(_0x11fd23,METADATA_FILE),_0x47f1f4=readMetadataIfPresent(_0x1f5188);if(!_0x47f1f4)return;if(_0x47f1f4[_0x3e0f6e(0xa3)]!==_0x2d36c8['appCode'])return;if(!isRuntimeSkillScope(_0x47f1f4[_0x3e0f6e(0x88)])||!_0x2d36c8['scopes']['has'](_0x47f1f4['scope']))return;const _0x1b45e0=_0x47f1f4[_0x3e0f6e(0x8b)]?.[_0x3e0f6e(0x83)]();if(!_0x1b45e0)return;if(_0x2d36c8[_0x3e0f6e(0x9f)]&&_0x1b45e0!==_0x2d36c8[_0x3e0f6e(0x9f)])return;const _0x40291d=_0x47f1f4[_0x3e0f6e(0x88)]+':'+_0x1b45e0,_0x26e303=_0x2d36c8['linkedPath']?[_0x2d36c8['linkedPath']]:[],_0x1a157b=_0x44b7e7[_0x3e0f6e(0xa1)](_0x40291d);if(_0x1a157b){_0x2d36c8[_0x3e0f6e(0x89)]===_0x3e0f6e(0x8d)&&(_0x1a157b[_0x3e0f6e(0x91)]=_0x11fd23,_0x1a157b[_0x3e0f6e(0x8f)]=_0x11fd23,_0x1a157b[_0x3e0f6e(0x92)]=resolve(_0x11fd23,SKILL_FILE),_0x1a157b[_0x3e0f6e(0x8a)]=_0x1f5188);for(const _0x347132 of _0x26e303){!_0x1a157b[_0x3e0f6e(0x9d)][_0x3e0f6e(0x9b)](_0x347132)&&_0x1a157b[_0x3e0f6e(0x9d)][_0x3e0f6e(0x9c)](_0x347132);}_0x1a157b['linkedPaths'][_0x3e0f6e(0x9e)]();return;}_0x44b7e7['set'](_0x40291d,{..._0x47f1f4,'tags':Array['isArray'](_0x47f1f4[_0x3e0f6e(0x95)])?_0x47f1f4[_0x3e0f6e(0x95)]:[],'scope':_0x47f1f4['scope'],'source':_0x3e0f6e(0x96),'dir':_0x11fd23,'cacheDir':_0x2d36c8[_0x3e0f6e(0x89)]===_0x3e0f6e(0x8d)?_0x11fd23:undefined,'skillMdPath':resolve(_0x11fd23,SKILL_FILE),'metadataPath':_0x1f5188,'linkedPaths':_0x26e303});}function compareLocalRuntimeSkills(_0x242584,_0x53c7dd){const _0x187634=a107_0x2fdb,_0x9cf65c={'personal':0x0,'company':0x1,'builtin':0x2};return _0x9cf65c[_0x242584[_0x187634(0x88)]]-_0x9cf65c[_0x53c7dd[_0x187634(0x88)]]||_0x242584[_0x187634(0x8b)][_0x187634(0xa2)](_0x53c7dd['skillCode'])||_0x242584['dir'][_0x187634(0xa2)](_0x53c7dd[_0x187634(0x91)]);}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { LocalSkillFile, RuntimeSkillFile } from "./types.js";
|
|
2
|
+
/** Converts a local file entry into bytes for hashing, packaging, or writes. */
|
|
3
|
+
export declare function fileContent(file: LocalSkillFile): Buffer;
|
|
4
|
+
/** Decodes a local file entry as UTF-8 text for SKILL.md and metadata logic. */
|
|
5
|
+
export declare function fileText(file: LocalSkillFile): string;
|
|
6
|
+
/** Normalizes package file entries and preserves deterministic ordering. */
|
|
7
|
+
export declare function normalizeLocalFiles(files: LocalSkillFile[] | undefined): LocalSkillFile[];
|
|
8
|
+
/** Normalizes remote manifest entries and validates hash and size metadata. */
|
|
9
|
+
export declare function normalizeManifestFiles(files: RuntimeSkillFile[] | undefined): RuntimeSkillFile[];
|
|
10
|
+
/** Scans a Skill directory into normalized package entries while skipping local-only files. */
|
|
11
|
+
export declare function scanSkillDirectory(dir: string): LocalSkillFile[];
|
|
12
|
+
/** Sorts SKILL.md first and then keeps the remaining file paths deterministic. */
|
|
13
|
+
export declare function compareSkillFiles(a: {
|
|
14
|
+
path: string;
|
|
15
|
+
}, b: {
|
|
16
|
+
path: string;
|
|
17
|
+
}): number;
|
|
18
|
+
/** Normalizes a package path to POSIX form after trimming and safety checks. */
|
|
19
|
+
export declare function normalizeSkillRelativePath(path: string): string;
|
|
20
|
+
/** Rejects absolute paths, empty path segments, and parent traversal. */
|
|
21
|
+
export declare function validateSkillRelativePath(path: string): void;
|
|
22
|
+
/** Converts Windows path separators to POSIX separators for package metadata. */
|
|
23
|
+
export declare function toPosixPath(path: string): string;
|
|
24
|
+
/** Checks whether a value is a lowercase or uppercase SHA-256 hex digest. */
|
|
25
|
+
export declare function isSha256Hex(value: unknown): value is string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x35eb2b,_0x25e414){const _0x50345c=a108_0x2917,_0x599cfe=_0x35eb2b();while(!![]){try{const _0x4a9376=parseInt(_0x50345c(0x145))/0x1+parseInt(_0x50345c(0x126))/0x2*(parseInt(_0x50345c(0x141))/0x3)+parseInt(_0x50345c(0x14f))/0x4+parseInt(_0x50345c(0x13c))/0x5*(-parseInt(_0x50345c(0x12b))/0x6)+-parseInt(_0x50345c(0x13b))/0x7*(-parseInt(_0x50345c(0x142))/0x8)+parseInt(_0x50345c(0x140))/0x9*(parseInt(_0x50345c(0x124))/0xa)+-parseInt(_0x50345c(0x129))/0xb*(parseInt(_0x50345c(0x138))/0xc);if(_0x4a9376===_0x25e414)break;else _0x599cfe['push'](_0x599cfe['shift']());}catch(_0x28275e){_0x599cfe['push'](_0x599cfe['shift']());}}}(a108_0x5acc,0xc61e0));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(_0x5bed79){const _0x5d1e12=a108_0x2917;return _0x5bed79[_0x5d1e12(0x13f)]??Buffer[_0x5d1e12(0x14c)](_0x5bed79[_0x5d1e12(0x13a)]??'',_0x5d1e12(0x12a));}export function fileText(_0x255b55){const _0x7c9b4=a108_0x2917;return fileContent(_0x255b55)[_0x7c9b4(0x14a)](_0x7c9b4(0x12a));}export function normalizeLocalFiles(_0x23d6ee){const _0x511197=a108_0x2917;if(!Array['isArray'](_0x23d6ee)||_0x23d6ee[_0x511197(0x13d)]===0x0)return[];const _0x551bd1=new Map();for(const _0x3e66fd of _0x23d6ee){if(!_0x3e66fd||typeof _0x3e66fd!=='object'||typeof _0x3e66fd[_0x511197(0x148)]!==_0x511197(0x143))throw CliErrors[_0x511197(0x14b)](_0x511197(0x133));const _0x21972d=normalizeSkillRelativePath(_0x3e66fd[_0x511197(0x148)]);if(_0x551bd1[_0x511197(0x136)](_0x21972d))throw CliErrors[_0x511197(0x14b)](_0x511197(0x128)+_0x21972d);if(_0x3e66fd[_0x511197(0x13f)]!==undefined&&!Buffer[_0x511197(0x135)](_0x3e66fd[_0x511197(0x13f)]))throw CliErrors['validation'](_0x511197(0x123)+_0x21972d);if(_0x3e66fd[_0x511197(0x13f)]===undefined&&typeof _0x3e66fd['content']!==_0x511197(0x143))throw CliErrors[_0x511197(0x14b)](_0x511197(0x127)+_0x21972d);const _0x39184d=fileContent(_0x3e66fd);_0x551bd1[_0x511197(0x13e)](_0x21972d,{'path':_0x21972d,'bytes':_0x39184d});}return Array['from'](_0x551bd1[_0x511197(0x130)]())[_0x511197(0x146)](compareSkillFiles);}export function normalizeManifestFiles(_0x2b2ccb){const _0x3cd84b=a108_0x2917;if(!Array['isArray'](_0x2b2ccb)||_0x2b2ccb[_0x3cd84b(0x13d)]===0x0)return[];const _0x509196=new Map();for(const _0x35fe99 of _0x2b2ccb){if(!_0x35fe99||typeof _0x35fe99!=='object'||typeof _0x35fe99['path']!==_0x3cd84b(0x143))throw CliErrors[_0x3cd84b(0x14b)](_0x3cd84b(0x133));const _0x2b71d3=normalizeSkillRelativePath(_0x35fe99['path']);if(_0x509196[_0x3cd84b(0x136)](_0x2b71d3))throw CliErrors[_0x3cd84b(0x14b)](_0x3cd84b(0x128)+_0x2b71d3);if(!isSha256Hex(_0x35fe99['sha256']))throw CliErrors[_0x3cd84b(0x14b)](_0x3cd84b(0x144)+_0x2b71d3);if(!Number[_0x3cd84b(0x12e)](_0x35fe99[_0x3cd84b(0x134)])||_0x35fe99[_0x3cd84b(0x134)]<0x0)throw CliErrors[_0x3cd84b(0x14b)]('Skill\x20file\x20size\x20is\x20invalid:\x20'+_0x2b71d3);_0x509196['set'](_0x2b71d3,{'path':_0x2b71d3,'sha256':_0x35fe99['sha256']['toLowerCase'](),'size':_0x35fe99[_0x3cd84b(0x134)]});}return Array[_0x3cd84b(0x14c)](_0x509196[_0x3cd84b(0x130)]())['sort'](compareSkillFiles);}export function scanSkillDirectory(_0x552d56){const _0x53b691=realpathSync(_0x552d56),_0x10a786=[];function _0x38faf4(_0x15e4b8){const _0x5562ef=a108_0x2917,_0x465e1d=readdirSync(_0x15e4b8,{'withFileTypes':!![]})['sort']((_0x569fcb,_0x412f76)=>_0x569fcb[_0x5562ef(0x147)]['localeCompare'](_0x412f76[_0x5562ef(0x147)]));for(const _0x545d8f of _0x465e1d){if(_0x545d8f[_0x5562ef(0x125)]()&&IGNORED_DIR_NAMES['has'](_0x545d8f['name']))continue;if(IGNORED_FILE_NAMES[_0x5562ef(0x136)](_0x545d8f[_0x5562ef(0x147)]))continue;const _0x5105e4=resolve(_0x15e4b8,_0x545d8f['name']);if(_0x545d8f[_0x5562ef(0x12f)]())throw CliErrors[_0x5562ef(0x14b)](_0x5562ef(0x132)+_0x5105e4);const _0x5a2a89=toPosixPath(relative(_0x53b691,_0x5105e4));if(_0x545d8f[_0x5562ef(0x125)]()){_0x38faf4(_0x5105e4);continue;}if(!_0x545d8f['isFile']())continue;validateSkillRelativePath(_0x5a2a89);const _0x5e7ad5=readFileSync(_0x5105e4);_0x10a786[_0x5562ef(0x139)]({'path':_0x5a2a89,'bytes':_0x5e7ad5});}}return _0x38faf4(_0x53b691),normalizeLocalFiles(_0x10a786);}export function compareSkillFiles(_0x379e59,_0x34d773){const _0x1da773=a108_0x2917;if(_0x379e59[_0x1da773(0x148)]===SKILL_FILE)return _0x34d773[_0x1da773(0x148)]===SKILL_FILE?0x0:-0x1;if(_0x34d773['path']===SKILL_FILE)return 0x1;return Buffer[_0x1da773(0x131)](Buffer[_0x1da773(0x14c)](_0x379e59[_0x1da773(0x148)],'utf8'),Buffer[_0x1da773(0x14c)](_0x34d773['path'],'utf8'));}function a108_0x2917(_0x4a70e5,_0x51c3a1){_0x4a70e5=_0x4a70e5-0x123;const _0x5acce0=a108_0x5acc();let _0x2917f5=_0x5acce0[_0x4a70e5];return _0x2917f5;}function a108_0x5acc(){const _0x9444a6=['2590528girJlN','Skill\x20file\x20bytes\x20must\x20be\x20a\x20Buffer:\x20','6634160vhbvYj','isDirectory','3104326scLiuX','Skill\x20file\x20content\x20must\x20be\x20text\x20or\x20bytes:\x20','Duplicate\x20Skill\x20file\x20path:\x20','23218459tnYjYo','utf8','1650KUVELr','includes','startsWith','isSafeInteger','isSymbolicLink','values','compare','Skill\x20directory\x20contains\x20unsupported\x20symlink:\x20','Skill\x20file\x20path\x20must\x20be\x20text.','size','isBuffer','has','split','12WhxbOf','push','content','84CkvylT','18465surVuX','length','set','bytes','9UrsMBC','3IFIvlB','537912BtoMya','string','Skill\x20file\x20sha256\x20is\x20invalid:\x20','267753wFKYsV','sort','name','path','Unsafe\x20Skill\x20file\x20path:\x20','toString','validation','from','test','replace'];a108_0x5acc=function(){return _0x9444a6;};return a108_0x5acc();}export function normalizeSkillRelativePath(_0xd103a8){const _0x27ae84=toPosixPath(_0xd103a8['trim']());return validateSkillRelativePath(_0x27ae84),_0x27ae84;}export function validateSkillRelativePath(_0x157515){const _0x3775fb=a108_0x2917;if(!_0x157515||_0x157515[_0x3775fb(0x12d)]('/')||_0x157515[_0x3775fb(0x12c)]('//'))throw CliErrors[_0x3775fb(0x14b)](_0x3775fb(0x149)+_0x157515);for(const _0x19ad6f of _0x157515[_0x3775fb(0x137)]('/')){if(!_0x19ad6f||_0x19ad6f==='.'||_0x19ad6f==='..')throw CliErrors[_0x3775fb(0x14b)](_0x3775fb(0x149)+_0x157515);}}export function toPosixPath(_0x44d765){const _0x57c0fa=a108_0x2917;return _0x44d765[_0x57c0fa(0x14e)](/\\/g,'/');}export function isSha256Hex(_0x275b69){const _0x504d93=a108_0x2917;return typeof _0x275b69===_0x504d93(0x143)&&/^[a-fA-F0-9]{64}$/[_0x504d93(0x14d)](_0x275b69);}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { MaterializedRuntimeSkill, RuntimeSkillItem, RuntimeSkillScope, SkillSyncPathsOptions } from "./types.js";
|
|
2
|
+
/** Materializes one downloaded runtime Skill package into the managed cache. */
|
|
3
|
+
export declare function materializeRuntimeSkill(skill: RuntimeSkillItem, scope: RuntimeSkillScope, options: {
|
|
4
|
+
env: "production" | "development" | "daily";
|
|
5
|
+
accessKey: string;
|
|
6
|
+
appCode: string;
|
|
7
|
+
pulledAt?: string;
|
|
8
|
+
paths?: SkillSyncPathsOptions;
|
|
9
|
+
force?: boolean;
|
|
10
|
+
packageBytes?: Buffer;
|
|
11
|
+
}): MaterializedRuntimeSkill;
|