@buildaharness/aielia 0.3.4 → 0.3.5
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.
- package/README.md +63 -20
- package/dist/PlanGraphPane.d.ts +19 -0
- package/dist/_memory-core-generated.d.ts +1764 -0
- package/dist/agent-loop.d.ts +23 -8
- package/dist/ambiguity-guard-flag.d.ts +12 -0
- package/dist/ambiguity-guard.d.ts +20 -0
- package/dist/answer-claim.d.ts +13 -1
- package/dist/ask-clarification-service.d.ts +12 -1
- package/dist/ask-response-format.d.ts +6 -0
- package/dist/assistant-session.d.ts +12 -1
- package/dist/assistant-source.d.ts +7 -0
- package/dist/assistant-types.d.ts +17 -1
- package/dist/assistant.d.ts +128 -6
- package/dist/benchmark-injected-failure.d.ts +6 -0
- package/dist/bin-CjKpxDxl.js +4836 -0
- package/dist/bin-CjKpxDxl.js.map +1 -0
- package/dist/cli-session.d.ts +14 -1
- package/dist/cli.d.ts +17 -2
- package/dist/cli.js +1 -1
- package/dist/code-plan-templates.d.ts +21 -0
- package/dist/config.d.ts +29 -0
- package/dist/constraint-check.d.ts +35 -0
- package/dist/contradiction-checker.d.ts +7 -0
- package/dist/decomposed-answer.d.ts +13 -0
- package/dist/decomposition-classifier.d.ts +2 -0
- package/dist/doctor-checks.d.ts +3 -0
- package/dist/episodic-digest.d.ts +89 -0
- package/dist/fact-extraction.d.ts +39 -0
- package/dist/file-tools-mcp-server.mjs +138 -12
- package/dist/file-tools.d.ts +4 -0
- package/dist/first-run.d.ts +0 -2
- package/dist/goal-graph-store.d.ts +18 -18
- package/dist/grounding-check.d.ts +33 -0
- package/dist/harness-bridge.d.ts +75 -2
- package/dist/harness-token-budget.d.ts +9 -0
- package/dist/index.d.ts +20 -1
- package/dist/index.js +165 -94
- package/dist/index.js.map +1 -1
- package/dist/layer-policy-flag.d.ts +13 -0
- package/dist/layer-policy-wiring.d.ts +77 -0
- package/dist/layer-settings.d.ts +49 -0
- package/dist/layer-telemetry.d.ts +2 -0
- package/dist/lexical/lexical-mode.d.ts +29 -0
- package/dist/memory-consolidation.d.ts +80 -0
- package/dist/memory-governance.d.ts +30 -0
- package/dist/memory-reviewer.d.ts +114 -0
- package/dist/memory-service.d.ts +348 -9
- package/dist/model-json.d.ts +17 -0
- package/dist/next-step-context.d.ts +51 -0
- package/dist/next-step-proposer.d.ts +3 -2
- package/dist/plan-graph-flag.d.ts +20 -0
- package/dist/plan-question.d.ts +60 -0
- package/dist/plan-service.d.ts +6 -2
- package/dist/plan-step-prompt.d.ts +15 -0
- package/dist/plan-store.d.ts +7 -1
- package/dist/plan-viz/normalize.d.ts +14 -0
- package/dist/plan-viz/plan-detail-lines.d.ts +3 -0
- package/dist/plan-viz/plan-layout.d.ts +48 -0
- package/dist/plan-viz/plan-nav.d.ts +29 -0
- package/dist/plan-viz/plan-raster.d.ts +36 -0
- package/dist/plan-viz/plan-routes.d.ts +6 -0
- package/dist/plan-viz/plan-snapshot.d.ts +73 -0
- package/dist/plan-viz/plan-viewport.d.ts +29 -0
- package/dist/plan-viz/plan-width.d.ts +15 -0
- package/dist/plan-viz/testkit/display-width.d.ts +12 -0
- package/dist/plan-viz/testkit/generators.d.ts +61 -0
- package/dist/plan-viz/testkit/grid-oracles.d.ts +38 -0
- package/dist/plan-viz/testkit/nav-oracles.d.ts +79 -0
- package/dist/plan-viz/testkit/types.d.ts +8 -0
- package/dist/plan-viz/types.d.ts +34 -0
- package/dist/{provider-setup-CPbB5y_V.js → provider-setup-LFsaTkpf.js} +9308 -5510
- package/dist/provider-setup-LFsaTkpf.js.map +1 -0
- package/dist/recall-tool.d.ts +43 -0
- package/dist/recovery-note.d.ts +22 -0
- package/dist/response-service.d.ts +11 -1
- package/dist/review-checker.d.ts +10 -4
- package/dist/reviewer-revision.d.ts +23 -0
- package/dist/risk-classifier.d.ts +7 -0
- package/dist/scripted-llm-client.d.ts +26 -1
- package/dist/semantic-compaction.d.ts +15 -0
- package/dist/semantic-hypotheses.d.ts +40 -0
- package/dist/source-reliability.d.ts +71 -0
- package/dist/task-completion-check.d.ts +24 -0
- package/dist/tool-control-plane.d.ts +33 -1
- package/dist/tool-effect-class.d.ts +9 -0
- package/dist/transcript-compaction.d.ts +9 -0
- package/dist/{tui-app-DeyZ4Pr9.js → tui-app-BLR-PRFp.js} +321 -7
- package/dist/tui-app-BLR-PRFp.js.map +1 -0
- package/dist/tui-app.d.ts +38 -0
- package/dist/turn-intent-classifier.d.ts +75 -16
- package/dist/turn-interpreter.d.ts +25 -3
- package/dist/version.d.ts +1 -1
- package/package.json +6 -6
- package/dist/bin-CdVTAe7j.js +0 -2209
- package/dist/bin-CdVTAe7j.js.map +0 -1
- package/dist/provider-setup-CPbB5y_V.js.map +0 -1
- package/dist/tui-app-DeyZ4Pr9.js.map +0 -1
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export declare const LEXICAL_FAMILIES: readonly ["fact-markers", "coding-fact", "injection", "enumeration", "risk", "task-cancel", "plan-mode", "batch-list", "tool-yield", "template-keywords"];
|
|
2
|
+
export type LexicalFamily = (typeof LEXICAL_FAMILIES)[number];
|
|
3
|
+
/** The families `lexicalMode: 'disabled'` (the default) switches off: all of them. */
|
|
4
|
+
export declare const LEXICAL_CHECK_FAMILIES: readonly LexicalFamily[];
|
|
5
|
+
export type LexicalMode = 'enabled' | 'disabled';
|
|
6
|
+
export declare const DEFAULT_LEXICAL_MODE: LexicalMode;
|
|
7
|
+
type EnvLike = Record<string, string | undefined>;
|
|
8
|
+
export declare function isLexicalFamily(v: string): v is LexicalFamily;
|
|
9
|
+
/** Unset/empty ⇒ default silently; an unrecognized value ⇒ default with a warning. */
|
|
10
|
+
export declare function resolveLexicalMode(env?: EnvLike): LexicalMode;
|
|
11
|
+
/** Every family currently switched off: named in OFF, or not named in ON while the mode is disabled. */
|
|
12
|
+
export declare function resolveLexicalOff(env?: EnvLike): ReadonlySet<LexicalFamily>;
|
|
13
|
+
/** True only if this family is switched on. */
|
|
14
|
+
export declare function lexicalActive(family: LexicalFamily, env?: EnvLike): boolean;
|
|
15
|
+
/**
|
|
16
|
+
* The off families as a comma list, for handing to an out-of-process helper (the MCP server). Always
|
|
17
|
+
* pass it, even empty: the helper reads an unset variable as "every family off" (the default) and an
|
|
18
|
+
* empty one as "none off".
|
|
19
|
+
*/
|
|
20
|
+
export declare function lexicalOffEnvValue(env?: EnvLike): string;
|
|
21
|
+
/**
|
|
22
|
+
* Hands this mode to the harness package's own lexical switch (`setHarnessLexicalMode`), so
|
|
23
|
+
* `ASSISTANT_LEXICAL_MODE=enabled` turns the harness's checks back on too. Works in a browser as well
|
|
24
|
+
* as in Node (it sets no environment variable), and an explicit HARNESS_LEXICAL_MODE /
|
|
25
|
+
* HARNESS_LEXICAL_ON / HARNESS_LEXICAL_OFF still wins inside the harness. Called at the start of every
|
|
26
|
+
* harness run.
|
|
27
|
+
*/
|
|
28
|
+
export declare function syncHarnessLexicalEnv(env?: EnvLike): void;
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { ILLMClient, TokenUsage } from '@buildaharness/runtime';
|
|
2
|
+
import { UserFact } from './fact-extraction.js';
|
|
3
|
+
/**
|
|
4
|
+
* Memory consolidation and staged forgetting (M5 of the agent memory framework plan).
|
|
5
|
+
*
|
|
6
|
+
* Pure pieces only: the flag, the retention window, the bounded model pass that PROPOSES changes, and
|
|
7
|
+
* the deterministic archive-candidate rule. Applying a proposal lives in MemoryService (the only
|
|
8
|
+
* place allowed to write the durable store, through `commitDurable`). Nothing here writes anything.
|
|
9
|
+
*
|
|
10
|
+
* D2: no lexical similarity anywhere. Whether two facts overlap is the model's judgement; the only
|
|
11
|
+
* deterministic rule is on the usage fields M1 added (timestamps and counters), never on text.
|
|
12
|
+
*/
|
|
13
|
+
/** `AUDIT_MEMORY_CONSOLIDATION`: default OFF; `1/true/on/yes/enabled` enables. Read fresh each call. */
|
|
14
|
+
export declare function memoryConsolidationEnabled(env?: Record<string, string | undefined>): boolean;
|
|
15
|
+
/** D4: retention window, start 90 days, to be calibrated. `AUDIT_MEMORY_RETENTION_DAYS` overrides (a positive number). */
|
|
16
|
+
export declare const DEFAULT_MEMORY_RETENTION_DAYS = 90;
|
|
17
|
+
export declare function memoryRetentionDays(env?: Record<string, string | undefined>): number;
|
|
18
|
+
export type ProposalKind = 'merge' | 'supersede' | 'tighten' | 'archive';
|
|
19
|
+
/** A staged change waiting for the user (`/memory consolidate accept|dismiss <n>`). Nothing here has been applied. */
|
|
20
|
+
export interface ConsolidationProposal {
|
|
21
|
+
id: string;
|
|
22
|
+
kind: ProposalKind;
|
|
23
|
+
/** `text|extractedAt` ids of the durable facts the proposal touches. */
|
|
24
|
+
factIds: string[];
|
|
25
|
+
/** merge/tighten: the replacement wording. */
|
|
26
|
+
text?: string;
|
|
27
|
+
/** supersede: the id of the fact that replaces the retired ones in meaning (informational). */
|
|
28
|
+
by?: string;
|
|
29
|
+
reason: string;
|
|
30
|
+
createdAt: string;
|
|
31
|
+
/** True when any touched fact is `user_asserted`: the user said it themselves, so the UI must say so. */
|
|
32
|
+
touchesUserAsserted: boolean;
|
|
33
|
+
}
|
|
34
|
+
export interface ConsolidationState {
|
|
35
|
+
/** Highest audit seq already considered. The audit log's rotation keeps everything newer than this. */
|
|
36
|
+
lastSeq: number;
|
|
37
|
+
at?: string;
|
|
38
|
+
nextProposalNo?: number;
|
|
39
|
+
/** Signatures of proposals the user dismissed, so the same proposal is not raised again. */
|
|
40
|
+
dismissed?: string[];
|
|
41
|
+
}
|
|
42
|
+
export interface RawProposal {
|
|
43
|
+
kind: 'merge' | 'supersede' | 'tighten';
|
|
44
|
+
refs: string[];
|
|
45
|
+
text?: string;
|
|
46
|
+
by?: string;
|
|
47
|
+
reason: string;
|
|
48
|
+
}
|
|
49
|
+
export interface ConsolidationInput {
|
|
50
|
+
facts: Array<{
|
|
51
|
+
ref: string;
|
|
52
|
+
text: string;
|
|
53
|
+
source: string;
|
|
54
|
+
key?: string;
|
|
55
|
+
injectedCount?: number;
|
|
56
|
+
lastInjectedAt?: string;
|
|
57
|
+
}>;
|
|
58
|
+
recentChanges: Array<{
|
|
59
|
+
op: string;
|
|
60
|
+
text: string;
|
|
61
|
+
}>;
|
|
62
|
+
budget: {
|
|
63
|
+
usedChars: number;
|
|
64
|
+
budgetChars: number;
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
export declare const CONSOLIDATION_SYSTEM_PROMPT: string;
|
|
68
|
+
/**
|
|
69
|
+
* One bounded call proposing merges, supersessions and tightenings. Returns the validated proposals,
|
|
70
|
+
* or `undefined` when the call failed or its answer was unusable (the caller then changes nothing,
|
|
71
|
+
* not even the watermark, so the next run retries). Anything the model returns that does not name
|
|
72
|
+
* real refs, repeats a ref, or has the wrong shape for its kind is dropped individually.
|
|
73
|
+
*/
|
|
74
|
+
export declare function proposeConsolidationOps(input: ConsolidationInput, llmClient: ILLMClient, model?: string, onUsage?: (usage: TokenUsage) => void): Promise<RawProposal[] | undefined>;
|
|
75
|
+
/**
|
|
76
|
+
* Deterministic archive rule over M1's usage fields, never over text: a live fact whose last sign of
|
|
77
|
+
* use (`lastInjectedAt`, else when it was stated) is older than the retention window. "Injected" means
|
|
78
|
+
* "was in the prompt", which is weaker than "was used"; the proposal says so rather than claiming usage.
|
|
79
|
+
*/
|
|
80
|
+
export declare function findArchiveCandidates(facts: UserFact[], nowMs: number, windowDays: number): UserFact[];
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { UserFact } from './fact-extraction.js';
|
|
2
|
+
/**
|
|
3
|
+
* M6 governance: WHERE a candidate memory write is allowed to land. Pure and structural: it reads
|
|
4
|
+
* the fact's own `source`/`confidence`/`durable` bits and the configured mode, never its wording
|
|
5
|
+
* (D2: no lexical checks). `MemoryService` is the only caller (`memoryWriteMode` is resolved in
|
|
6
|
+
* MemoryService only), so no writer can pick its own route.
|
|
7
|
+
*
|
|
8
|
+
* - `auto` model-inferred in-turn facts follow today's confidence policy; cross-turn writers
|
|
9
|
+
* (digest/reviewer/consolidation, M3/M4/M5) may add durable facts directly.
|
|
10
|
+
* - `staged` (default, D1) in-turn writer keeps today's policy; every cross-turn writer is
|
|
11
|
+
* staged in the pending queue. Nothing is auto-deleted.
|
|
12
|
+
* - `user_only` the model never creates a durable fact on its own: every model-inferred candidate
|
|
13
|
+
* that would have been durable waits in the pending queue for `/memory confirm`.
|
|
14
|
+
* Facts the user stated in their own words (`user_asserted`) are the user writing.
|
|
15
|
+
*/
|
|
16
|
+
export type MemoryWriteMode = 'auto' | 'staged' | 'user_only';
|
|
17
|
+
export declare const MEMORY_WRITE_MODES: readonly MemoryWriteMode[];
|
|
18
|
+
export declare const DEFAULT_MEMORY_WRITE_MODE: MemoryWriteMode;
|
|
19
|
+
/**
|
|
20
|
+
* Which writer produced the candidate. `in_turn` is the classifier/lexical pass that already
|
|
21
|
+
* exists. The other three are EXTENSION POINTS owned by later phases: M3 digests (`digest`), M4's
|
|
22
|
+
* post-turn reviewer (`reviewer`), M5 consolidation proposals (`consolidation`). They are routed
|
|
23
|
+
* by `MemoryService.submitCandidate()` and are not built here.
|
|
24
|
+
*/
|
|
25
|
+
export type MemoryWriter = 'in_turn' | 'digest' | 'reviewer' | 'consolidation';
|
|
26
|
+
export type CrossTurnWriter = Exclude<MemoryWriter, 'in_turn'>;
|
|
27
|
+
export type WriteRoute = 'durable' | 'pending' | 'session';
|
|
28
|
+
/** Unknown / absent values resolve to the default instead of throwing: a typo must never silently widen write authority. */
|
|
29
|
+
export declare function resolveMemoryWriteMode(raw: unknown): MemoryWriteMode;
|
|
30
|
+
export declare function resolveWriteRoute(mode: MemoryWriteMode, writer: MemoryWriter, fact: Pick<UserFact, 'source' | 'durable' | 'confidence'>): WriteRoute;
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { ChatMessage, ILLMClient, TokenUsage } from '@buildaharness/runtime';
|
|
2
|
+
import { MemoryService, StageReviewerResult } from './memory-service.js';
|
|
3
|
+
import { UserFact, CandidateJudgement } from './fact-extraction.js';
|
|
4
|
+
import { FactCategory } from './turn-intent-classifier.js';
|
|
5
|
+
/**
|
|
6
|
+
* M4 of the agent memory framework plan: a post-turn, cross-turn memory reviewer. The in-turn writer already catches a
|
|
7
|
+
* fact stated in one message; the only thing this adds is aggregation across turns (a preference enforced by repetition,
|
|
8
|
+
* a decision that held). It reads the session's USER messages only (the injected memory block stripped), proposes typed
|
|
9
|
+
* operations, has each judged by a bounded semantic verifier, and hands the survivors to `MemoryService.stageReviewerOps`,
|
|
10
|
+
* which stages them in the pending queue with their evidence (decision D1). No keyword, regex or substring judgement of
|
|
11
|
+
* natural language anywhere here: language is judged by the two model calls, structure by plain code.
|
|
12
|
+
*
|
|
13
|
+
* Integration point for M3 (episodic digests): `ReviewerInput.digests` is accepted and passed to the reviewer as
|
|
14
|
+
* additional context but nothing populates it yet; M3's session-edge digest can feed it without changing this module.
|
|
15
|
+
*/
|
|
16
|
+
/** `AUDIT_MEMORY_REVIEWER`: default **OFF** (opt-in layer; M4 always ships off). `1`/`true`/`on`/`yes`/`enabled` enables. */
|
|
17
|
+
export declare function memoryReviewerEnabled(env?: Record<string, string | undefined>): boolean;
|
|
18
|
+
/** `AUDIT_MEMORY_REVIEWER_VERIFY`: the bounded verifier call. Default ON when the reviewer runs; a falsy value skips it (the negative control: ops are then staged unverified). */
|
|
19
|
+
export declare function memoryReviewerVerifyEnabled(env?: Record<string, string | undefined>): boolean;
|
|
20
|
+
/** `AUDIT_MEMORY_REVIEWER_EVERY`: review every N user turns. Default 5 (to be calibrated in the pilot). */
|
|
21
|
+
export declare const DEFAULT_REVIEW_EVERY = 5;
|
|
22
|
+
export declare function memoryReviewerEvery(env?: Record<string, string | undefined>): number;
|
|
23
|
+
/** Most operations one review may stage; a bound on the output, not a language judgement. */
|
|
24
|
+
export declare const MAX_REVIEW_OPS = 5;
|
|
25
|
+
export type ReviewScope = 'general' | 'this_context';
|
|
26
|
+
export type ReviewVerification = 'supported' | 'unsupported' | 'not_checked';
|
|
27
|
+
/** One typed operation the reviewer proposes. `evidence` is the user's own words; it is stored and shown, never string-matched. */
|
|
28
|
+
export interface ReviewOp {
|
|
29
|
+
kind: 'upsert' | 'retire' | 'noop';
|
|
30
|
+
/** upsert: stable model-chosen key for a single-valued attribute (M1 supersession). */
|
|
31
|
+
key?: string;
|
|
32
|
+
/** upsert: the claim, phrased to preserve what the user said ("asked for X in this context" unless they stated a general preference). */
|
|
33
|
+
text?: string;
|
|
34
|
+
/** retire: the `id` of the existing fact (from the list the reviewer was shown) to propose retiring. */
|
|
35
|
+
targetId?: number;
|
|
36
|
+
evidence?: string;
|
|
37
|
+
scope?: ReviewScope;
|
|
38
|
+
category?: FactCategory;
|
|
39
|
+
judgement?: CandidateJudgement;
|
|
40
|
+
}
|
|
41
|
+
export interface VerifiedReviewOp extends ReviewOp {
|
|
42
|
+
verification: ReviewVerification;
|
|
43
|
+
/** Verifier's one-line reason when it said unsupported. */
|
|
44
|
+
reason?: string;
|
|
45
|
+
}
|
|
46
|
+
export interface ReviewerInput {
|
|
47
|
+
/** The session transcript; only `user` messages are read as claims. */
|
|
48
|
+
transcript: readonly ChatMessage[];
|
|
49
|
+
/** Block last injected into the prompt; removed verbatim from every user message (feedback-loop prevention). */
|
|
50
|
+
injectedBlock: string;
|
|
51
|
+
/** Current durable facts, shown to the reviewer so a retire can name its target. `id` is the index the reviewer uses. */
|
|
52
|
+
existingFacts: readonly {
|
|
53
|
+
id: number;
|
|
54
|
+
text: string;
|
|
55
|
+
source: string;
|
|
56
|
+
}[];
|
|
57
|
+
/** M3 integration point: episodic digests of earlier sessions, context only. Unused until M3 lands. */
|
|
58
|
+
digests?: readonly string[];
|
|
59
|
+
}
|
|
60
|
+
/** The user-only digest the reviewer sees: recent turns verbatim, older turns clipped, memory block stripped, total bounded. Pure formatting, no language judgement. */
|
|
61
|
+
export declare function buildUserDigest(transcript: readonly ChatMessage[], injectedBlock: string): string[];
|
|
62
|
+
/** One bounded reviewer call. Returns no ops (never throws) on any error or unparseable output: a failed review writes nothing. */
|
|
63
|
+
export declare function proposeMemoryOps(input: ReviewerInput, llmClient: ILLMClient, model?: string, onUsage?: (usage: TokenUsage) => void): Promise<ReviewOp[]>;
|
|
64
|
+
/**
|
|
65
|
+
* One bounded verifier call (same shape as grounding-check.ts, fail-open): is each op supported by the user's messages, at
|
|
66
|
+
* the stated scope, and not a generalisation of a one-off request. Fail-open: an error, an unparseable answer or a missing
|
|
67
|
+
* verdict leaves the op `not_checked` (it still only reaches the pending queue, never durable memory).
|
|
68
|
+
*/
|
|
69
|
+
export declare function verifyMemoryOps(ops: readonly ReviewOp[], input: ReviewerInput, llmClient: ILLMClient, model?: string, onUsage?: (usage: TokenUsage) => void): Promise<VerifiedReviewOp[]>;
|
|
70
|
+
/** The facts the reviewer must read through `UserFact` shape — re-exported so the staging method has one type to take. */
|
|
71
|
+
export type ReviewerFact = UserFact;
|
|
72
|
+
/**
|
|
73
|
+
* Trigger bookkeeping: a per-session counter of user turns since the last memory write (or review). Fires on the Nth
|
|
74
|
+
* turn; a turn in which any memory write occurred resets it (the in-turn writer is already doing the job). Pure state,
|
|
75
|
+
* no timers: it can only fire when `noteTurn` is called after a turn finished, so it never fires during a turn.
|
|
76
|
+
*/
|
|
77
|
+
export declare class ReviewTrigger {
|
|
78
|
+
private readonly every;
|
|
79
|
+
private counts;
|
|
80
|
+
constructor(every?: () => number);
|
|
81
|
+
noteTurn(sessionId: string, wroteMemoryThisTurn: boolean): boolean;
|
|
82
|
+
reset(sessionId: string): void;
|
|
83
|
+
count(sessionId: string): number;
|
|
84
|
+
}
|
|
85
|
+
export interface ReviewRunResult {
|
|
86
|
+
proposed: number;
|
|
87
|
+
stage: StageReviewerResult | undefined;
|
|
88
|
+
/** The run was aborted (a new turn began) before it wrote anything. */
|
|
89
|
+
aborted: boolean;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Orchestrates one review: reviewer call, verifier call, staging. Owns the trigger counter and the single in-flight run,
|
|
93
|
+
* which `abort()` cancels (checked between every await and again immediately before the writes, so an abort leaves no
|
|
94
|
+
* partial write). Never throws. LLM usage is reported through `onUsage`, which the host folds into the session's spend.
|
|
95
|
+
*/
|
|
96
|
+
export declare class MemoryReviewer {
|
|
97
|
+
private readonly memoryService;
|
|
98
|
+
private readonly llmClient;
|
|
99
|
+
private readonly model;
|
|
100
|
+
private readonly getTranscript;
|
|
101
|
+
readonly trigger: ReviewTrigger;
|
|
102
|
+
private controller;
|
|
103
|
+
private inFlight;
|
|
104
|
+
constructor(memoryService: MemoryService, llmClient: ILLMClient, model: () => string | undefined, getTranscript: (sessionId: string) => Promise<ChatMessage[]>);
|
|
105
|
+
/** Cancels the run in progress, if any (a new user turn began). */
|
|
106
|
+
abort(): void;
|
|
107
|
+
/** Resolves when the run in progress (if any) has finished; for hosts that must not exit mid-review and for tests. */
|
|
108
|
+
settled(): Promise<void>;
|
|
109
|
+
/** Starts a review off the caller's critical path and returns immediately. */
|
|
110
|
+
start(sessionId: string, onUsage?: (u: TokenUsage) => void): void;
|
|
111
|
+
/** Runs a review to completion (session edge). */
|
|
112
|
+
runNow(sessionId: string, onUsage?: (u: TokenUsage) => void): Promise<ReviewRunResult>;
|
|
113
|
+
private run;
|
|
114
|
+
}
|