@lcv-ideas-software/cross-review 4.0.7 → 4.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,6 +3,7 @@ export declare const SWEEP_MIN_IDLE_MS: number;
3
3
  export declare class SessionStore {
4
4
  private readonly config;
5
5
  private readonly seqCache;
6
+ private readonly pendingEventWrites;
6
7
  constructor(config: AppConfig);
7
8
  sessionsDir(): string;
8
9
  sessionDir(sessionId: string): string;
@@ -11,20 +12,20 @@ export declare class SessionStore {
11
12
  assertSessionId(sessionId: string): void;
12
13
  private isPathContained;
13
14
  private processAlive;
14
- private sleepSync;
15
15
  private totalsFor;
16
16
  private withSessionLock;
17
- init(task: string, caller: PeerId | "operator", snapshot: PeerProbeResult[], reviewFocus?: string): SessionMeta;
17
+ init(task: string, caller: PeerId | "operator", snapshot: PeerProbeResult[], reviewFocus?: string): Promise<SessionMeta>;
18
18
  markInFlight(sessionId: string, params: {
19
19
  round: number;
20
20
  peers: PeerId[];
21
21
  started_at: string;
22
22
  scope: ConvergenceScope;
23
- }): SessionMeta;
23
+ }): Promise<SessionMeta>;
24
24
  read(sessionId: string): SessionMeta;
25
25
  private peekNextSeq;
26
26
  private commitSeq;
27
- appendEvent(event: RuntimeEvent): void;
27
+ appendEvent(event: RuntimeEvent): Promise<void>;
28
+ flushPendingEvents(): Promise<void>;
28
29
  readEvents(sessionId: string, sinceSeq?: number): SessionEvent[];
29
30
  list(): SessionMeta[];
30
31
  pruneOldSessions(maxAgeDays?: number): {
@@ -33,11 +34,11 @@ export declare class SessionStore {
33
34
  };
34
35
  savePrompt(sessionId: string, round: number, prompt: string): string;
35
36
  saveDraft(sessionId: string, round: number, draft: string): string;
36
- saveGeneration(sessionId: string, round: number, result: GenerationResult, label?: string): string;
37
+ saveGeneration(sessionId: string, round: number, result: GenerationResult, label?: string): Promise<string>;
37
38
  saveFinal(sessionId: string, text: string): string;
38
39
  saveReport(sessionId: string, text: string): string;
39
- savePeerResult(sessionId: string, round: number, result: PeerResult, label?: string): string;
40
- savePeerFailure(sessionId: string, round: number, failure: PeerFailure): string;
40
+ savePeerResult(sessionId: string, round: number, result: PeerResult, label?: string): Promise<string>;
41
+ savePeerFailure(sessionId: string, round: number, failure: PeerFailure): Promise<string>;
41
42
  appendRound(sessionId: string, params: {
42
43
  caller_status: ReviewStatus;
43
44
  draft_file?: string;
@@ -47,51 +48,51 @@ export declare class SessionStore {
47
48
  convergence: ConvergenceResult;
48
49
  convergence_scope: ConvergenceScope;
49
50
  started_at: string;
50
- }): ReviewRound;
51
- markBudgetWarningEmitted(sessionId: string): SessionMeta;
52
- setCircularState(sessionId: string, state: NonNullable<SessionMeta["circular_state"]>): SessionMeta;
51
+ }): Promise<ReviewRound>;
52
+ markBudgetWarningEmitted(sessionId: string): Promise<SessionMeta>;
53
+ setCircularState(sessionId: string, state: NonNullable<SessionMeta["circular_state"]>): Promise<SessionMeta>;
53
54
  setSessionTraceability(sessionId: string, traceability: {
54
55
  requested_max_rounds: number | null;
55
56
  effective_max_rounds: number | null;
56
57
  requested_max_cost_usd: number | null;
57
58
  effective_cost_ceiling_usd: number | null;
58
59
  cost_ceiling_source: "call_arg" | "env_default" | "config_default";
59
- }): SessionMeta;
60
+ }): Promise<SessionMeta>;
60
61
  assertNotFinalized(sessionId: string): void;
61
- finalize(sessionId: string, outcome: NonNullable<SessionMeta["outcome"]>, reason?: string): SessionMeta;
62
- requestCancellation(sessionId: string, reason?: string, jobId?: string): SessionMeta;
63
- markCancelled(sessionId: string, reason?: string): SessionMeta;
62
+ finalize(sessionId: string, outcome: NonNullable<SessionMeta["outcome"]>, reason?: string): Promise<SessionMeta>;
63
+ requestCancellation(sessionId: string, reason?: string, jobId?: string): Promise<SessionMeta>;
64
+ markCancelled(sessionId: string, reason?: string): Promise<SessionMeta>;
64
65
  isCancellationRequested(sessionId: string): boolean;
