Files
openclaw/src/commitments/types.ts
Vignesh b277ae3f4c [codex] Fix commitments safety and coverage (#75302)
* fix commitments safety and coverage

* Repair commitments safety PR review blockers

* fix(clawsweeper): address review for automerge-openclaw-openclaw-75302 (1)

* Repair commitments safety PR review blocker

---------

Co-authored-by: clawsweeper-repair <clawsweeper-repair@users.noreply.github.com>
2026-05-01 01:14:07 +00:00

93 lines
2.2 KiB
TypeScript

export type CommitmentKind = "event_check_in" | "deadline_check" | "care_check_in" | "open_loop";
export type CommitmentSensitivity = "routine" | "personal" | "care";
export type CommitmentStatus = "pending" | "sent" | "dismissed" | "snoozed" | "expired";
export type CommitmentSource = "inferred_user_context" | "agent_promise";
export type CommitmentScope = {
agentId: string;
sessionKey: string;
channel: string;
accountId?: string;
to?: string;
threadId?: string;
senderId?: string;
};
export type CommitmentDueWindow = {
earliestMs: number;
latestMs: number;
timezone: string;
};
export type CommitmentRecord = CommitmentScope & {
id: string;
kind: CommitmentKind;
sensitivity: CommitmentSensitivity;
source: CommitmentSource;
status: CommitmentStatus;
reason: string;
suggestedText: string;
dedupeKey: string;
confidence: number;
dueWindow: CommitmentDueWindow;
sourceMessageId?: string;
sourceRunId?: string;
/** @deprecated Legacy-only field from early stores. Do not replay this into delivery prompts. */
sourceUserText?: string;
/** @deprecated Legacy-only field from early stores. Do not replay this into delivery prompts. */
sourceAssistantText?: string;
createdAtMs: number;
updatedAtMs: number;
attempts: number;
lastAttemptAtMs?: number;
sentAtMs?: number;
dismissedAtMs?: number;
snoozedUntilMs?: number;
expiredAtMs?: number;
};
export type CommitmentStoreFile = {
version: 1;
commitments: CommitmentRecord[];
};
export type CommitmentCandidate = {
itemId: string;
kind: CommitmentKind;
sensitivity: CommitmentSensitivity;
source: CommitmentSource;
reason: string;
suggestedText: string;
dedupeKey: string;
confidence: number;
dueWindow: {
earliest: string;
latest?: string;
timezone?: string;
};
};
export type CommitmentExtractionItem = CommitmentScope & {
itemId: string;
nowMs: number;
timezone: string;
userText: string;
assistantText?: string;
sourceMessageId?: string;
sourceRunId?: string;
existingPending: Array<{
kind: CommitmentKind;
reason: string;
dedupeKey: string;
earliestMs: number;
latestMs: number;
}>;
};
export type CommitmentExtractionBatchResult = {
candidates: CommitmentCandidate[];
};