mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-28 13:26:04 -06:00
fix(plugin-sdk): preserve deprecated public exports
This commit is contained in:
@@ -20,6 +20,7 @@ import {
|
||||
resolveFallbackAgentId,
|
||||
resolveEffectiveModelFallbacks,
|
||||
resolveAgentModelFallbacksOverride,
|
||||
resolveAgentModelPrimary,
|
||||
resolveRunModelFallbacksOverride,
|
||||
resolveSubagentModelConfigSelection,
|
||||
resolveSubagentModelFallbacksOverride,
|
||||
@@ -238,6 +239,7 @@ describe("resolveAgentConfig", () => {
|
||||
},
|
||||
};
|
||||
|
||||
expect(resolveAgentModelPrimary(cfg, "linus")).toBe("anthropic/claude-sonnet-4-6");
|
||||
expect(resolveAgentExplicitModelPrimary(cfg, "linus")).toBe("anthropic/claude-sonnet-4-6");
|
||||
expect(resolveAgentEffectiveModelPrimary(cfg, "linus")).toBe("anthropic/claude-sonnet-4-6");
|
||||
expect(resolveAgentModelFallbacksOverride(cfg, "linus")).toEqual(["openai/gpt-5.4"]);
|
||||
|
||||
@@ -403,6 +403,11 @@ export function setAgentEffectiveModelPrimary(
|
||||
return "defaults";
|
||||
}
|
||||
|
||||
/** @deprecated Prefer explicit/effective helpers at new call sites. */
|
||||
export function resolveAgentModelPrimary(cfg: OpenClawConfig, agentId: string): string | undefined {
|
||||
return resolveAgentExplicitModelPrimary(cfg, agentId);
|
||||
}
|
||||
|
||||
export function resolveAgentModelFallbacksOverride(
|
||||
cfg: OpenClawConfig,
|
||||
agentId: string,
|
||||
|
||||
@@ -6,6 +6,8 @@ import {
|
||||
import { isWellFormedApprovalId } from "../../packages/gateway-protocol/src/schema/approval-id.js";
|
||||
import type { ReplyPayload } from "../auto-reply/types.js";
|
||||
import type {
|
||||
InteractiveReply,
|
||||
InteractiveReplyButton,
|
||||
MessagePresentation,
|
||||
MessagePresentationAction,
|
||||
MessagePresentationButton,
|
||||
@@ -227,6 +229,22 @@ export function buildTypedApprovalActionDescriptors(
|
||||
);
|
||||
}
|
||||
|
||||
function buildApprovalInteractiveButtons(
|
||||
descriptors: readonly ExecApprovalActionDescriptor[],
|
||||
): InteractiveReplyButton[] {
|
||||
return descriptors.map((descriptor) => {
|
||||
const action =
|
||||
descriptor.action ??
|
||||
({ type: "command", command: descriptor.command } satisfies MessagePresentationAction);
|
||||
return {
|
||||
label: descriptor.label,
|
||||
action,
|
||||
...(descriptor.action ? {} : { value: descriptor.command }),
|
||||
style: descriptor.style,
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
function buildApprovalPresentationButtons(
|
||||
descriptors: readonly ExecApprovalActionDescriptor[],
|
||||
): MessagePresentationButton[] {
|
||||
@@ -311,6 +329,16 @@ export function buildTypedExecApprovalPresentation(params: {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use buildApprovalPresentationFromActionDescriptors.
|
||||
*/
|
||||
export function buildApprovalInteractiveReplyFromActionDescriptors(
|
||||
actions: readonly ExecApprovalActionDescriptor[],
|
||||
): InteractiveReply | undefined {
|
||||
const buttons = buildApprovalInteractiveButtons(actions);
|
||||
return buttons.length > 0 ? { blocks: [{ type: "buttons", buttons }] } : undefined;
|
||||
}
|
||||
|
||||
export function getExecApprovalApproverDmNoticeText(): string {
|
||||
return "Approval required. I sent approval DMs to the approvers for this account.";
|
||||
}
|
||||
|
||||
@@ -143,6 +143,19 @@ export function resolveHomeRelativePath(
|
||||
return path.resolve(trimmed);
|
||||
}
|
||||
|
||||
/**
|
||||
* Backward-compatible alias for resolving user paths against the effective home.
|
||||
*
|
||||
* @deprecated Use resolveHomeRelativePath.
|
||||
*/
|
||||
export function resolveUserPath(
|
||||
input: string,
|
||||
env: NodeJS.ProcessEnv = process.env,
|
||||
homedir: () => string = os.homedir,
|
||||
): string {
|
||||
return resolveHomeRelativePath(input, { env, homedir });
|
||||
}
|
||||
|
||||
/** Resolves a user-supplied path against the OS home, ignoring OPENCLAW_HOME. */
|
||||
export function resolveOsHomeRelativePath(
|
||||
input: string,
|
||||
|
||||
Reference in New Issue
Block a user