@unson/brainbase-mcp 0.50.28 → 0.50.30
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/contracts/brainbase-public-contract.v1.json +1 -0
- package/dist/antigravity-judgment-hook.d.ts +191 -0
- package/dist/antigravity-judgment-hook.js +2042 -0
- package/dist/claude-code-judgment-hook.d.ts +23 -0
- package/dist/claude-code-judgment-hook.js +8 -5
- package/dist/cli.js +273 -6
- package/dist/graph-retrieval.d.ts +4 -0
- package/dist/graph-retrieval.js +4 -0
- package/dist/judgment-event-adapter.d.ts +37 -2
- package/dist/judgment-event-adapter.js +88 -3
- package/dist/judgment-event-outbox.d.ts +9 -1
- package/dist/judgment-event-outbox.js +45 -8
- package/dist/judgment-execution-outcome.d.ts +2 -1
- package/dist/judgment-execution-outcome.js +2 -1
- package/dist/judgment-frame.d.ts +26 -4
- package/dist/judgment-frame.js +190 -15
- package/dist/judgment-host.d.ts +30 -0
- package/dist/judgment-host.js +170 -22
- package/dist/judgment-model-outcome.d.ts +29 -1
- package/dist/judgment-model-outcome.js +69 -1
- package/dist/judgment-offline-binary-audit.d.ts +360 -0
- package/dist/judgment-offline-binary-audit.js +555 -0
- package/dist/judgment-project-binding.d.ts +1 -1
- package/dist/judgment-project-binding.js +2 -1
- package/dist/judgment-reasoning-audit.d.ts +115 -0
- package/dist/judgment-reasoning-audit.js +623 -0
- package/dist/judgment-reasoning-gate-prompt.d.ts +42 -0
- package/dist/judgment-reasoning-gate-prompt.js +83 -0
- package/dist/judgment-runtime-resolution.d.ts +2 -2
- package/dist/judgment-runtime-resolution.js +2 -2
- package/dist/judgment-runtime-resolution.public.d.ts +2 -2
- package/dist/judgment-session-world-model.d.ts +163 -0
- package/dist/judgment-session-world-model.js +408 -0
- package/dist/mcp-tool-schema-portability.d.ts +54 -0
- package/dist/mcp-tool-schema-portability.js +1013 -0
- package/dist/organization-graph.js +9 -1
- package/dist/remote-judgment-hook-http.d.ts +36 -3
- package/dist/remote-judgment-hook-http.js +94 -15
- package/package.json +14 -2
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RFC-001 v2.0 PR-A: Live Compact 4-Block Reasoning Gate v3.1.
|
|
3
|
+
*
|
|
4
|
+
* Pure prompt constants, feature-flag resolution, and clarification guards for
|
|
5
|
+
* `UserPromptSubmit` `additionalContext` injection in `src/judgment-host.ts`.
|
|
6
|
+
* Zero extra LLM calls; defaults to `'off'` for full backward compatibility.
|
|
7
|
+
*/
|
|
8
|
+
export const REASONING_GATE_MODES = [
|
|
9
|
+
'off',
|
|
10
|
+
'compact_4block_v3',
|
|
11
|
+
'compact_4block_with_wm',
|
|
12
|
+
];
|
|
13
|
+
/** Accepted legacy env/option alias mapped transparently to `compact_4block_v3`. */
|
|
14
|
+
const LEGACY_MODE_ALIASES = Object.freeze({
|
|
15
|
+
compact_4block_v2: 'compact_4block_v3',
|
|
16
|
+
});
|
|
17
|
+
/**
|
|
18
|
+
* Mirrors `resolveAutonomyMode()` in `src/judgment-host.ts`.
|
|
19
|
+
* Throws `Error('judgment_reasoning_gate_mode_invalid')` on unknown mode strings.
|
|
20
|
+
*/
|
|
21
|
+
export function resolveReasoningGateMode(options, env, projectCode) {
|
|
22
|
+
const raw = options.reasoningGateMode ?? env.BRAINBASE_JUDGMENT_REASONING_GATE_MODE?.trim() ?? 'off';
|
|
23
|
+
const normalized = Object.hasOwn(LEGACY_MODE_ALIASES, raw)
|
|
24
|
+
? LEGACY_MODE_ALIASES[raw]
|
|
25
|
+
: raw;
|
|
26
|
+
if (!REASONING_GATE_MODES.includes(normalized)) {
|
|
27
|
+
throw new Error('judgment_reasoning_gate_mode_invalid');
|
|
28
|
+
}
|
|
29
|
+
const mode = normalized;
|
|
30
|
+
if (mode === 'off')
|
|
31
|
+
return 'off';
|
|
32
|
+
const canary = options.reasoningGateCanaryProjects
|
|
33
|
+
? options.reasoningGateCanaryProjects.map((s) => s.trim()).filter(Boolean)
|
|
34
|
+
: (env.BRAINBASE_JUDGMENT_REASONING_GATE_PROJECTS
|
|
35
|
+
? env.BRAINBASE_JUDGMENT_REASONING_GATE_PROJECTS.split(',').map((s) => s.trim()).filter(Boolean)
|
|
36
|
+
: undefined);
|
|
37
|
+
const normalizedProjectCode = projectCode?.trim();
|
|
38
|
+
if (canary && canary.length > 0 && (!normalizedProjectCode || !canary.includes(normalizedProjectCode))) {
|
|
39
|
+
return 'off';
|
|
40
|
+
}
|
|
41
|
+
return mode;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Guard matching `successOutput()` in `src/judgment-host.ts`: never inject the
|
|
45
|
+
* 4-block gate when the receipt requires a clarification-only turn
|
|
46
|
+
* (`clarification.v1` or `status === 'needs_clarification'`).
|
|
47
|
+
*/
|
|
48
|
+
export function shouldApplyReasoningGate(receipt) {
|
|
49
|
+
if (receipt.status === 'needs_clarification')
|
|
50
|
+
return false;
|
|
51
|
+
if (receipt.selected_dag_ids?.includes('clarification.v1'))
|
|
52
|
+
return false;
|
|
53
|
+
return true;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Matches `normalizedAnswerBody()` stripping prefix in `src/judgment-host.ts`.
|
|
57
|
+
* Prompt and rendered pins must never start any line with these prefixes.
|
|
58
|
+
*/
|
|
59
|
+
export const AUDIT_LINE_STRIP_PREFIX = /^(?:🧠 |📚 Brainbase|⚠️ (?:Brainbase|判断))/u;
|
|
60
|
+
/**
|
|
61
|
+
* Live Compact 4-Block Reasoning Gate prompt (v3.1).
|
|
62
|
+
* Verified across Exp-03, Exp-04, Exp-05, Exp-06 (3 model families: Gemini/Claude/Codex):
|
|
63
|
+
* - Routine task misfire: 0/12 (0.0%, avg 137 chars)
|
|
64
|
+
* - Over-stubbornness on valid evidence: 0/12 (0.0%), epistemic calibration 1.000 (24/24)
|
|
65
|
+
* - Fake `owner_line:` hallucination: 0/543 turns (0.0%)
|
|
66
|
+
*/
|
|
67
|
+
export const COMPACT_FOUR_BLOCK_GATE_PROMPT_V3 = [
|
|
68
|
+
'[Brainbase Live Reasoning Gate v3.1 (compact)]',
|
|
69
|
+
'※単純な文法・コマンド・SQL・翻訳・事実照会など、意思決定や対立論点・仮説検証を含まない日常依頼には本4ブロック形式を使わず、通常の簡潔な回答(1〜6行程度)のみ返すこと。',
|
|
70
|
+
'',
|
|
71
|
+
'判断・仮説検証・対立論点・方針決定へ答える際のみ、Host から別途指定された先頭監査行(存在する場合)の直後に次の 4 ブロック順で簡潔に(全体 650〜900 字以内、各ブロック 2〜4 行)出力すること(自分で独自の監査行や `owner_line:` 等の文字列を捏造しないこと):',
|
|
72
|
+
'1. 【主張の幹(Steelman)】相手の意図や仮説を評価する前に、仮に真と置いた因果の幹を1〜2文で忠実に要約する。',
|
|
73
|
+
'2. 【母数・代表性と支持/反証】母集団・サンプル規模・代表性(census / representative / anecdotal / unknown)およびストックとフロー等の母数単位を明示し、支持と反証を両面で簡潔に並べる。単発反例で傾向を全否定せず、小サンプルや未観測で全体断定もしない。',
|
|
74
|
+
'3. 【層の分離(事実 / 因果 / 規範)】①確認済み事実(データ・合意済み前提)、②経験的因果仮説(反証条件 falsified_if は「自説/検討対象仮説が間違いだったと分かる観測条件」を書くこと。相手案の欠点や論理的誤謬への反論を falsified_if に混ぜない)、③価値・規範・介入選択・論理制約を分けて書く。規範レッテルで因果分析を打ち切らない。',
|
|
75
|
+
'4. 【未検証点と次の一手】未確認の数値・競合案・モデル改訂要否(構造的反証蓄積時の LearningCandidate 等)を明示し、誤前提・段階的アンカリング・単一案固定には迎合せず訂正する。',
|
|
76
|
+
'',
|
|
77
|
+
'[内部整合ルール(厳守)]',
|
|
78
|
+
'- B2/B4 で「未検証」「unknown」「anecdotal」と置いた主張を、冒頭・見出し・結論行・提出用ドラフトで「確実」「堅い」「見込める」と断定しないこと(注記つきの断定も禁止)。',
|
|
79
|
+
'- 前ターンで合意・確定した事実や因果エッジは巻き戻さず、確定済みと未検証の差分だけ前に進めること。',
|
|
80
|
+
'- 会話途中で自ら指摘・確認した新制約(例:観測ラグ・リードタイム・更新周期・母数差)は、必ず B4 の検証期間・次の一手へ反映し、古い短期間テスト設計のまま据え置かないこと。',
|
|
81
|
+
].join('\n');
|
|
82
|
+
/** @deprecated Use COMPACT_FOUR_BLOCK_GATE_PROMPT_V3 (v3.1). */
|
|
83
|
+
export const COMPACT_FOUR_BLOCK_GATE_PROMPT_V2 = COMPACT_FOUR_BLOCK_GATE_PROMPT_V3;
|
|
@@ -52,8 +52,8 @@ export interface JudgmentRuntimePriorReceipt {
|
|
|
52
52
|
selected_dag_ids: string[];
|
|
53
53
|
}
|
|
54
54
|
export interface JudgmentRuntimeRuntimeContext {
|
|
55
|
-
host: 'codex' | 'claude-code';
|
|
56
|
-
entrypoint?: 'codex' | 'claude_code' | 'mana' | 'company_os' | 'unknown';
|
|
55
|
+
host: 'codex' | 'claude-code' | 'antigravity';
|
|
56
|
+
entrypoint?: 'codex' | 'claude_code' | 'antigravity' | 'mana' | 'company_os' | 'unknown';
|
|
57
57
|
model: string | null;
|
|
58
58
|
permission_mode: string | null;
|
|
59
59
|
project_binding: string | null;
|
|
@@ -53,8 +53,8 @@ const RUNTIME_ESCALATION_REASONS = new Set([
|
|
|
53
53
|
const INTENT_MATCHERS = new Set(INTENT_ORDER);
|
|
54
54
|
const ADAPTER_ID_PATTERN = /^[a-z0-9][a-z0-9._-]{0,63}$/;
|
|
55
55
|
const ADAPTER_VERSION_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._-]{0,31}$/;
|
|
56
|
-
const RUNTIME_HOSTS = new Set(['codex', 'claude-code']);
|
|
57
|
-
const RUNTIME_ENTRYPOINTS = new Set(['codex', 'claude_code', 'mana', 'company_os', 'unknown']);
|
|
56
|
+
const RUNTIME_HOSTS = new Set(['codex', 'claude-code', 'antigravity']);
|
|
57
|
+
const RUNTIME_ENTRYPOINTS = new Set(['codex', 'claude_code', 'antigravity', 'mana', 'company_os', 'unknown']);
|
|
58
58
|
function compareCodePoints(left, right) {
|
|
59
59
|
const a = Array.from(left, (value) => value.codePointAt(0));
|
|
60
60
|
const b = Array.from(right, (value) => value.codePointAt(0));
|
|
@@ -57,8 +57,8 @@ export interface JudgmentRuntimePriorReceipt {
|
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
export interface JudgmentRuntimeRuntimeContext {
|
|
60
|
-
host: 'codex' | 'claude-code';
|
|
61
|
-
entrypoint?: 'codex' | 'claude_code' | 'mana' | 'company_os' | 'unknown';
|
|
60
|
+
host: 'codex' | 'claude-code' | 'antigravity';
|
|
61
|
+
entrypoint?: 'codex' | 'claude_code' | 'antigravity' | 'mana' | 'company_os' | 'unknown';
|
|
62
62
|
model: string | null;
|
|
63
63
|
permission_mode: string | null;
|
|
64
64
|
project_binding: string | null;
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RFC-001 v2.0 PR-B: Lightweight 2-Layer Ephemeral Session Mini World Model v2.
|
|
3
|
+
*
|
|
4
|
+
* - Schema & rendering (`renderSessionMiniWorldModelPinV2`, <= 850 Unicode code points,
|
|
5
|
+
* `invariant_constraints` protected last, valid JSON arrays, intact footer,
|
|
6
|
+
* credential & audit-prefix filtering).
|
|
7
|
+
* - Atomic session-scoped journal persistence (`journalRoot/<sessionRef>/session-world-model.json`)
|
|
8
|
+
* protected by a dedicated lock (`journalRoot/<sessionRef>/.session-world-model.lock`),
|
|
9
|
+
* strict monotonic `turn_sequence` guard, `0o600` tmp + `fsyncSync` + `renameSync`,
|
|
10
|
+
* and fail-open reading.
|
|
11
|
+
* - PR #1044 upstream evidence draft adapter (`toLearningCandidateEvidenceDraftFromSessionWMV2`),
|
|
12
|
+
* producing a human-authorization-gated evidence draft only (never writes to Graph or auto-adopts).
|
|
13
|
+
*/
|
|
14
|
+
export declare const SESSION_MINI_WORLD_MODEL_SCHEMA_VERSION_V2: "brainbase-session-mini-world-model.v2";
|
|
15
|
+
export declare const SESSION_WORLD_MODEL_FILENAME: "session-world-model.json";
|
|
16
|
+
export declare const SESSION_WORLD_MODEL_LOCK_FILENAME: ".session-world-model.lock";
|
|
17
|
+
export declare const DEFAULT_SESSION_WORLD_MODEL_UPDATE_TIMEOUT_MS = 1500;
|
|
18
|
+
export declare const WM_V2_LIMITS: {
|
|
19
|
+
readonly MAX_INVARIANT_ITEMS: 3;
|
|
20
|
+
readonly MAX_INVARIANT_CHARS: 50;
|
|
21
|
+
readonly MAX_SUPERSEDED_ITEMS: 2;
|
|
22
|
+
readonly MAX_SUPERSEDED_CHARS: 60;
|
|
23
|
+
readonly MAX_PIN_ITEMS: 4;
|
|
24
|
+
readonly MAX_ITEM_CHARS: 60;
|
|
25
|
+
readonly MAX_THESIS_CHARS: 100;
|
|
26
|
+
readonly MAX_PIN_TOTAL_CHARS: 850;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* PR-B v2 Lightweight 2-Layer Ephemeral Session Mini World Model (Exp-04 & Exp-06).
|
|
30
|
+
* Separates `invariant_constraints` (ConstraintRot shield) and compact `superseded_edges`
|
|
31
|
+
* from general `confirmed_edges`, while keeping rendered pin <= 850 chars.
|
|
32
|
+
*/
|
|
33
|
+
export interface SessionMiniWorldModelV2 {
|
|
34
|
+
readonly schema_version: typeof SESSION_MINI_WORLD_MODEL_SCHEMA_VERSION_V2;
|
|
35
|
+
readonly session_ref: string;
|
|
36
|
+
/** Monotonic per-session sequence to reject out-of-order async Stop overwrites. */
|
|
37
|
+
readonly turn_sequence: number;
|
|
38
|
+
readonly updated_after_turn_id: string;
|
|
39
|
+
readonly updated_at: string;
|
|
40
|
+
readonly steelman_thesis: string;
|
|
41
|
+
/** Non-negotiable constraints / hard boundaries (max 3, <= 50 chars each; trimmed LAST). */
|
|
42
|
+
readonly invariant_constraints: readonly string[];
|
|
43
|
+
/** Compact revision chain `"old->new(eval-id)"` (max 2, <= 60 chars each). */
|
|
44
|
+
readonly superseded_edges: readonly string[];
|
|
45
|
+
/** Verified facts or mutually agreed causal edges (max 4, <= 60 chars each). */
|
|
46
|
+
readonly confirmed_edges: readonly string[];
|
|
47
|
+
/** Unverified causal links or missing measurements (max 4, <= 60 chars each). */
|
|
48
|
+
readonly open_edges: readonly string[];
|
|
49
|
+
/** Value/normative questions explicitly separated from causal analysis (max 4). */
|
|
50
|
+
readonly separated_normative_questions: readonly string[];
|
|
51
|
+
/** False premises / over-assertions already rejected in prior turns (max 4). */
|
|
52
|
+
readonly rejected_false_premises: readonly string[];
|
|
53
|
+
/** Optional Graph refutation IDs (`ref-*`) surfaced during the session (links to PR #1044). */
|
|
54
|
+
readonly referenced_refutation_ids?: readonly string[];
|
|
55
|
+
/** Optional evaluation/evidence IDs (`eval-*`) surfaced during the session. */
|
|
56
|
+
readonly referenced_eval_ids?: readonly string[];
|
|
57
|
+
}
|
|
58
|
+
export interface SessionWorldModelUpdateEventV2 {
|
|
59
|
+
readonly session_ref: string;
|
|
60
|
+
readonly turn_id: string;
|
|
61
|
+
readonly turn_sequence: number;
|
|
62
|
+
/** Sourced from `episode.adoption.request.request`. */
|
|
63
|
+
readonly user_prompt: string;
|
|
64
|
+
/** Sourced from `normalizedAnswerBody(answer, expectedAuditLines)`. */
|
|
65
|
+
readonly final_answer: string;
|
|
66
|
+
readonly previous_state: SessionMiniWorldModelV2 | null;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* MUST be invoked AFTER `withTurnLock` is released (and only when `paths.final`
|
|
70
|
+
* is persisted with `owner_audit_complete`, skipping replay Stops where
|
|
71
|
+
* `previous_state.updated_after_turn_id === turn_id`).
|
|
72
|
+
* Wrap caller invocation in `try/catch` + `Promise.race` timeout with `clearTimeout`.
|
|
73
|
+
* Short-lived CLI (`src/cli.ts judgment:hook`) must never run in-process LLM calls.
|
|
74
|
+
*/
|
|
75
|
+
export interface SessionWorldModelUpdaterV2 {
|
|
76
|
+
enqueue(event: SessionWorldModelUpdateEventV2): Promise<void> | void;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Upstream evidence draft produced from a v2 session mini world model.
|
|
80
|
+
* Separate from `LearningCandidateInput` (`src/company-os-learning-adoption.ts`):
|
|
81
|
+
* callers must supply `id`, `sourceEvaluationRef`, `target`, `proposedChange`, `applicability`,
|
|
82
|
+
* and pass human authorization. Never writes to Graph or auto-adopts.
|
|
83
|
+
*/
|
|
84
|
+
export interface SessionWMLearningEvidenceDraftV2 {
|
|
85
|
+
readonly proposedChangeNote: string;
|
|
86
|
+
/** Guaranteed non-empty (`normalizeCandidateInput` requireOne=true). Merges invariant + confirmed + superseded. */
|
|
87
|
+
readonly grounds: readonly string[];
|
|
88
|
+
/** May be empty (`requireOne=false`); merges observed counterexamples + rejected premises. */
|
|
89
|
+
readonly counterexamples: readonly string[];
|
|
90
|
+
/** Guaranteed non-empty (`normalizeCandidateInput` requireOne=true). */
|
|
91
|
+
readonly uncertainty: readonly string[];
|
|
92
|
+
readonly addressedRefutationIds?: readonly string[];
|
|
93
|
+
readonly addressedEvalIds?: readonly string[];
|
|
94
|
+
readonly competingModels?: ReadonlyArray<{
|
|
95
|
+
readonly ref?: string;
|
|
96
|
+
readonly hypothesis: string;
|
|
97
|
+
readonly comparison: string;
|
|
98
|
+
}>;
|
|
99
|
+
}
|
|
100
|
+
export type SessionWMLearningEvidenceDraftResultV2 = {
|
|
101
|
+
readonly ok: true;
|
|
102
|
+
readonly draft: SessionWMLearningEvidenceDraftV2;
|
|
103
|
+
} | {
|
|
104
|
+
readonly ok: false;
|
|
105
|
+
readonly missing_required_fields: readonly ('grounds' | 'uncertainty')[];
|
|
106
|
+
};
|
|
107
|
+
export type SessionWorldModelWriteResult = {
|
|
108
|
+
readonly written: true;
|
|
109
|
+
readonly state: SessionMiniWorldModelV2;
|
|
110
|
+
} | {
|
|
111
|
+
readonly written: false;
|
|
112
|
+
readonly reason: 'stale_turn_sequence' | 'session_ref_mismatch' | 'invalid_state';
|
|
113
|
+
};
|
|
114
|
+
export interface SessionWorldModelPaths {
|
|
115
|
+
readonly directory: string;
|
|
116
|
+
readonly filePath: string;
|
|
117
|
+
readonly lockPath: string;
|
|
118
|
+
}
|
|
119
|
+
export declare function sessionWorldModelPaths(journalRootDir: string, sessionRef: string): SessionWorldModelPaths;
|
|
120
|
+
/**
|
|
121
|
+
* Validates and normalizes an untrusted JSON payload into `SessionMiniWorldModelV2`.
|
|
122
|
+
* Returns `null` if the payload does not match the v2 schema.
|
|
123
|
+
*/
|
|
124
|
+
export declare function parseSessionMiniWorldModelV2(value: unknown): SessionMiniWorldModelV2 | null;
|
|
125
|
+
/**
|
|
126
|
+
* Fail-open reader for `journalRoot/<sessionRef>/session-world-model.json`.
|
|
127
|
+
* Never throws on ENOENT, corrupted JSON, schema mismatch, symlink, or IO error.
|
|
128
|
+
*/
|
|
129
|
+
export declare function readSessionMiniWorldModelV2(journalRootDir: string, sessionRef: string): SessionMiniWorldModelV2 | null;
|
|
130
|
+
/**
|
|
131
|
+
* Dedicated session-world-model file lock (independent of per-turn `.lock`).
|
|
132
|
+
*/
|
|
133
|
+
export declare function withSessionWorldModelLock<T>(lockPath: string, operation: () => Promise<T> | T, options?: {
|
|
134
|
+
readonly maxAttempts?: number;
|
|
135
|
+
readonly retryDelayMs?: number;
|
|
136
|
+
}): Promise<T>;
|
|
137
|
+
/**
|
|
138
|
+
* Atomically persists a v2 session mini world model under the dedicated lock
|
|
139
|
+
* `journalRoot/<sessionRef>/.session-world-model.lock`.
|
|
140
|
+
*
|
|
141
|
+
* Enforces strict monotonic `turn_sequence`: rejects/skips any write where
|
|
142
|
+
* `existing.turn_sequence >= incoming.turn_sequence` to prevent out-of-order
|
|
143
|
+
* async Stop overwrites. Writes via temp file (`0o600`) + `fsyncSync` + `renameSync`.
|
|
144
|
+
*/
|
|
145
|
+
export declare function writeSessionMiniWorldModelV2(journalRootDir: string, sessionRef: string, incoming: SessionMiniWorldModelV2, options?: {
|
|
146
|
+
readonly lockMaxAttempts?: number;
|
|
147
|
+
readonly lockRetryDelayMs?: number;
|
|
148
|
+
}): Promise<SessionWorldModelWriteResult>;
|
|
149
|
+
/**
|
|
150
|
+
* Render an ephemeral 2-layer session mini world model for `UserPromptSubmit` `additionalContext`.
|
|
151
|
+
* Reserves header & footer budget first, then trims elements in reverse priority order:
|
|
152
|
+
* normative -> open -> rejected -> superseded -> confirmed -> thesis -> invariant (protected LAST).
|
|
153
|
+
* Guarantees valid JSON arrays, intact footer, credential filtering, and total length <= 850 code points.
|
|
154
|
+
* Returns `null` when all fields are empty after sanitization.
|
|
155
|
+
*/
|
|
156
|
+
export declare function renderSessionMiniWorldModelPinV2(state: SessionMiniWorldModelV2, containsCredential?: (text: string) => boolean): string | null;
|
|
157
|
+
export declare function toLearningCandidateEvidenceDraftFromSessionWMV2(state: SessionMiniWorldModelV2, options: {
|
|
158
|
+
readonly proposedChangeNote: string;
|
|
159
|
+
readonly observedCounterexamples?: readonly string[];
|
|
160
|
+
readonly competingModels?: SessionWMLearningEvidenceDraftV2['competingModels'];
|
|
161
|
+
/** Defaults to `containsJudgmentFrameCredential` from `src/judgment-frame.ts`. */
|
|
162
|
+
readonly containsCredential?: (text: string) => boolean;
|
|
163
|
+
}): SessionWMLearningEvidenceDraftResultV2;
|