refactor: trim command helper exports

This commit is contained in:
Peter Steinberger
2026-05-02 07:42:43 +01:00
parent 741005001b
commit 3967683049
5 changed files with 7 additions and 33 deletions

View File

@@ -5,11 +5,7 @@ import {
resolveDefaultAgentId,
} from "../agents/agent-scope.js";
import type { AgentIdentityFile } from "../agents/identity-file.js";
import {
identityHasValues,
loadAgentIdentityFromWorkspace,
parseIdentityMarkdown as parseIdentityMarkdownFile,
} from "../agents/identity-file.js";
import { identityHasValues, loadAgentIdentityFromWorkspace } from "../agents/identity-file.js";
import { listRouteBindings } from "../config/bindings.js";
import type { IdentityConfig } from "../config/types.base.js";
import type { OpenClawConfig } from "../config/types.openclaw.js";
@@ -53,10 +49,6 @@ function resolveAgentModel(cfg: OpenClawConfig, agentId: string) {
return resolvePrimaryStringValue(cfg.agents?.defaults?.model);
}
export function parseIdentityMarkdown(content: string): AgentIdentity {
return parseIdentityMarkdownFile(content);
}
export function loadAgentIdentity(workspace: string): AgentIdentity | null {
const parsed = loadAgentIdentityFromWorkspace(workspace);
if (!parsed) {

View File

@@ -37,7 +37,7 @@ export async function requireValidConfig(
return effectiveConfig;
}
export function formatAccountLabel(params: { accountId: string; name?: string }) {
function formatAccountLabel(params: { accountId: string; name?: string }) {
const base = params.accountId || DEFAULT_ACCOUNT_ID;
if (params.name?.trim()) {
return `${base} (${params.name.trim()})`;

View File

@@ -1,5 +1,5 @@
import { getLoadedChannelPlugin } from "../channels/plugins/index.js";
import type { ChannelId, ChannelMessageActionName } from "../channels/plugins/types.public.js";
import type { ChannelId } from "../channels/plugins/types.public.js";
import type { OutboundDeliveryResult } from "../infra/outbound/deliver.js";
import { formatGatewaySummary, formatOutboundDeliverySummary } from "../infra/outbound/format.js";
import type { MessageActionRunResult } from "../infra/outbound/message-action-runner.js";
@@ -33,24 +33,6 @@ function extractMessageId(payload: unknown): string | null {
return null;
}
export type MessageCliJsonEnvelope = {
action: ChannelMessageActionName;
channel: ChannelId;
dryRun: boolean;
handledBy: "plugin" | "core" | "dry-run";
payload: unknown;
};
export function buildMessageCliJson(result: MessageActionRunResult): MessageCliJsonEnvelope {
return {
action: result.action,
channel: result.channel,
dryRun: result.dryRun,
handledBy: result.handledBy,
payload: result.payload,
};
}
type FormatOpts = {
width: number;
};

View File

@@ -37,7 +37,7 @@ export function appendStatusSectionHeading(params: {
params.lines.push(params.heading(params.title));
}
export function appendStatusLinesSection(params: {
function appendStatusLinesSection(params: {
lines: string[];
heading: HeadingFn;
title: string;
@@ -47,7 +47,7 @@ export function appendStatusLinesSection(params: {
params.lines.push(...params.body);
}
export function appendStatusTableSection<Row extends Record<string, string>>(params: {
function appendStatusTableSection<Row extends Record<string, string>>(params: {
lines: string[];
heading: HeadingFn;
title: string;

View File

@@ -122,7 +122,7 @@ function toSystemAuditFindings(params: {
};
}
export function buildTasksListJsonPayload(opts: TasksListJsonArgs) {
function buildTasksListJsonPayload(opts: TasksListJsonArgs) {
const runtimeFilter = opts.runtime?.trim();
const statusFilter = opts.status?.trim();
const tasks = listTaskJsonRecords().filter((task) => {
@@ -142,7 +142,7 @@ export function buildTasksListJsonPayload(opts: TasksListJsonArgs) {
};
}
export function buildTasksAuditJsonPayload(opts: TasksAuditJsonArgs) {
function buildTasksAuditJsonPayload(opts: TasksAuditJsonArgs) {
const severityFilter = opts.severity?.trim() as TaskSystemAuditSeverity | undefined;
const codeFilter = opts.code?.trim() as TaskSystemAuditCode | undefined;
const { allFindings, filteredFindings, taskFindings, summary } = toSystemAuditFindings({