diff --git a/src/commands/onboarding-plugin-install.ts b/src/commands/onboarding-plugin-install.ts index 05c2b5be7c1..d6b9b3b07f9 100644 --- a/src/commands/onboarding-plugin-install.ts +++ b/src/commands/onboarding-plugin-install.ts @@ -11,8 +11,8 @@ import { findBundledPluginSourceInMap, resolveBundledPluginSources, } from "../plugins/bundled-sources.js"; +import { CLAWHUB_INSTALL_ERROR_CODE } from "../plugins/clawhub-error-codes.js"; import { buildClawHubPluginInstallRecordFields } from "../plugins/clawhub-install-records.js"; -import { CLAWHUB_INSTALL_ERROR_CODE } from "../plugins/clawhub.js"; import { enablePluginInConfig, type PluginEnableResult } from "../plugins/enable.js"; import { resolveClawHubInstallSpecsForUpdateChannel, diff --git a/src/plugins/clawhub-error-codes.ts b/src/plugins/clawhub-error-codes.ts new file mode 100644 index 00000000000..0949db4e0f7 --- /dev/null +++ b/src/plugins/clawhub-error-codes.ts @@ -0,0 +1,18 @@ +export const CLAWHUB_INSTALL_ERROR_CODE = { + INVALID_SPEC: "invalid_spec", + PACKAGE_NOT_FOUND: "package_not_found", + VERSION_NOT_FOUND: "version_not_found", + NO_INSTALLABLE_VERSION: "no_installable_version", + SKILL_PACKAGE: "skill_package", + UNSUPPORTED_FAMILY: "unsupported_family", + PRIVATE_PACKAGE: "private_package", + INCOMPATIBLE_PLUGIN_API: "incompatible_plugin_api", + INCOMPATIBLE_GATEWAY: "incompatible_gateway", + ARTIFACT_UNAVAILABLE: "artifact_unavailable", + MISSING_ARCHIVE_INTEGRITY: "missing_archive_integrity", + ARTIFACT_DOWNLOAD_UNAVAILABLE: "artifact_download_unavailable", + ARCHIVE_INTEGRITY_MISMATCH: "archive_integrity_mismatch", +} as const; + +export type ClawHubInstallErrorCode = + (typeof CLAWHUB_INSTALL_ERROR_CODE)[keyof typeof CLAWHUB_INSTALL_ERROR_CODE]; diff --git a/src/plugins/clawhub.ts b/src/plugins/clawhub.ts index edf57c51b9b..50cae607db0 100644 --- a/src/plugins/clawhub.ts +++ b/src/plugins/clawhub.ts @@ -34,28 +34,13 @@ import { formatErrorMessage } from "../infra/errors.js"; import { normalizeOptionalString } from "../shared/string-coerce.js"; import { resolveCompatibilityHostVersion } from "../version.js"; import type { RuntimeVersionEnv } from "../version.js"; +import { CLAWHUB_INSTALL_ERROR_CODE, type ClawHubInstallErrorCode } from "./clawhub-error-codes.js"; import type { ClawHubPluginInstallRecordFields } from "./clawhub-install-records.js"; import type { InstallSafetyOverrides } from "./install-security-scan.js"; import { installPluginFromArchive, type InstallPluginResult } from "./install.js"; -export const CLAWHUB_INSTALL_ERROR_CODE = { - INVALID_SPEC: "invalid_spec", - PACKAGE_NOT_FOUND: "package_not_found", - VERSION_NOT_FOUND: "version_not_found", - NO_INSTALLABLE_VERSION: "no_installable_version", - SKILL_PACKAGE: "skill_package", - UNSUPPORTED_FAMILY: "unsupported_family", - PRIVATE_PACKAGE: "private_package", - INCOMPATIBLE_PLUGIN_API: "incompatible_plugin_api", - INCOMPATIBLE_GATEWAY: "incompatible_gateway", - ARTIFACT_UNAVAILABLE: "artifact_unavailable", - MISSING_ARCHIVE_INTEGRITY: "missing_archive_integrity", - ARTIFACT_DOWNLOAD_UNAVAILABLE: "artifact_download_unavailable", - ARCHIVE_INTEGRITY_MISMATCH: "archive_integrity_mismatch", -} as const; - -export type ClawHubInstallErrorCode = - (typeof CLAWHUB_INSTALL_ERROR_CODE)[keyof typeof CLAWHUB_INSTALL_ERROR_CODE]; +export { CLAWHUB_INSTALL_ERROR_CODE }; +export type { ClawHubInstallErrorCode }; type PluginInstallLogger = { info?: (message: string) => void;