Files
openclaw/src/commitments/extraction.test-support.ts
Peter Steinberger 3d76a4af92 refactor(deadcode): privatize runtime test seams (#108338)
* 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
2026-07-15 07:27:10 -07:00

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);
}