mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-03 07:42:42 +00:00
* refactor(sessions): privatize runtime test seams * refactor(commitments): privatize extraction test seams * refactor(flows): privatize doctor health seams * refactor(tasks): privatize registry test seams * build(commitments): bundle Docker test support * chore(deadcode): shrink runtime export baseline
41 lines
1.1 KiB
TypeScript
41 lines
1.1 KiB
TypeScript
import type { OpenClawConfig } from "../config/config.js";
|
|
import "./extraction.js";
|
|
import type {
|
|
CommitmentCandidate,
|
|
CommitmentExtractionBatchResult,
|
|
CommitmentExtractionItem,
|
|
} from "./types.js";
|
|
|
|
type ValidatedCommitmentCandidate = {
|
|
item: CommitmentExtractionItem;
|
|
candidate: CommitmentCandidate;
|
|
earliestMs: number;
|
|
latestMs: number;
|
|
timezone: string;
|
|
};
|
|
|
|
type CommitmentExtractionTestApi = {
|
|
validateCommitmentCandidates(params: {
|
|
cfg?: OpenClawConfig;
|
|
items: CommitmentExtractionItem[];
|
|
result: CommitmentExtractionBatchResult;
|
|
nowMs?: number;
|
|
}): ValidatedCommitmentCandidate[];
|
|
};
|
|
|
|
function getTestApi(): CommitmentExtractionTestApi {
|
|
const api = (globalThis as Record<PropertyKey, unknown>)[
|
|
Symbol.for("openclaw.commitmentExtractionTestApi")
|
|
];
|
|
if (!api) {
|
|
throw new Error("commitment extraction test API is unavailable");
|
|
}
|
|
return api as CommitmentExtractionTestApi;
|
|
}
|
|
|
|
export function validateCommitmentCandidates(
|
|
params: Parameters<CommitmentExtractionTestApi["validateCommitmentCandidates"]>[0],
|
|
): ValidatedCommitmentCandidate[] {
|
|
return getTestApi().validateCommitmentCandidates(params);
|
|
}
|