mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 05:30:42 +00:00
fix(types): wire plugin package metadata
This commit is contained in:
@@ -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 } : {}),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user