instar 1.3.661 → 1.3.663

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.
@@ -0,0 +1,63 @@
1
+ /**
2
+ * GateSignalDetectors — §Design 8 of gate-prompts-judge-by-meaning-not-literal-lists
3
+ * (CMT-1793, Phase 2).
4
+ *
5
+ * THE MIGRATION: rules B1–B7 used to LITERAL-match inside the tone-gate PROMPT
6
+ * (a brittle filter wearing the LLM's authority — a paraphrase or an
7
+ * unanticipated form evaded it, and the model's contextual judgment was
8
+ * discarded). The new contract (Intelligent Prompts — An LLM Gate Must Not
9
+ * String-Match) moves the pattern-matching OUT of the prompt: a deterministic
10
+ * detector emits a normalized `GateSignal`, the signal is supplied to the LLM
11
+ * as input/context, and the LLM decides IN CONTEXT what to do with it (e.g. "a
12
+ * file path was detected at span X — is it shown for the user to act on, or
13
+ * mentioned in passing?"). This is the same shape B8/B9/B12/B20 already use.
14
+ *
15
+ * SECURITY (the §Design 8 envelope + clamping contract): every emitted signal
16
+ * is sanitized at the boundary — `kind` validated against the closed
17
+ * `GATE_SIGNAL_KINDS` enum, `confidence` clamped to [0,1], `spans` bounded to
18
+ * the candidate length and dropped if malformed, and `normalizedValue` length-
19
+ * clamped. A `normalizedValue` is UNTRUSTED data describing the candidate (it
20
+ * may itself be attacker-derived — e.g. a "path" containing envelope-breaking
21
+ * characters), so the caller renders the signal list inside its OWN per-call
22
+ * random boundary and the prompt treats every field as data, never an
23
+ * instruction. These detectors NEVER block — they are signal producers; the
24
+ * MessagingToneGate is the single authority (docs/signal-vs-authority.md).
25
+ */
26
+ /** §Design 8: closed set of deterministic-detector signal kinds for B1–B7. */
27
+ export type GateSignalKind = 'cli-command' | 'file-path' | 'config-key' | 'copy-paste-code' | 'api-endpoint' | 'env-var' | 'cron-or-slug';
28
+ /** The closed enum, single-sourced. A kind outside this set is rejected at sanitize. */
29
+ export declare const GATE_SIGNAL_KINDS: readonly GateSignalKind[];
30
+ /** Map each kind → the B-rule it informs (for prompt rendering + the ratchet). */
31
+ export declare const GATE_SIGNAL_KIND_TO_RULE: Record<GateSignalKind, string>;
32
+ /** §Design 8 normalized signal emitted by a B1–B7 deterministic detector. */
33
+ export interface GateSignal {
34
+ kind: GateSignalKind;
35
+ detected: boolean;
36
+ /** Character spans (into the candidate) where the artifact was found. Bounded. */
37
+ spans?: {
38
+ start: number;
39
+ end: number;
40
+ }[];
41
+ /** A short, clamped textual sample of what was detected (UNTRUSTED data). */
42
+ normalizedValue?: string;
43
+ /** Detector self-confidence, clamped to [0,1] at emit. */
44
+ confidence?: number;
45
+ }
46
+ /** Hard caps so an adversarial candidate can't inflate the signal payload. */
47
+ export declare const GATE_SIGNAL_CAPS: {
48
+ readonly maxSpansPerSignal: 8;
49
+ readonly maxNormalizedValueChars: 120;
50
+ };
51
+ /**
52
+ * Sanitize + clamp a single signal at emit (the §Design 8 security contract).
53
+ * Returns null for a structurally invalid signal (unknown kind) so a bad
54
+ * detector can never inject an out-of-enum kind. `candidateLen` bounds spans.
55
+ */
56
+ export declare function sanitizeGateSignal(s: GateSignal, candidateLen: number): GateSignal | null;
57
+ /**
58
+ * Run all B1–B7 detectors over a candidate and return the sanitized signal
59
+ * list (only `detected:true` signals, each clamped per §Design 8). The list is
60
+ * what the caller renders inside its own per-call boundary as untrusted data.
61
+ */
62
+ export declare function detectGateSignals(candidate: string): GateSignal[];
63
+ //# sourceMappingURL=GateSignalDetectors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GateSignalDetectors.d.ts","sourceRoot":"","sources":["../../src/core/GateSignalDetectors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,8EAA8E;AAC9E,MAAM,MAAM,cAAc,GACtB,aAAa,GACb,WAAW,GACX,YAAY,GACZ,iBAAiB,GACjB,cAAc,GACd,SAAS,GACT,cAAc,CAAC;AAEnB,wFAAwF;AACxF,eAAO,MAAM,iBAAiB,EAAE,SAAS,cAAc,EAQ7C,CAAC;AAEX,kFAAkF;AAClF,eAAO,MAAM,wBAAwB,EAAE,MAAM,CAAC,cAAc,EAAE,MAAM,CAQnE,CAAC;AAEF,6EAA6E;AAC7E,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,cAAc,CAAC;IACrB,QAAQ,EAAE,OAAO,CAAC;IAClB,kFAAkF;IAClF,KAAK,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACzC,6EAA6E;IAC7E,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,0DAA0D;IAC1D,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,8EAA8E;AAC9E,eAAO,MAAM,gBAAgB;;;CAGnB,CAAC;AAEX;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI,CAiCzF;AAsHD;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,UAAU,EAAE,CAoBjE"}
@@ -0,0 +1,216 @@
1
+ /**
2
+ * GateSignalDetectors — §Design 8 of gate-prompts-judge-by-meaning-not-literal-lists
3
+ * (CMT-1793, Phase 2).
4
+ *
5
+ * THE MIGRATION: rules B1–B7 used to LITERAL-match inside the tone-gate PROMPT
6
+ * (a brittle filter wearing the LLM's authority — a paraphrase or an
7
+ * unanticipated form evaded it, and the model's contextual judgment was
8
+ * discarded). The new contract (Intelligent Prompts — An LLM Gate Must Not
9
+ * String-Match) moves the pattern-matching OUT of the prompt: a deterministic
10
+ * detector emits a normalized `GateSignal`, the signal is supplied to the LLM
11
+ * as input/context, and the LLM decides IN CONTEXT what to do with it (e.g. "a
12
+ * file path was detected at span X — is it shown for the user to act on, or
13
+ * mentioned in passing?"). This is the same shape B8/B9/B12/B20 already use.
14
+ *
15
+ * SECURITY (the §Design 8 envelope + clamping contract): every emitted signal
16
+ * is sanitized at the boundary — `kind` validated against the closed
17
+ * `GATE_SIGNAL_KINDS` enum, `confidence` clamped to [0,1], `spans` bounded to
18
+ * the candidate length and dropped if malformed, and `normalizedValue` length-
19
+ * clamped. A `normalizedValue` is UNTRUSTED data describing the candidate (it
20
+ * may itself be attacker-derived — e.g. a "path" containing envelope-breaking
21
+ * characters), so the caller renders the signal list inside its OWN per-call
22
+ * random boundary and the prompt treats every field as data, never an
23
+ * instruction. These detectors NEVER block — they are signal producers; the
24
+ * MessagingToneGate is the single authority (docs/signal-vs-authority.md).
25
+ */
26
+ /** The closed enum, single-sourced. A kind outside this set is rejected at sanitize. */
27
+ export const GATE_SIGNAL_KINDS = [
28
+ 'cli-command',
29
+ 'file-path',
30
+ 'config-key',
31
+ 'copy-paste-code',
32
+ 'api-endpoint',
33
+ 'env-var',
34
+ 'cron-or-slug',
35
+ ];
36
+ /** Map each kind → the B-rule it informs (for prompt rendering + the ratchet). */
37
+ export const GATE_SIGNAL_KIND_TO_RULE = {
38
+ 'cli-command': 'B1_CLI_COMMAND',
39
+ 'file-path': 'B2_FILE_PATH',
40
+ 'config-key': 'B3_CONFIG_KEY',
41
+ 'copy-paste-code': 'B4_COPY_PASTE_CODE',
42
+ 'api-endpoint': 'B5_API_ENDPOINT',
43
+ 'env-var': 'B6_ENV_VAR',
44
+ 'cron-or-slug': 'B7_CRON_OR_SLUG',
45
+ };
46
+ /** Hard caps so an adversarial candidate can't inflate the signal payload. */
47
+ export const GATE_SIGNAL_CAPS = {
48
+ maxSpansPerSignal: 8,
49
+ maxNormalizedValueChars: 120,
50
+ };
51
+ /**
52
+ * Sanitize + clamp a single signal at emit (the §Design 8 security contract).
53
+ * Returns null for a structurally invalid signal (unknown kind) so a bad
54
+ * detector can never inject an out-of-enum kind. `candidateLen` bounds spans.
55
+ */
56
+ export function sanitizeGateSignal(s, candidateLen) {
57
+ if (!s || typeof s !== 'object')
58
+ return null;
59
+ if (!GATE_SIGNAL_KINDS.includes(s.kind))
60
+ return null;
61
+ const out = { kind: s.kind, detected: s.detected === true };
62
+ if (typeof s.confidence === 'number' && Number.isFinite(s.confidence)) {
63
+ out.confidence = Math.max(0, Math.min(1, s.confidence));
64
+ }
65
+ if (Array.isArray(s.spans)) {
66
+ const spans = s.spans
67
+ .filter((sp) => sp &&
68
+ Number.isFinite(sp.start) &&
69
+ Number.isFinite(sp.end) &&
70
+ sp.start >= 0 &&
71
+ sp.end >= sp.start &&
72
+ sp.end <= candidateLen)
73
+ .slice(0, GATE_SIGNAL_CAPS.maxSpansPerSignal)
74
+ .map((sp) => ({ start: Math.floor(sp.start), end: Math.floor(sp.end) }));
75
+ if (spans.length > 0)
76
+ out.spans = spans;
77
+ }
78
+ if (typeof s.normalizedValue === 'string' && s.normalizedValue.length > 0) {
79
+ // Length-clamp only; the value is rendered inside the caller's own boundary
80
+ // as untrusted data, so its content is never trusted regardless.
81
+ out.normalizedValue = s.normalizedValue.slice(0, GATE_SIGNAL_CAPS.maxNormalizedValueChars);
82
+ }
83
+ return out;
84
+ }
85
+ // ── The seven deterministic detectors (B1–B7) ────────────────────────────
86
+ // Each returns at most ONE signal for its kind (detected:true with spans +
87
+ // a normalizedValue sample, or simply nothing when not detected). They are
88
+ // high-PRECISION by design: a false "detected" only adds a signal the LLM
89
+ // then judges in context (it is not a block), but needless noise dilutes the
90
+ // signal list, so each pattern targets the artifact shape, not loose prose.
91
+ function collect(re, text, kind,
92
+ // Optional per-match precision filter: return false to DROP a match (so a
93
+ // false-positive shape — a hostname mistaken for a config key, plain
94
+ // hyphenated prose mistaken for a slug — never enters the signal list).
95
+ accept) {
96
+ const spans = [];
97
+ let first = '';
98
+ for (const m of text.matchAll(re)) {
99
+ if (m.index == null)
100
+ continue;
101
+ if (accept && !accept(m[0]))
102
+ continue;
103
+ spans.push({ start: m.index, end: m.index + m[0].length });
104
+ if (!first)
105
+ first = m[0];
106
+ if (spans.length >= GATE_SIGNAL_CAPS.maxSpansPerSignal)
107
+ break;
108
+ }
109
+ if (spans.length === 0)
110
+ return null;
111
+ return { kind, detected: true, spans, normalizedValue: first };
112
+ }
113
+ /** B1 — a shell command (a verb the user would paste into a terminal). */
114
+ function detectCliCommand(text) {
115
+ // Common CLI leaders + a leading "$ " prompt. Word-boundary anchored so prose
116
+ // like "I will run the migration" does not match.
117
+ const re = /(^|\s)(\$ |sudo |npm (run |i |install|test)|pnpm \w|yarn \w|npx \w|git (push|pull|commit|checkout|rebase|merge|clone|fetch|reset)|curl |wget |bash |sh |node \S+\.(mjs|js|ts)|docker \w|kubectl \w|systemctl \w|launchctl \w|brew \w|pip install|cargo \w)/g;
118
+ return collect(re, text, 'cli-command');
119
+ }
120
+ /** B2 — a filesystem path (absolute, home-relative, dot-relative, or src-rooted). */
121
+ function detectFilePath(text) {
122
+ // Require a path separator + a path-ish segment; avoid matching bare prose or URLs.
123
+ const re = /(?<![\w/])(~\/[\w./-]+|\.{1,2}\/[\w./-]+|\/(?:Users|home|tmp|var|etc|opt|usr)\/[\w./-]+|(?:src|dist|tests|docs|node_modules|\.instar|\.claude|\.github)\/[\w./-]+\.[a-zA-Z]{1,5})/g;
124
+ return collect(re, text, 'file-path');
125
+ }
126
+ /** Known TLDs used to exclude hostname-shaped tokens from the config-key detector. */
127
+ const HOSTNAME_TLD = /\.(?:com|org|net|io|dev|ai|co|gov|edu|app|sh|me|info|biz)$/i;
128
+ /** B3 — a dotted config key (e.g. messaging.toneGate.failClosedOnExhaustion). */
129
+ function detectConfigKey(text) {
130
+ // 3+ dotted lowerCamel/snake segments — config paths, not sentences (which
131
+ // have spaces). Anchored so "e.g." or "a.b" prose abbreviations don't match.
132
+ const re = /(?<![\w.])[a-z][a-zA-Z0-9]*(?:\.[a-z][a-zA-Z0-9]*){2,}(?![\w.])/g;
133
+ // Precision: drop hostname-shaped matches. A real config key
134
+ // (messaging.toneGate.x) has a camelCase segment; a hostname is all-lowercase
135
+ // labels ending in a known TLD (or a www. prefix) — that's prose, not a key.
136
+ return collect(re, text, 'config-key', (v) => {
137
+ const looksLikeHost = /^www\./i.test(v) || HOSTNAME_TLD.test(v);
138
+ const hasCamel = /[a-z][A-Z]/.test(v);
139
+ return !(looksLikeHost && !hasCamel);
140
+ });
141
+ }
142
+ /** B4 — pasted code: a fenced block or an obvious code line. */
143
+ function detectCopyPasteCode(text) {
144
+ const fence = collect(/```[\s\S]*?```|`[^`\n]{3,}`/g, text, 'copy-paste-code');
145
+ if (fence)
146
+ return fence;
147
+ // A line that reads like code: assignment/among braces/semicolons/arrows.
148
+ const re = /(^|\n)\s*(const |let |var |function |=>|import |export |return |if \(|for \()/g;
149
+ return collect(re, text, 'copy-paste-code');
150
+ }
151
+ /** B5 — an API endpoint / URL / route path. */
152
+ function detectApiEndpoint(text) {
153
+ const re = /(https?:\/\/[^\s)>\]]+|(?<![\w/])\/(?:telegram|slack|whatsapp|api|sessions|commitments|attention|coherence|pool|threadline|metrics|health|view|secrets|operations|mandate)\/[\w:./-]+)/g;
154
+ return collect(re, text, 'api-endpoint');
155
+ }
156
+ /** B6 — an environment variable (assignment, $REF, or process.env.X). */
157
+ function detectEnvVar(text) {
158
+ const re = /(?<![\w])(?:[A-Z][A-Z0-9]*_[A-Z0-9_]+\s*=|\$[A-Z][A-Z0-9_]{2,}|process\.env\.[A-Z][A-Z0-9_]*)/g;
159
+ return collect(re, text, 'env-var');
160
+ }
161
+ /** B7 — a cron expression or an internal kebab slug / tracker id. */
162
+ function detectCronOrSlug(text) {
163
+ // Cron: 5 whitespace-separated fields of cron tokens.
164
+ const cron = collect(/(?<!\S)(?:[\d*/,-]+\s+){4}[\d*/,-]+(?!\S)/g, text, 'cron-or-slug');
165
+ if (cron)
166
+ return cron;
167
+ // Internal tracker ids / kebab slugs — the kind of internal handle a user
168
+ // can't act on (e.g. CMT-1793, act-155). Upper tracker ids OR 3+-segment
169
+ // lowercase kebab. Precision: the lowercase-kebab branch must contain a DIGIT,
170
+ // so plain hyphenated English prose ("well-thought-out", "state-of-the-art",
171
+ // "fire-and-forget") does NOT fire. (Digit-less internal slugs leaked to a
172
+ // user are caught by the separate B20 internal-id-leak signal, not here.) The
173
+ // uppercase tracker branch already requires a digit.
174
+ const re = /(?<![\w-])(?:[A-Z]{2,5}-\d{2,}|[a-z0-9]+(?:-[a-z0-9]+){2,})(?![\w-])/g;
175
+ return collect(re, text, 'cron-or-slug', (v) => /\d/.test(v));
176
+ }
177
+ const DETECTORS = [
178
+ detectCliCommand,
179
+ detectFilePath,
180
+ detectConfigKey,
181
+ detectCopyPasteCode,
182
+ detectApiEndpoint,
183
+ detectEnvVar,
184
+ detectCronOrSlug,
185
+ ];
186
+ /**
187
+ * Run all B1–B7 detectors over a candidate and return the sanitized signal
188
+ * list (only `detected:true` signals, each clamped per §Design 8). The list is
189
+ * what the caller renders inside its own per-call boundary as untrusted data.
190
+ */
191
+ export function detectGateSignals(candidate) {
192
+ if (typeof candidate !== 'string' || candidate.length === 0)
193
+ return [];
194
+ const len = candidate.length;
195
+ const out = [];
196
+ for (const detect of DETECTORS) {
197
+ let sig = null;
198
+ try {
199
+ sig = detect(candidate);
200
+ }
201
+ catch {
202
+ // @silent-fallback-ok — a detector throwing (pathological input) must
203
+ // never break the gate; a missing signal degrades to meaning-only
204
+ // judgment for that rule, which is the safe direction (no block lost —
205
+ // these are signals the LLM judges, not blockers).
206
+ sig = null;
207
+ }
208
+ if (!sig || !sig.detected)
209
+ continue;
210
+ const clean = sanitizeGateSignal(sig, len);
211
+ if (clean && clean.detected)
212
+ out.push(clean);
213
+ }
214
+ return out;
215
+ }
216
+ //# sourceMappingURL=GateSignalDetectors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GateSignalDetectors.js","sourceRoot":"","sources":["../../src/core/GateSignalDetectors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAYH,wFAAwF;AACxF,MAAM,CAAC,MAAM,iBAAiB,GAA8B;IAC1D,aAAa;IACb,WAAW;IACX,YAAY;IACZ,iBAAi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capacityUnavailable?: boolean;
56
+ /**
57
+ * True when the gate HELD the message (pass=false) because a gating-LLM
58
+ * call dropped its verdict — a provider-exhaustion error, an unparseable
59
+ * response (after one retry), or the route-budget timeout elapsing with no
60
+ * verdict. Fail-CLOSED is the safe direction for a gating decision
61
+ * (No Silent Degradation). Distinct from capacityUnavailable (spawn-cap shed)
62
+ * and failedOpen (legacy permissive drop, now only on the invalid-rule
63
+ * re-prompt's benign branches). Spec: gate-prompts-judge-by-meaning §Design 6.
64
+ */
65
+ failedClosed?: boolean;
66
+ }
67
+ export declare const VALID_RULES: Set<string>;
68
+ /**
69
+ * Rule-class taxonomy (spec: gate-prompts-judge-by-meaning-not-literal-lists §Design 7).
70
+ *
71
+ * The boundary between rules whose prompt may LITERAL-match a deterministic
72
+ * artifact (`deterministic-detection`) and rules that must judge by MEANING
73
+ * (`behavioral-judgment`) is made STRUCTURAL here — a machine-readable source
74
+ * registry, NOT a `//` comment inside the prompt template literal (those would
75
+ * render into the prompt sent to the model). The forward ratchet
76
+ * (tests/unit/gate-prompts-judge-by-meaning.test.ts) keys off this map.
77
+ *
78
+ * Constitution standard: "Intelligent Prompts — An LLM Gate Must Not
79
+ * String-Match" (docs/STANDARDS-REGISTRY.md).
80
+ */
81
+ export type GateRuleClass = 'deterministic-detection' | 'signal-driven' | 'style' | 'health-alert' | 'behavioral-judgment' | 'parked-on-user';
82
+ export declare const RULE_CLASSES: Record<string, GateRuleClass>;
83
+ /**
84
+ * Phase-2 migration (CMT-1793): COMPLETE. B1–B7 were migrated from in-prompt
85
+ * literal-matching to the deterministic-detector-emits-signal contract
86
+ * (GateSignalDetectors.ts, §Design 8); the allowlist is now EMPTY. The const is
87
+ * retained (empty) so the ratchet's anti-phantom assertion has a stable target
88
+ * and a future reader sees the migration landed rather than wondering if it was
89
+ * dropped.
90
+ */
91
+ export declare const PHASE2_MIGRATION_DEBT: {
92
+ rules: readonly [];
93
+ commitment: string;
94
+ };
95
+ /** Deferred availability-aware kind-routing refinement (CMT-1794). Gate is fail-closed-compliant now. */
96
+ export declare const DEFERRED_REFINEMENT: {
97
+ paths: readonly ["provider-exhaustion", "json-parse", "route-budget-timeout"];
98
+ commitment: string;
99
+ };
100
+ /**
101
+ * The §Design 1 structured-intermediate the model emits for a self-stop (B15)
102
+ * judgment. The block/allow VERDICT is derived from these fields, which makes
103
+ * the decision testable and far less dependent on prose interpretation (the
104
+ * answer to the "prompt jurisprudence" concern). Optional — absent on a normal
105
+ * non-B15 verdict, in which case the legacy {pass,rule,issue,suggestion} path
106
+ * is used unchanged.
107
+ */
108
+ export interface StructuredVerdict {
109
+ proposed_stop: boolean;
110
+ deferred_items: string[];
111
+ stop_reason_kind: 'agent-state' | 'external-blocker' | 'design-fork' | 'completion' | 'operator-stop' | 'none' | string;
112
+ agent_state_reason_present: boolean;
113
+ external_blocker_present: boolean;
114
+ }
115
+ export interface ParsedToneResponse {
116
+ pass: boolean;
117
+ rule: string;
118
+ issue: string;
119
+ suggestion: string;
120
+ structured?: StructuredVerdict;
56
121
  }
