UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

3 lines • 2.12 kB
import{l as normalizeOptionalString}from"./string-coerce-CpTFcSwY.mjs";import{n as normalizeClawHubSha256Integrity}from"./clawhub-integrity-Cvu00MBR.mjs";import{G as parseClawHubPluginSpec,W as normalizePluginInstallDefaultChoice}from"./official-external-plugin-catalog-BkSwu5lo.mjs";import{i as isExactSemverVersion,s as parseRegistryNpmSpec}from"./npm-registry-spec-D06XlvdA.mjs"; //!src/plugins/install-source-info.ts function normalizeExpectedPackageName(e){const t=normalizeOptionalString(e);if(!t)return;return parseRegistryNpmSpec(t)?.name??t}function describePluginInstallSource(e,t){const n=normalizeOptionalString(e.clawhubSpec);const r=normalizeOptionalString(e.npmSpec);const i=normalizeOptionalString(e.localPath);const a=normalizePluginInstallDefaultChoice(e.defaultChoice);const o=normalizeOptionalString(e.expectedIntegrity);const s=normalizeExpectedPackageName(t?.expectedPackageName);const c=[];let l;let u;if(e.defaultChoice!==void 0&&!a)c.push(`invalid-default-choice`);if(n){const e=parseClawHubPluginSpec(n);if(e){const t=e.version?isExactSemverVersion(e.version):false;if(!t)c.push(`clawhub-spec-floating`);l={spec:n,packageName:e.name,...e.version?{version:e.version}:{},exactVersion:t}}else c.push(`invalid-clawhub-spec`)}if(r){const e=parseRegistryNpmSpec(r);if(e){const t=e.selectorKind===`exact-version`;const n=Boolean(o);if(!t)c.push(`npm-spec-floating`);if(!n)c.push(`npm-spec-missing-integrity`);if(s&&e.name!==s)c.push(`npm-spec-package-name-mismatch`);u={spec:e.raw,packageName:e.name,...s&&e.name!==s?{expectedPackageName:s}:{},selectorKind:e.selectorKind,exactVersion:t,pinState:`${t?`exact`:`floating`}-${n?`with`:`without`}-integrity`,...e.selector?{selector:e.selector}:{},...o?{expectedIntegrity:o}:{}}}else c.push(`invalid-npm-spec`)}if(a===`clawhub`&&!l||a===`npm`&&!u||a===`local`&&!i)c.push(`default-choice-missing-source`);const d=!r&&l&&o&&normalizeClawHubSha256Integrity(o);if(o&&!u&&!d)c.push(`npm-integrity-without-source`);return{...a?{defaultChoice:a}:{},...l?{clawhub:l}:{},...u?{npm:u}:{},...i?{local:{path:i}}:{},warnings:c}}export{describePluginInstallSource as t};