65
- appendFallbackEvent(sessionId: string, event: NonNullable<SessionMeta["fallback_events"]>[number]): SessionMeta;
66
+ appendFallbackEvent(sessionId: string, event: NonNullable<SessionMeta["fallback_events"]>[number]): Promise<SessionMeta>;
66
67
  appendEvidenceChecklistItems(sessionId: string, round: number, incoming: Array<{
67
68
  peer: PeerId;
68
69
  ask: string;
69
- }>): NonNullable<SessionMeta["evidence_checklist"]>;
70
+ }>): Promise<NonNullable<SessionMeta["evidence_checklist"]>>;
70
71
  static readonly TERMINAL_STATUSES: ReadonlySet<EvidenceChecklistStatus>;
71
- runEvidenceChecklistAddressDetection(sessionId: string, currentRound: number): {
72
+ runEvidenceChecklistAddressDetection(sessionId: string, currentRound: number): Promise<{
72
73
  not_resurfaced: EvidenceChecklistItem[];
73
74
  reopened: EvidenceChecklistItem[];
74
75
  peer_resurfaced_terminal: EvidenceChecklistItem[];
75
- };
76
+ }>;
76
77
  setEvidenceChecklistItemStatus(sessionId: string, itemId: string, status: Exclude<EvidenceChecklistStatus, "addressed" | "not_resurfaced">, options?: {
77
78
  note?: string;
78
79
  by?: "operator" | "runtime";
79
- }): {
80
+ }): Promise<{
80
81
  item: EvidenceChecklistItem;
81
82
  history_entry: EvidenceStatusHistoryEntry;
82
- };
83
+ }>;
83
84
  markEvidenceItemAddressedByJudge(sessionId: string, itemId: string, params: {
84
85
  round: number;
85
86
  rationale: string;
86
87
  judge_peer: PeerId;
87
- }): {
88
+ }): Promise<{
88
89
  item: EvidenceChecklistItem;
89
90
  history_entry: EvidenceStatusHistoryEntry;
90
- } | null;
91
- recoverInterruptedSessions(activeSessionIds?: Set<string>): SessionMeta[];
91
+ } | null>;
92
+ recoverInterruptedSessions(activeSessionIds?: Set<string>): Promise<SessionMeta[]>;
92
93
  aggregateShadowJudgments(sessionId?: string): ShadowJudgmentRollup;
93
94
  metrics(sessionId?: string): RuntimeMetrics;
94
- sessionDoctor(limit?: number, includeLegacy?: boolean, repair?: boolean): SessionDoctorReport;
95
+ sessionDoctor(limit?: number, includeLegacy?: boolean, repair?: boolean): Promise<SessionDoctorReport>;
95
96
  computeJudgmentPrecisionReport(opts?: {
96
97
  peer?: PeerId;
97
98
  since?: string;
@@ -111,24 +112,24 @@ export declare class SessionStore {
111
112
  new_task: string;
112
113
  new_initial_draft?: string;
113
114
  new_caller?: PeerId | "operator";
114
- }): {
115
+ }): Promise<{
115
116
  contested_meta: SessionMeta;
116
117
  new_session_id: string;
117
- };
118
+ }>;
118
119
  attachEvidence(sessionId: string, params: {
119
120
  label: string;
120
121
  content: string;
121
122
  content_type?: string;
122
123
  extension?: string;
123
- }): {
124
+ }): Promise<{
124
125
  path: string;
125
126
  meta: SessionMeta;
126
- };
127
+ }>;
127
128
  escalateToOperator(sessionId: string, params: {
128
129
  reason: string;
129
130
  severity: "info" | "warning" | "critical";
130
- }): SessionMeta;
131
- sweepIdle(idleMs: number, outcome?: "aborted" | "max-rounds", reason?: string): SessionMeta[];
131
+ }): Promise<SessionMeta>;
132
+ sweepIdle(idleMs: number, outcome?: "aborted" | "max-rounds", reason?: string): Promise<SessionMeta[]>;
132
133
  pruneCorruptSessions(minAgeMs: number): {
133
134
  scanned: number;
134
135
  removed: number;
@@ -138,12 +139,12 @@ export declare class SessionStore {
138
139
  scanned: number;
139
140
  removed: number;
140
141
  };
141
- clearStaleInFlight(): {
142
+ clearStaleInFlight(): Promise<{
142
143
  scanned: number;
143
144
  cleared: number;
144
- };
145
- abortStaleSessions(staleHours?: number): {
145
+ }>;
146
+ abortStaleSessions(staleHours?: number): Promise<{
146
147
  scanned: number;
147
148
  aborted: number;
148
- };
149
+ }>;
149
150
  }