mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 15:30:43 +00:00
fix: resolve voice-call SecretRef inputs (#73632)
Co-authored-by: Peter Steinberger <steipete@gmail.com>
This commit is contained in:
@@ -147,6 +147,60 @@ describe("resolvePluginConfigContractsById", () => {
|
||||
);
|
||||
});
|
||||
|
||||
it("refreshes stale bundled SecretInput contracts from bundled metadata", () => {
|
||||
mocks.loadPluginManifestRegistryForInstalledIndex.mockReturnValue(
|
||||
createRegistry([
|
||||
createPluginRecord({
|
||||
id: "voice-call",
|
||||
origin: "bundled",
|
||||
configContracts: {
|
||||
compatibilityMigrationPaths: ["plugins.entries.voice-call.config"],
|
||||
secretInputs: {
|
||||
paths: [{ path: "twilio.authToken", expected: "string" }],
|
||||
},
|
||||
},
|
||||
}),
|
||||
]),
|
||||
);
|
||||
mocks.findBundledPluginMetadataById.mockReturnValue({
|
||||
manifest: {
|
||||
configContracts: {
|
||||
secretInputs: {
|
||||
paths: [
|
||||
{ path: "twilio.authToken", expected: "string" },
|
||||
{ path: "realtime.providers.*.apiKey", expected: "string" },
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
expect(
|
||||
resolvePluginConfigContractsById({
|
||||
pluginIds: ["voice-call"],
|
||||
fallbackToBundledMetadataForResolvedBundled: true,
|
||||
}),
|
||||
).toEqual(
|
||||
new Map([
|
||||
[
|
||||
"voice-call",
|
||||
{
|
||||
origin: "bundled",
|
||||
configContracts: {
|
||||
compatibilityMigrationPaths: ["plugins.entries.voice-call.config"],
|
||||
secretInputs: {
|
||||
paths: [
|
||||
{ path: "twilio.authToken", expected: "string" },
|
||||
{ path: "realtime.providers.*.apiKey", expected: "string" },
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
]),
|
||||
);
|
||||
});
|
||||
|
||||
it("can hydrate missing contracts for plugin ids known to be bundled by runtime discovery", () => {
|
||||
mocks.loadPluginManifestRegistryForInstalledIndex.mockReturnValue(
|
||||
createRegistry([
|
||||
|
||||
@@ -143,18 +143,19 @@ export function resolvePluginConfigContractsById(params: {
|
||||
const existing = matches.get(pluginId);
|
||||
const shouldHydrateBundledMatch =
|
||||
existing &&
|
||||
!existing.configContracts.secretInputs &&
|
||||
((params.fallbackToBundledMetadataForResolvedBundled && existing.origin === "bundled") ||
|
||||
fallbackBundledPluginIds.has(pluginId));
|
||||
if (shouldHydrateBundledMatch) {
|
||||
const bundled = findBundledPluginMetadataById(pluginId);
|
||||
if (bundled?.manifest.configContracts?.secretInputs) {
|
||||
if (bundled?.manifest.configContracts) {
|
||||
matches.set(pluginId, {
|
||||
origin: fallbackBundledPluginIds.has(pluginId) ? "bundled" : existing.origin,
|
||||
configContracts: {
|
||||
...bundled.manifest.configContracts,
|
||||
...existing.configContracts,
|
||||
secretInputs: bundled.manifest.configContracts.secretInputs,
|
||||
...(bundled.manifest.configContracts.secretInputs
|
||||
? { secretInputs: bundled.manifest.configContracts.secretInputs }
|
||||
: {}),
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user