fix(types): wire plugin package metadata

This commit is contained in:
Vincent Koc
2026-05-04 03:36:36 -07:00
parent 97d35f4c57
commit 57f9a558e4
2 changed files with 9 additions and 10 deletions

View File

@@ -39,7 +39,7 @@ function resolveTargetAgent(
}
function formatTimestamp(value: number | undefined): string | undefined {
if (!Number.isFinite(value)) {
if (typeof value !== "number" || !Number.isFinite(value)) {
return undefined;
}
return new Date(value).toISOString();
@@ -56,6 +56,9 @@ function summarizeProfile(params: {
profile: AuthProfileCredential;
usage?: ProfileUsageStats;
}): AuthProfileSummary {
const expiresAt = resolveProfileExpiry(params.profile);
const cooldownUntil = formatTimestamp(params.usage?.cooldownUntil);
const disabledUntil = formatTimestamp(params.usage?.disabledUntil);
return {
id: params.profileId,
provider: normalizeProviderId(params.profile.provider),
@@ -67,15 +70,9 @@ function summarizeProfile(params: {
}),
...(params.profile.email ? { email: params.profile.email } : {}),
...(params.profile.displayName ? { displayName: params.profile.displayName } : {}),
...(resolveProfileExpiry(params.profile)
? { expiresAt: resolveProfileExpiry(params.profile) }
: {}),
...(formatTimestamp(params.usage?.cooldownUntil)
? { cooldownUntil: formatTimestamp(params.usage?.cooldownUntil) }
: {}),
...(formatTimestamp(params.usage?.disabledUntil)
? { disabledUntil: formatTimestamp(params.usage?.disabledUntil) }
: {}),
...(expiresAt ? { expiresAt } : {}),
...(cooldownUntil ? { cooldownUntil } : {}),
...(disabledUntil ? { disabledUntil } : {}),
};
}

View File

@@ -11,6 +11,7 @@ export function createPluginRecord(params: {
name?: string;
description?: string;
version?: string;
packageName?: string;
format?: PluginFormat;
bundleFormat?: PluginBundleFormat;
bundleCapabilities?: string[];
@@ -32,6 +33,7 @@ export function createPluginRecord(params: {
name: params.name ?? params.id,
description: params.description,
version: params.version,
packageName: params.packageName,
format: params.format ?? "openclaw",
bundleFormat: params.bundleFormat,
bundleCapabilities: params.bundleCapabilities,