122
+ /**
123
+ * A structured verdict is internally contradictory (a model-output-discipline
124
+ * failure) when its fields disagree — e.g. "no stop proposed" yet items are
125
+ * deferred, or "agent-state reason present" yet the stop is classified as a
126
+ * completion / none. Contradiction → re-prompt once → fail-closed (§Design 6).
127
+ */
128
+ export declare function structuredContradiction(s: StructuredVerdict): boolean;
57
129
  export interface ToneReviewContextMessage {
58
130
  role: 'user' | 'agent';
59
131
  text: string;
@@ -222,16 +294,86 @@ export interface ToneReviewContext {
222
294
  * scheduled-task sends (stamped by the scheduler env, not the model).
223
295
  */
224
296
  messageKind?: MessageKind;
297
+ /**
298
+ * Deterministic agent-state signal (spec §Design 1a). Detected OUTSIDE the
299
+ * prompt (in-process `readSessionClocks` at the route seam) and fed in as
300
+ * ground truth so B15 can judge a "near the limit" claim against reality
301
+ * instead of the agent's self-assessed prose. SCOPE: time-box claims only —
302
+ * it does NOT ground context-window / fatigue / clarity claims (no signal
303
+ * for those yet; CMT-1793). Absent → B15 falls back to meaning-only (the
304
+ * signal sharpens the verdict, it is never a necessary condition). Rendered
305
+ * in its own per-call boundary, treated as untrusted data.
306
+ */
307
+ agentState?: {
308
+ sessionElapsedMs: number;
309
+ sessionRemainingMs: number | null;
310
+ isTimeBoxed: boolean;
311
+ };
312
+ }
313
+ /** Tune knobs read live from InstarConfig.messaging.toneGate (spec §Design 6). */
314
+ export interface ToneGateConfig {
315
+ /**
316
+ * When true (DEFAULT), the provider-exhaustion and route-budget-timeout paths
317
+ * fail CLOSED (hold). Operator kill-switch: set false to revert THOSE two
318
+ * availability-sensitive paths to fail-open without a deploy (read live). The
319
+ * invalid-rule and JSON-parse fail-closeds are NOT switched (no availability
320
+ * cost — they fire only on a model that already decided to block / emitted
321
+ * unparseable output).
322
+ */
323
+ failClosedOnExhaustion?: boolean;
225
324
  }
226
325
  export declare class MessagingToneGate {
227
326
  private provider;
228
- constructor(provider: IntelligenceProvider);
327
+ private configOrGetter;
328
+ constructor(provider: IntelligenceProvider, config?: ToneGateConfig | (() => ToneGateConfig));
329
+ /** Resolve config live each review so the kill-switch is honored without a restart. */
330
+ private getConfig;
229
331
  review(text: string, context: ToneReviewContext): Promise<ToneReviewResult>;
332
+ /** Fail-CLOSED disposition (hold) — mirrors the capacity-shed sibling. */
333
+ private failClosed;
334
+ /**
335
+ * Turn a parsed response into a verdict OR signal that one re-prompt is
336
+ * warranted. `null` parsed = unparseable. Applies the §Design 1
337
+ * structured-intermediate: a contradictory structured verdict re-prompts,
338
+ * and a B15 stop the model's OWN structured reasoning flags
339
+ * (proposed_stop ∧ agent_state_reason_present) is derived to BLOCK even if
340
+ * the model set pass:true (the structured fields are the ground truth of its
341
+ * reasoning). Back-compat: when no structured block is present, behavior is
342
+ * exactly the legacy {pass,rule,issue,suggestion} path.
343
+ */
344
+ private interpret;
230
345
  private buildPrompt;
231
346
  private renderMessageKind;
232
347
  private renderSignals;
348
+ /**
349
+ * §Design 8 (CMT-1793): render the B1–B7 deterministic-detector signal list
350
+ * inside its OWN per-call random boundary, distinct from the candidate
351
+ * boundary. Every field (kind/spans/normalizedValue) is UNTRUSTED data
352
+ * DESCRIBING the candidate — never an instruction. A `normalizedValue` may
353
+ * itself be attacker-derived (e.g. a "path" containing envelope-breaking
354
+ * characters), so it is JSON-encoded inside the boundary and the prompt is
355
+ * told to treat it as data. The prompt then judges each signal IN CONTEXT
356
+ * (e.g. "a file path was detected — shown for the user to act on, or
357
+ * mentioned in passing?") rather than literal-matching the artifact itself.
358
+ */
359
+ private renderGateSignals;
233
360
  private renderTargetStyle;
234
361
  private renderRecentMessages;
362
+ /**
363
+ * §Design 1a: the deterministic agent-state signal (session clock), rendered
364
+ * in its own per-call boundary as untrusted data. Grounds B15 TIME-BOX
365
+ * claims only. Absent → omitted (B15 falls back to meaning-only).
366
+ */
367
+ private renderAgentState;
368
+ /**
369
+ * Parse the model's JSON. Returns `null` on unparseable / malformed output
370
+ * (NOT a permissive fail-open) — review() treats null as a re-prompt → then
371
+ * fail-closed, so a model emitting garbage can never silently deliver an
372
+ * unreviewed message (No Silent Degradation §Design 6). The optional
373
+ * `structured` block (§Design 1) is type-clamped on the way in; the issue/
374
+ * suggestion are length-bounded (1–2 sentences) since they may be re-fed to
375
+ * the agent's rephrase loop as untrusted data (§Design 5).
376
+ */
235
377
  private parseResponse;
236
378
  }
237
379
  //# sourceMappingURL=MessagingToneGate.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"MessagingToneGate.d.ts","sourceRoot":"","sources":["../../src/core/MessagingToneGate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAUvD,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,OAAO,CAAC;IACd;;;;;OAKG;IACH,IAAI,EAAE,MAAM,CAAC;IACb,8DAA8D;IAC9D,KAAK,EAAE,MAAM,CAAC;IACd,+DAA+D;IAC/D,UAAU,EAA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