fix(plugins): clarify unavailable clawhub artifacts · openclaw/openclaw@cd710bc
vincentkoc
·
2026-05-03
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -12,6 +12,7 @@ Docs: https://docs.openclaw.ai
|
12 | 12 | |
13 | 13 | ### Fixes |
14 | 14 | |
| 15 | +- Plugins/ClawHub: explain unavailable explicit ClawHub ClawPack artifact downloads with a temporary npm install hint while ClawHub artifact routing rolls out. Thanks @vincentkoc. |
15 | 16 | - Onboarding/search: install official external web-search plugins such as Brave before saving provider config, and make doctor repair reconcile selected external search providers whose npm payload is missing. Thanks @vincentkoc. |
16 | 17 | - Plugins/externalization: add official npm-first catalogs for externalized channel, provider, and generic plugins, keep unpublished ACPX/Google Chat/LINE bundled, and make missing-plugin repair honor npm-first metadata while ClawHub pack files roll out. Thanks @vincentkoc. |
17 | 18 | - Plugins/update: detect tracked plugin install records whose package directories disappeared during `openclaw update`, reinstall them before normal plugin updates, and fail the update if any install record still points at missing disk payloads. |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -555,6 +555,49 @@ describe("installPluginFromClawHub", () => {
|
555 | 555 | expect(archiveCleanupMock).toHaveBeenCalledTimes(1); |
556 | 556 | }); |
557 | 557 | |
| 558 | +it("points explicit ClawHub ClawPack download failures at npm during launch rollout", async () => { |
| 559 | +fetchClawHubPackageVersionMock.mockResolvedValueOnce({ |
| 560 | +version: { |
| 561 | +version: "2026.3.22", |
| 562 | +createdAt: 0, |
| 563 | +changelog: "", |
| 564 | +compatibility: { |
| 565 | +pluginApiRange: ">=2026.3.22", |
| 566 | +minGatewayVersion: "2026.3.0", |
| 567 | +}, |
| 568 | +artifact: { |
| 569 | +kind: "npm-pack", |
| 570 | +format: "tgz", |
| 571 | +sha256: DEMO_CLAWPACK_SHA256, |
| 572 | +}, |
| 573 | +}, |
| 574 | +}); |
| 575 | +downloadClawHubPackageArchiveMock.mockRejectedValueOnce( |
| 576 | +new ClawHubRequestError({ |
| 577 | +path: "/api/v1/packages/demo/versions/2026.3.22/artifact/download", |
| 578 | +status: 404, |
| 579 | +body: "Not Found", |
| 580 | +}), |
| 581 | +); |
| 582 | + |
| 583 | +const result = await installPluginFromClawHub({ |
| 584 | +spec: "clawhub:demo", |
| 585 | +baseUrl: "https://clawhub.ai", |
| 586 | +}); |
| 587 | + |
| 588 | +expect(result).toMatchObject({ |
| 589 | +ok: false, |
| 590 | +error: |
| 591 | +'ClawHub artifact download for "demo@2026.3.22" is not available yet (ClawHub /api/v1/packages/demo/versions/2026.3.22/artifact/download failed (404): Not Found). Use "npm:demo@2026.3.22" for launch installs while ClawHub artifact routing is being rolled out.', |
| 592 | +}); |
| 593 | +expect(downloadClawHubPackageArchiveMock).toHaveBeenCalledWith( |
| 594 | +expect.objectContaining({ |
| 595 | +artifact: "clawpack", |
| 596 | +}), |
| 597 | +); |
| 598 | +expect(installPluginFromArchiveMock).not.toHaveBeenCalled(); |
| 599 | +}); |
| 600 | + |
558 | 601 | it("does not persist package-level ClawPack metadata for version records without ClawPack facts", async () => { |
559 | 602 | parseClawHubPluginSpecMock.mockReturnValueOnce({ name: "demo", version: "2026.3.21" }); |
560 | 603 | fetchClawHubPackageDetailMock.mockResolvedValueOnce({ |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -330,6 +330,18 @@ function mapClawHubRequestError(
|
330 | 330 | return buildClawHubInstallFailure(formatErrorMessage(error)); |
331 | 331 | } |
332 | 332 | |
| 333 | +function formatClawHubClawPackDownloadError(params: { |
| 334 | +error: unknown; |
| 335 | +packageName: string; |
| 336 | +version: string; |
| 337 | +}): string { |
| 338 | +const message = formatErrorMessage(params.error); |
| 339 | +if (!(params.error instanceof ClawHubRequestError)) { |
| 340 | +return message; |
| 341 | +} |
| 342 | +return `ClawHub artifact download for "${params.packageName}@${params.version}" is not available yet (${message}). Use "npm:${params.packageName}@${params.version}" for launch installs while ClawHub artifact routing is being rolled out.`; |
| 343 | +} |
| 344 | + |
333 | 345 | function resolveRequestedVersion(params: { |
334 | 346 | detail: ClawHubPackageDetail; |
335 | 347 | requestedVersion?: string; |
@@ -1037,7 +1049,17 @@ export async function installPluginFromClawHub(
|
1037 | 1049 | timeoutMs: params.timeoutMs, |
1038 | 1050 | }); |
1039 | 1051 | } catch (error) { |
1040 | | -return buildClawHubInstallFailure(formatErrorMessage(error)); |
| 1052 | +// Fix-me(clawhub): remove this npm hint once ClawHub ClawPack artifact |
| 1053 | +// routing is live for official package installs. |
| 1054 | +return buildClawHubInstallFailure( |
| 1055 | +expectedClawPackSha256 |
| 1056 | + ? formatClawHubClawPackDownloadError({ |
| 1057 | + error, |
| 1058 | +packageName: canonicalPackageName, |
| 1059 | +version: versionState.version, |
| 1060 | +}) |
| 1061 | + : formatErrorMessage(error), |
| 1062 | +); |
1041 | 1063 | } |
1042 | 1064 | try { |
1043 | 1065 | if (expectedClawPackSha256) { |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。