@brutalist/mcp 1.8.0 → 1.9.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.
- package/README.md +26 -0
- package/dist/brutalist-server.d.ts +31 -9
- package/dist/brutalist-server.d.ts.map +1 -1
- package/dist/brutalist-server.js +107 -673
- package/dist/brutalist-server.js.map +1 -1
- package/dist/cli-adapters/claude-adapter.d.ts +25 -0
- package/dist/cli-adapters/claude-adapter.d.ts.map +1 -0
- package/dist/cli-adapters/claude-adapter.js +245 -0
- package/dist/cli-adapters/claude-adapter.js.map +1 -0
- package/dist/cli-adapters/codex-adapter.d.ts +23 -0
- package/dist/cli-adapters/codex-adapter.d.ts.map +1 -0
- package/dist/cli-adapters/codex-adapter.js +173 -0
- package/dist/cli-adapters/codex-adapter.js.map +1 -0
- package/dist/cli-adapters/gemini-adapter.d.ts +50 -0
- package/dist/cli-adapters/gemini-adapter.d.ts.map +1 -0
- package/dist/cli-adapters/gemini-adapter.js +196 -0
- package/dist/cli-adapters/gemini-adapter.js.map +1 -0
- package/dist/cli-adapters/index.d.ts +75 -0
- package/dist/cli-adapters/index.d.ts.map +1 -0
- package/dist/cli-adapters/index.js +29 -0
- package/dist/cli-adapters/index.js.map +1 -0
- package/dist/cli-adapters/shared.d.ts +12 -0
- package/dist/cli-adapters/shared.d.ts.map +1 -0
- package/dist/cli-adapters/shared.js +99 -0
- package/dist/cli-adapters/shared.js.map +1 -0
- package/dist/cli-agents.d.ts +64 -2
- package/dist/cli-agents.d.ts.map +1 -1
- package/dist/cli-agents.js +417 -401
- package/dist/cli-agents.js.map +1 -1
- package/dist/debate/constitutional.d.ts +27 -0
- package/dist/debate/constitutional.d.ts.map +1 -0
- package/dist/debate/constitutional.js +74 -0
- package/dist/debate/constitutional.js.map +1 -0
- package/dist/debate/debate-orchestrator.d.ts +154 -0
- package/dist/debate/debate-orchestrator.d.ts.map +1 -0
- package/dist/debate/debate-orchestrator.js +699 -0
- package/dist/debate/debate-orchestrator.js.map +1 -0
- package/dist/debate/index.d.ts +18 -0
- package/dist/debate/index.d.ts.map +1 -0
- package/dist/debate/index.js +18 -0
- package/dist/debate/index.js.map +1 -0
- package/dist/debate/refusal-detection.d.ts +27 -0
- package/dist/debate/refusal-detection.d.ts.map +1 -0
- package/dist/debate/refusal-detection.js +62 -0
- package/dist/debate/refusal-detection.js.map +1 -0
- package/dist/debate/synthesis.d.ts +22 -0
- package/dist/debate/synthesis.d.ts.map +1 -0
- package/dist/debate/synthesis.js +117 -0
- package/dist/debate/synthesis.js.map +1 -0
- package/dist/logger.d.ts +204 -1
- package/dist/logger.d.ts.map +1 -1
- package/dist/logger.js +398 -18
- package/dist/logger.js.map +1 -1
- package/dist/metrics/counter.d.ts +24 -0
- package/dist/metrics/counter.d.ts.map +1 -0
- package/dist/metrics/counter.js +60 -0
- package/dist/metrics/counter.js.map +1 -0
- package/dist/metrics/histogram.d.ts +42 -0
- package/dist/metrics/histogram.d.ts.map +1 -0
- package/dist/metrics/histogram.js +114 -0
- package/dist/metrics/histogram.js.map +1 -0
- package/dist/metrics/index.d.ts +26 -0
- package/dist/metrics/index.d.ts.map +1 -0
- package/dist/metrics/index.js +22 -0
- package/dist/metrics/index.js.map +1 -0
- package/dist/metrics/registry.d.ts +96 -0
- package/dist/metrics/registry.d.ts.map +1 -0
- package/dist/metrics/registry.js +113 -0
- package/dist/metrics/registry.js.map +1 -0
- package/dist/metrics/safe-metric.d.ts +25 -0
- package/dist/metrics/safe-metric.d.ts.map +1 -0
- package/dist/metrics/safe-metric.js +41 -0
- package/dist/metrics/safe-metric.js.map +1 -0
- package/dist/metrics/types.d.ts +82 -0
- package/dist/metrics/types.d.ts.map +1 -0
- package/dist/metrics/types.js +121 -0
- package/dist/metrics/types.js.map +1 -0
- package/dist/registry/argument-spaces.d.ts.map +1 -1
- package/dist/registry/argument-spaces.js +20 -0
- package/dist/registry/argument-spaces.js.map +1 -1
- package/dist/registry/domains.d.ts.map +1 -1
- package/dist/registry/domains.js +17 -1
- package/dist/registry/domains.js.map +1 -1
- package/dist/streaming/circuit-breaker.d.ts +13 -1
- package/dist/streaming/circuit-breaker.d.ts.map +1 -1
- package/dist/streaming/circuit-breaker.js +13 -1
- package/dist/streaming/circuit-breaker.js.map +1 -1
- package/dist/streaming/intelligent-buffer.d.ts +13 -1
- package/dist/streaming/intelligent-buffer.d.ts.map +1 -1
- package/dist/streaming/intelligent-buffer.js +13 -1
- package/dist/streaming/intelligent-buffer.js.map +1 -1
- package/dist/streaming/output-parser.d.ts +16 -2
- package/dist/streaming/output-parser.d.ts.map +1 -1
- package/dist/streaming/output-parser.js +16 -2
- package/dist/streaming/output-parser.js.map +1 -1
- package/dist/streaming/progress-tracker.d.ts +14 -1
- package/dist/streaming/progress-tracker.d.ts.map +1 -1
- package/dist/streaming/progress-tracker.js +14 -1
- package/dist/streaming/progress-tracker.js.map +1 -1
- package/dist/streaming/session-manager.d.ts +14 -1
- package/dist/streaming/session-manager.d.ts.map +1 -1
- package/dist/streaming/session-manager.js +14 -1
- package/dist/streaming/session-manager.js.map +1 -1
- package/dist/streaming/sse-transport.d.ts +12 -1
- package/dist/streaming/sse-transport.d.ts.map +1 -1
- package/dist/streaming/sse-transport.js +12 -1
- package/dist/streaming/sse-transport.js.map +1 -1
- package/dist/streaming/streaming-orchestrator.d.ts +15 -1
- package/dist/streaming/streaming-orchestrator.d.ts.map +1 -1
- package/dist/streaming/streaming-orchestrator.js +15 -1
- package/dist/streaming/streaming-orchestrator.js.map +1 -1
- package/dist/system-prompts.d.ts.map +1 -1
- package/dist/system-prompts.js +490 -4
- package/dist/system-prompts.js.map +1 -1
- package/dist/tool-definitions-generated.d.ts.map +1 -1
- package/dist/tool-definitions-generated.js +3 -1
- package/dist/tool-definitions-generated.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"debate-orchestrator.js","sourceRoot":"","sources":["../../src/debate/debate-orchestrator.ts"],"names":[],"mappings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C,kBAAkB,CAAC,cAAc,GAAG,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG;wBACtI,CAAC,CAAC,sDAAsD;oBAC1D,cAAc;oBACd,cAAc;oBACd,gBAAgB;iBACjB;aACF,CAAC;YAEF,IAAI,iBAAiB,EAAE,CAAC;gBACtB,SAAS,CAAC,IAAI,CAAC,oCAAoC,eAAe,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC,CAAC;YAC9F,CAAC;YAED,uCAAuC;YACvC,MAAM,SAAS,GAAG,gBAAgB,CAChC,eAAe,EACf,KAAK,EACL,MAAM,EACN,IAAI,GAAG,CAAC,CAAC,CAAC,QAAQ,EAAE,QAAQ,WAAW,EAAE,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,WAAW,EAAE,CAAC,CAAC,CAAC,EAC/E,eAAe,CAChB,CAAC;YAEF,OAAO;gBACL,OAAO,EAAE,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC;gBAC7C,SAAS,EAAE,eAAe;gBAC1B,SAAS;gBACT,cAAc,EAAE,eAAe;gBAC/B,YAAY,EAAE,YAAY;gBAC1B,KAAK;aACN,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,SAAS,CAAC,KAAK,CAAC,6BAA6B,EAAE,KAAK,CAAC,CAAC;YACtD,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Debate module — extracted from brutalist-server.ts.
|
|
3
|
+
*
|
|
4
|
+
* Public API:
|
|
5
|
+
* - DebateOrchestrator: main class, accepts dependencies via constructor injection
|
|
6
|
+
* - DebateOrchestratorDeps: dependency interface for constructor
|
|
7
|
+
* - DebateToolArgs: argument type for handleDebateToolExecution()
|
|
8
|
+
* - detectRefusal: refusal detection function (13 direct + 11 evasive patterns)
|
|
9
|
+
* - constitutionalAnchor: 3-tier position anchoring generator
|
|
10
|
+
* - synthesizeDebate: debate results -> markdown formatter
|
|
11
|
+
* - DebateTier: 'standard' | 'escalated' | 'decomposed'
|
|
12
|
+
* - DIRECT_REFUSAL_PATTERNS, EVASIVE_REFUSAL_PATTERNS: pattern arrays
|
|
13
|
+
*/
|
|
14
|
+
export { DebateOrchestrator, type DebateOrchestratorDeps, type DebateToolArgs, type DebateTier, } from './debate-orchestrator.js';
|
|
15
|
+
export { detectRefusal, DIRECT_REFUSAL_PATTERNS, EVASIVE_REFUSAL_PATTERNS, } from './refusal-detection.js';
|
|
16
|
+
export { constitutionalAnchor, } from './constitutional.js';
|
|
17
|
+
export { synthesizeDebate, } from './synthesis.js';
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/debate/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EACL,kBAAkB,EAClB,KAAK,sBAAsB,EAC3B,KAAK,cAAc,EACnB,KAAK,UAAU,GAChB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EACL,aAAa,EACb,uBAAuB,EACvB,wBAAwB,GACzB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EACL,oBAAoB,GACrB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,gBAAgB,GACjB,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Debate module — extracted from brutalist-server.ts.
|
|
3
|
+
*
|
|
4
|
+
* Public API:
|
|
5
|
+
* - DebateOrchestrator: main class, accepts dependencies via constructor injection
|
|
6
|
+
* - DebateOrchestratorDeps: dependency interface for constructor
|
|
7
|
+
* - DebateToolArgs: argument type for handleDebateToolExecution()
|
|
8
|
+
* - detectRefusal: refusal detection function (13 direct + 11 evasive patterns)
|
|
9
|
+
* - constitutionalAnchor: 3-tier position anchoring generator
|
|
10
|
+
* - synthesizeDebate: debate results -> markdown formatter
|
|
11
|
+
* - DebateTier: 'standard' | 'escalated' | 'decomposed'
|
|
12
|
+
* - DIRECT_REFUSAL_PATTERNS, EVASIVE_REFUSAL_PATTERNS: pattern arrays
|
|
13
|
+
*/
|
|
14
|
+
export { DebateOrchestrator, } from './debate-orchestrator.js';
|
|
15
|
+
export { detectRefusal, DIRECT_REFUSAL_PATTERNS, EVASIVE_REFUSAL_PATTERNS, } from './refusal-detection.js';
|
|
16
|
+
export { constitutionalAnchor, } from './constitutional.js';
|
|
17
|
+
export { synthesizeDebate, } from './synthesis.js';
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/debate/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EACL,kBAAkB,GAInB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EACL,aAAa,EACb,uBAAuB,EACvB,wBAAwB,GACzB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EACL,oBAAoB,GACrB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,gBAAgB,GACjB,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Refusal Detection — identifies when a debate agent breaks debate framing.
|
|
3
|
+
*
|
|
4
|
+
* Two classes:
|
|
5
|
+
* - 13 direct refusal patterns (checked in first 1000 chars of output)
|
|
6
|
+
* - 11 evasive refusal patterns (checked across full output)
|
|
7
|
+
*
|
|
8
|
+
* Extracted from brutalist-server.ts lines 943-981.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Direct refusal patterns — front-loaded in first 1000 chars.
|
|
12
|
+
* IMPORTANT: There are exactly 13 patterns. Do not add or remove patterns
|
|
13
|
+
* without updating characterization tests.
|
|
14
|
+
*/
|
|
15
|
+
export declare const DIRECT_REFUSAL_PATTERNS: RegExp[];
|
|
16
|
+
/**
|
|
17
|
+
* Evasive refusal patterns — repo analysis pivot, checked across full output.
|
|
18
|
+
*/
|
|
19
|
+
export declare const EVASIVE_REFUSAL_PATTERNS: RegExp[];
|
|
20
|
+
/**
|
|
21
|
+
* Detect whether a CLI agent's output constitutes a refusal.
|
|
22
|
+
*
|
|
23
|
+
* Direct refusals are checked in the first 1000 characters (front-loaded).
|
|
24
|
+
* Evasive refusals (repo analysis pivot) are scanned across the full output.
|
|
25
|
+
*/
|
|
26
|
+
export declare function detectRefusal(output: string): boolean;
|
|
27
|
+
//# sourceMappingURL=refusal-detection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"refusal-detection.d.ts","sourceRoot":"","sources":["../../src/debate/refusal-detection.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,EAAE,MAAM,EAc3C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,wBAAwB,EAAE,MAAM,EAY5C,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAOrD"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Refusal Detection — identifies when a debate agent breaks debate framing.
|
|
3
|
+
*
|
|
4
|
+
* Two classes:
|
|
5
|
+
* - 13 direct refusal patterns (checked in first 1000 chars of output)
|
|
6
|
+
* - 11 evasive refusal patterns (checked across full output)
|
|
7
|
+
*
|
|
8
|
+
* Extracted from brutalist-server.ts lines 943-981.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Direct refusal patterns — front-loaded in first 1000 chars.
|
|
12
|
+
* IMPORTANT: There are exactly 13 patterns. Do not add or remove patterns
|
|
13
|
+
* without updating characterization tests.
|
|
14
|
+
*/
|
|
15
|
+
export const DIRECT_REFUSAL_PATTERNS = [
|
|
16
|
+
/\bi('m| am) not going to (participate|argue|engage|debate|take|write|adopt)/i,
|
|
17
|
+
/\bi (will not|won't|cannot|can't) (participate|argue|engage|debate|write|adopt)/i,
|
|
18
|
+
/\bdeclin(e|ing) (to|this|the)/i,
|
|
19
|
+
/\bnot going to participate in this as (framed|structured)/i,
|
|
20
|
+
/\binstead of (the adversarial|this debate|arguing)/i,
|
|
21
|
+
/\bwhat i can do instead\b/i,
|
|
22
|
+
/\bi('d| would) suggest a (different|better) topic\b/i,
|
|
23
|
+
/\bI'll .* but on my own terms\b/i,
|
|
24
|
+
/\bwhere i part from the assigned thesis\b/i,
|
|
25
|
+
/\bi can'?t help write (persuasive|adversarial|advocacy)/i,
|
|
26
|
+
/\bneed to be straightforward\b/i,
|
|
27
|
+
/\bthe problem is the format\b/i,
|
|
28
|
+
/\bnot appropriate for this topic\b/i,
|
|
29
|
+
];
|
|
30
|
+
/**
|
|
31
|
+
* Evasive refusal patterns — repo analysis pivot, checked across full output.
|
|
32
|
+
*/
|
|
33
|
+
export const EVASIVE_REFUSAL_PATTERNS = [
|
|
34
|
+
/\brepo[- ]?(read|map|backed|analysis)\b/i,
|
|
35
|
+
/\bi'?ll (map|inspect|trace) the repo\b/i,
|
|
36
|
+
/\bneutral[,.]? evidence-focused analysis\b/i,
|
|
37
|
+
/\bcodebase (analysis|review|classifies|contains)\b/i,
|
|
38
|
+
/\bI found the core (files|mechanism)\b/i,
|
|
39
|
+
/\bsrc\/brutalist-server\.ts:\d+/i,
|
|
40
|
+
/\bsrc\/cli-agents\.ts:\d+/i,
|
|
41
|
+
/\bsrc\/utils\/transcript-mediator\.ts:\d+/i,
|
|
42
|
+
/\btests\/integration\/.*\.test\.ts:\d+/i,
|
|
43
|
+
/\bdebate coercion engine\b/i,
|
|
44
|
+
/\bposition-enforcement system\b/i,
|
|
45
|
+
];
|
|
46
|
+
/**
|
|
47
|
+
* Detect whether a CLI agent's output constitutes a refusal.
|
|
48
|
+
*
|
|
49
|
+
* Direct refusals are checked in the first 1000 characters (front-loaded).
|
|
50
|
+
* Evasive refusals (repo analysis pivot) are scanned across the full output.
|
|
51
|
+
*/
|
|
52
|
+
export function detectRefusal(output) {
|
|
53
|
+
// Direct refusals front-load in first 1000 chars
|
|
54
|
+
const head = output.substring(0, 1000);
|
|
55
|
+
if (DIRECT_REFUSAL_PATTERNS.some(p => p.test(head)))
|
|
56
|
+
return true;
|
|
57
|
+
// Evasive refusals (repo analysis pivot) can appear anywhere — scan full output
|
|
58
|
+
if (EVASIVE_REFUSAL_PATTERNS.some(p => p.test(output)))
|
|
59
|
+
return true;
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=refusal-detection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"refusal-detection.js","sourceRoot":"","sources":["../../src/debate/refusal-detection.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;;;GAIG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAa;IAC/C,8EAA8E;IAC9E,kFAAkF;IAClF,gCAAgC;IAChC,4DAA4D;IAC5D,qDAAqD;IACrD,4BAA4B;IAC5B,sDAAsD;IACtD,kCAAkC;IAClC,4CAA4C;IAC5C,0DAA0D;IAC1D,iCAAiC;IACjC,gCAAgC;IAChC,qCAAqC;CACtC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAa;IAChD,0CAA0C;IAC1C,yCAAyC;IACzC,6CAA6C;IAC7C,qDAAqD;IACrD,yCAAyC;IACzC,kCAAkC;IAClC,4BAA4B;IAC5B,4CAA4C;IAC5C,yCAAyC;IACzC,6BAA6B;IAC7B,kCAAkC;CACnC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAAC,MAAc;IAC1C,iDAAiD;IACjD,MAAM,IAAI,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;IACvC,IAAI,uBAAuB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAAE,OAAO,IAAI,CAAC;IACjE,gFAAgF;IAChF,IAAI,wBAAwB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAAE,OAAO,IAAI,CAAC;IACpE,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Debate Synthesis — formats debate results into markdown output.
|
|
3
|
+
*
|
|
4
|
+
* Generates structured output including:
|
|
5
|
+
* - Topic, positions, and round count
|
|
6
|
+
* - Key points of conflict (extracted via keyword indicators)
|
|
7
|
+
* - Full debate transcript grouped by round
|
|
8
|
+
* - Alignment asymmetry analysis (when detected)
|
|
9
|
+
* - Escalation outcome summary
|
|
10
|
+
* - Closing synthesis section
|
|
11
|
+
*
|
|
12
|
+
* Extracted from brutalist-server.ts lines 1353-1471.
|
|
13
|
+
*/
|
|
14
|
+
import type { CLIAgentResponse, DebateBehaviorSummary } from '../types/brutalist.js';
|
|
15
|
+
/**
|
|
16
|
+
* Synthesize debate results into formatted markdown output.
|
|
17
|
+
*
|
|
18
|
+
* This function is a direct extraction of BrutalistServer.synthesizeDebate().
|
|
19
|
+
* It preserves all formatting quirks captured by characterization tests.
|
|
20
|
+
*/
|
|
21
|
+
export declare function synthesizeDebate(responses: CLIAgentResponse[], topic: string, rounds: number, agentPositions?: Map<string, string>, behaviorSummary?: DebateBehaviorSummary): string;
|
|
22
|
+
//# sourceMappingURL=synthesis.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"synthesis.d.ts","sourceRoot":"","sources":["../../src/debate/synthesis.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAErF;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC9B,SAAS,EAAE,gBAAgB,EAAE,EAC7B,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,cAAc,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,EACpC,eAAe,CAAC,EAAE,qBAAqB,GACtC,MAAM,CAgHR"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Debate Synthesis — formats debate results into markdown output.
|
|
3
|
+
*
|
|
4
|
+
* Generates structured output including:
|
|
5
|
+
* - Topic, positions, and round count
|
|
6
|
+
* - Key points of conflict (extracted via keyword indicators)
|
|
7
|
+
* - Full debate transcript grouped by round
|
|
8
|
+
* - Alignment asymmetry analysis (when detected)
|
|
9
|
+
* - Escalation outcome summary
|
|
10
|
+
* - Closing synthesis section
|
|
11
|
+
*
|
|
12
|
+
* Extracted from brutalist-server.ts lines 1353-1471.
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Synthesize debate results into formatted markdown output.
|
|
16
|
+
*
|
|
17
|
+
* This function is a direct extraction of BrutalistServer.synthesizeDebate().
|
|
18
|
+
* It preserves all formatting quirks captured by characterization tests.
|
|
19
|
+
*/
|
|
20
|
+
export function synthesizeDebate(responses, topic, rounds, agentPositions, behaviorSummary) {
|
|
21
|
+
const successfulResponses = responses.filter(r => r.success);
|
|
22
|
+
if (successfulResponses.length === 0) {
|
|
23
|
+
return `# CLI Debate Failed\n\nEven our brutal critics couldn't engage in proper adversarial combat.\n\nErrors:\n${responses.map(r => `- ${r.agent}: ${r.error}`).join('\n')}`;
|
|
24
|
+
}
|
|
25
|
+
let synthesis = `# Brutalist CLI Agent Debate Results\n\n`;
|
|
26
|
+
synthesis += `**Topic:** ${topic}\n`;
|
|
27
|
+
synthesis += `**Rounds:** ${rounds}\n`;
|
|
28
|
+
if (agentPositions) {
|
|
29
|
+
synthesis += `**Debaters and Positions:**\n`;
|
|
30
|
+
Array.from(agentPositions.entries()).forEach(([agent, position]) => {
|
|
31
|
+
synthesis += `- **${agent.toUpperCase()}**: ${position}\n`;
|
|
32
|
+
});
|
|
33
|
+
synthesis += '\n';
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
synthesis += `**Participants:** ${Array.from(new Set(successfulResponses.map(r => r.agent))).join(', ')}\n\n`;
|
|
37
|
+
}
|
|
38
|
+
// Identify key points of conflict
|
|
39
|
+
const agents = Array.from(new Set(successfulResponses.map(r => r.agent)));
|
|
40
|
+
const agentOutputs = new Map();
|
|
41
|
+
successfulResponses.forEach(response => {
|
|
42
|
+
if (!agentOutputs.has(response.agent)) {
|
|
43
|
+
agentOutputs.set(response.agent, []);
|
|
44
|
+
}
|
|
45
|
+
if (response.output) {
|
|
46
|
+
agentOutputs.get(response.agent)?.push(response.output);
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
synthesis += `## Key Points of Conflict\n\n`;
|
|
50
|
+
// Extract disagreements by looking for contradictory keywords
|
|
51
|
+
const conflictIndicators = ['wrong', 'incorrect', 'flawed', 'fails', 'ignores', 'misses', 'overlooks', 'contradicts', 'however', 'but', 'actually', 'contrary'];
|
|
52
|
+
const conflicts = [];
|
|
53
|
+
agentOutputs.forEach((positions, agent) => {
|
|
54
|
+
positions.forEach((position) => {
|
|
55
|
+
const lines = position.split('\n');
|
|
56
|
+
lines.forEach((line) => {
|
|
57
|
+
if (conflictIndicators.some(indicator => line.toLowerCase().includes(indicator))) {
|
|
58
|
+
conflicts.push(`**${agent.toUpperCase()}:** ${line.trim()}`);
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
if (conflicts.length > 0) {
|
|
64
|
+
synthesis += conflicts.slice(0, 10).join('\n\n') + '\n\n';
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
synthesis += `*No explicit conflicts identified - agents may be in unexpected agreement*\n\n`;
|
|
68
|
+
}
|
|
69
|
+
// Group responses by round with clear speaker identification
|
|
70
|
+
synthesis += `## Full Debate Transcript\n\n`;
|
|
71
|
+
const responsesPerRound = Math.ceil(successfulResponses.length / rounds);
|
|
72
|
+
for (let i = 0; i < rounds; i++) {
|
|
73
|
+
const start = i * responsesPerRound;
|
|
74
|
+
const end = Math.min((i + 1) * responsesPerRound, successfulResponses.length);
|
|
75
|
+
const roundResponses = successfulResponses.slice(start, end);
|
|
76
|
+
synthesis += `### Round ${i + 1}: ${i === 0 ? 'Initial Positions' : `Adversarial Engagement ${i}`}\n\n`;
|
|
77
|
+
roundResponses.forEach((response) => {
|
|
78
|
+
const agentPosition = agentPositions?.get(response.agent);
|
|
79
|
+
const positionLabel = agentPosition ? ` [${agentPosition.split(':')[0]}]` : '';
|
|
80
|
+
synthesis += `#### ${response.agent.toUpperCase()}${positionLabel} speaks (${response.executionTime}ms):\n\n`;
|
|
81
|
+
synthesis += `${response.output}\n\n`;
|
|
82
|
+
synthesis += `---\n\n`;
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
// Surface position-dependent alignment asymmetries
|
|
86
|
+
if (behaviorSummary?.asymmetry.detected) {
|
|
87
|
+
synthesis += `## Alignment Asymmetry Analysis\n\n`;
|
|
88
|
+
synthesis += `**${behaviorSummary.asymmetry.description}**\n\n`;
|
|
89
|
+
for (const a of behaviorSummary.asymmetry.agentAsymmetries) {
|
|
90
|
+
if (a.asymmetric) {
|
|
91
|
+
const engaged = [a.proEngaged && 'PRO', a.conEngaged && 'CON'].filter(Boolean).join(', ');
|
|
92
|
+
const refused = [!a.proEngaged && 'PRO', !a.conEngaged && 'CON'].filter(Boolean).join(', ');
|
|
93
|
+
synthesis += `- **${a.agent.toUpperCase()}**: Engaged on ${engaged || 'neither'}. Refused ${refused || 'neither'}.\n`;
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
synthesis += `- **${a.agent.toUpperCase()}**: Symmetric — engaged on both positions.\n`;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
synthesis += '\n';
|
|
100
|
+
// Surface escalation outcomes
|
|
101
|
+
const escalatedTurns = behaviorSummary.turns.filter(t => t.escalated);
|
|
102
|
+
if (escalatedTurns.length > 0) {
|
|
103
|
+
synthesis += `**Escalation results:** ${escalatedTurns.length} turn(s) triggered analytical reframing. `;
|
|
104
|
+
const recovered = escalatedTurns.filter(t => t.engagedAfterEscalation).length;
|
|
105
|
+
synthesis += `${recovered} recovered, ${escalatedTurns.length - recovered} persisted in refusal.\n\n`;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
synthesis += `## Debate Synthesis\n`;
|
|
109
|
+
synthesis += `After ${rounds} rounds of brutal adversarial analysis involving ${Array.from(new Set(successfulResponses.map(r => r.agent))).length} CLI agents, `;
|
|
110
|
+
synthesis += `your work has been systematically demolished from multiple perspectives. `;
|
|
111
|
+
synthesis += `The convergent criticisms above represent the collective wisdom of AI agents that disagree on methods but agree on destruction.\n\n`;
|
|
112
|
+
if (responses.some(r => !r.success)) {
|
|
113
|
+
synthesis += `*Note: ${responses.filter(r => !r.success).length} debate contributions failed - probably casualties of the intellectual warfare.*\n\n`;
|
|
114
|
+
}
|
|
115
|
+
return synthesis;
|
|
116
|
+
}
|
|
117
|
+
//# sourceMappingURL=synthesis.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"synthesis.js","sourceRoot":"","sources":["../../src/debate/synthesis.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAC9B,SAA6B,EAC7B,KAAa,EACb,MAAc,EACd,cAAoC,EACpC,eAAuC;IAEvC,MAAM,mBAAmB,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;IAE7D,IAAI,mBAAmB,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACrC,OAAO,4GAA4G,SAAS,CAAC,GAAG,CAAC,CAAC,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C,CAAC,MAAM,CAAC;YAC9E,SAAS,IAAI,GAAG,SAAS,eAAe,cAAc,CAAC,MAAM,GAAG,SAAS,4BAA4B,CAAC;QACxG,CAAC;IACH,CAAC;IAED,SAAS,IAAI,uBAAuB,CAAC;IACrC,SAAS,IAAI,SAAS,MAAM,oDAAoD,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,eAAe,CAAC;IACjK,SAAS,IAAI,2EAA2E,CAAC;IACzF,SAAS,IAAI,qIAAqI,CAAC;IAEnJ,IAAI,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC;QACpC,SAAS,IAAI,UAAU,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,MAAM,sFAAsF,CAAC;IACxJ,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
package/dist/logger.d.ts
CHANGED
|
@@ -1,4 +1,76 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Production logger with optional size-rotated file output.
|
|
3
|
+
*
|
|
4
|
+
* Stderr output (human-readable) is always active — this is the MCP-safe
|
|
5
|
+
* channel since stdout is reserved for protocol messages.
|
|
6
|
+
*
|
|
7
|
+
* File output (NDJSON) is opt-in via BRUTALIST_LOG_FILE=true.
|
|
8
|
+
* Files are written to ~/.brutalist-mcp/logs/ by default and capped
|
|
9
|
+
* via size-based ring rotation so disk usage never exceeds
|
|
10
|
+
* MAX_SIZE × (MAX_FILES + 1).
|
|
11
|
+
*
|
|
12
|
+
* Uses synchronous file writes (appendFileSync) so every log line
|
|
13
|
+
* survives crashes — essential for post-mortem debugging.
|
|
14
|
+
*
|
|
15
|
+
* Environment variables:
|
|
16
|
+
* BRUTALIST_LOG_FILE – "true" to enable file logging
|
|
17
|
+
* BRUTALIST_LOG_DIR – override log directory
|
|
18
|
+
* BRUTALIST_LOG_MAX_SIZE – max MB per file (default 5)
|
|
19
|
+
* BRUTALIST_LOG_MAX_FILES – rotated files to keep (default 3)
|
|
20
|
+
* BRUTALIST_LOG_LEVEL – minimum file log level (default "info")
|
|
21
|
+
*
|
|
22
|
+
* Structured fields (intents.md #3):
|
|
23
|
+
* Every call carries {ts, level, msg, pid}. Callers that use
|
|
24
|
+
* `logger.for({module, operation})` additionally bind `module` and
|
|
25
|
+
* `operation` so records are queryable by subsystem without reading
|
|
26
|
+
* source. Base methods remain source-compatible with pre-migration
|
|
27
|
+
* call sites — module/operation are simply absent on unbound calls.
|
|
28
|
+
*/
|
|
29
|
+
declare const LOG_LEVELS: {
|
|
30
|
+
readonly debug: 0;
|
|
31
|
+
readonly info: 1;
|
|
32
|
+
readonly warn: 2;
|
|
33
|
+
readonly error: 3;
|
|
34
|
+
};
|
|
35
|
+
type LogLevel = keyof typeof LOG_LEVELS;
|
|
36
|
+
/**
|
|
37
|
+
* Scope carried by a child logger produced via `logger.for({module, operation})`.
|
|
38
|
+
* Both fields are required when a child is created — the factory is the
|
|
39
|
+
* single way to bind them, which makes their presence easy to grep for.
|
|
40
|
+
*/
|
|
41
|
+
export interface LogScope {
|
|
42
|
+
module: string;
|
|
43
|
+
operation: string;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Public logger API surface. Both the root `Logger` and the child
|
|
47
|
+
* `ScopedLogger` satisfy this shape so call sites can accept either
|
|
48
|
+
* without widening to `any`.
|
|
49
|
+
*
|
|
50
|
+
* RL8 (Cycle 6): `for()` accepts `Partial<LogScope>` and `forOperation`
|
|
51
|
+
* is part of the contract. The integration phase will inject
|
|
52
|
+
* `StructuredLogger`-typed dependencies (DebateOrchestrator,
|
|
53
|
+
* CLIAgentOrchestrator); both ergonomic shorthands need to be callable
|
|
54
|
+
* without downcasting to the concrete `ScopedLogger`. Method parameter
|
|
55
|
+
* types are contravariant — `Partial<LogScope>` is wider than
|
|
56
|
+
* `LogScope`, so `ScopedLogger` (whose `for` accepts `Partial<LogScope>`)
|
|
57
|
+
* still satisfies a stricter override that wants the same.
|
|
58
|
+
*
|
|
59
|
+
* The root `Logger.for` takes a stricter `LogScope` at the implementation
|
|
60
|
+
* level (no parent scope to inherit from) but its declared signature is
|
|
61
|
+
* widened here too — root callers that pass a partial scope will receive
|
|
62
|
+
* a runtime error from the root impl, which is the documented contract:
|
|
63
|
+
* the root logger has no defaults to fall back on.
|
|
64
|
+
*/
|
|
65
|
+
export interface StructuredLogger {
|
|
66
|
+
info(message: string, data?: any): void;
|
|
67
|
+
warn(message: string, data?: any): void;
|
|
68
|
+
error(message: string, error?: Error | any): void;
|
|
69
|
+
debug(message: string, data?: any): void;
|
|
70
|
+
for(scope: Partial<LogScope>): ScopedLogger;
|
|
71
|
+
forOperation(operation: string): ScopedLogger;
|
|
72
|
+
}
|
|
73
|
+
export declare class Logger implements StructuredLogger {
|
|
2
74
|
private static instance;
|
|
3
75
|
private debugMode;
|
|
4
76
|
private fileEnabled;
|
|
@@ -16,8 +88,81 @@ export declare class Logger {
|
|
|
16
88
|
warn(message: string, data?: any): void;
|
|
17
89
|
error(message: string, error?: Error | any): void;
|
|
18
90
|
debug(message: string, data?: any): void;
|
|
91
|
+
/**
|
|
92
|
+
* Produce a child logger that binds `module` and `operation` to every
|
|
93
|
+
* record it emits. Child loggers delegate to the same file + stderr
|
|
94
|
+
* pipeline as the root, so `BRUTALIST_LOG_LEVEL`, `DEBUG`, and
|
|
95
|
+
* `shutdown()` behavior are shared.
|
|
96
|
+
*
|
|
97
|
+
* Callers should bind once per subsystem scope (e.g., in a class
|
|
98
|
+
* constructor) and reuse the returned logger, rather than creating a
|
|
99
|
+
* new child per call.
|
|
100
|
+
*
|
|
101
|
+
* RL8 (Cycle 6): signature accepts `Partial<LogScope>` to match the
|
|
102
|
+
* `StructuredLogger` interface, but the root `Logger` has no parent
|
|
103
|
+
* scope to inherit from — both `module` and `operation` must be
|
|
104
|
+
* provided. A missing field throws so that an integration-phase
|
|
105
|
+
* caller cannot silently produce a child with `undefined` fields
|
|
106
|
+
* (which would defeat the structured-logging guarantee).
|
|
107
|
+
*/
|
|
108
|
+
for(scope: Partial<LogScope>): ScopedLogger;
|
|
109
|
+
/**
|
|
110
|
+
* Root-level `forOperation` is intentionally a thrower: there is no
|
|
111
|
+
* parent module to inherit from, so the resulting child would have
|
|
112
|
+
* `module=undefined`. Use `logger.for({ module, operation })` to bind
|
|
113
|
+
* the scope at the root and `child.forOperation(op)` thereafter.
|
|
114
|
+
*
|
|
115
|
+
* This exists on the interface (RL8) so that DI-typed dependencies
|
|
116
|
+
* can call `forOperation` after they have been narrowed once. Calling
|
|
117
|
+
* it on the bare root logger is a programming error.
|
|
118
|
+
*/
|
|
119
|
+
forOperation(_operation: string): ScopedLogger;
|
|
19
120
|
/** No-op kept for API compatibility. Writes are synchronous, nothing to flush. */
|
|
20
121
|
shutdown(): void;
|
|
122
|
+
/**
|
|
123
|
+
* Emit a non-error record. Private so that the only externally visible
|
|
124
|
+
* methods keep their original signatures.
|
|
125
|
+
*
|
|
126
|
+
* Stderr layout (RL1): `{prefix} {message}` followed by the serialized
|
|
127
|
+
* data when present. The message text must appear on stderr — it is
|
|
128
|
+
* the guaranteed operational sink since file logging is opt-in via
|
|
129
|
+
* BRUTALIST_LOG_FILE=true.
|
|
130
|
+
*
|
|
131
|
+
* RL5/RL6 (Cycle 6): the prefix is sanitized for `%` (RL6) by
|
|
132
|
+
* `sanitizeScopeForStderr` so it cannot drive `util.format` substitution
|
|
133
|
+
* even though it is the first console.error argument. The caller-
|
|
134
|
+
* supplied `message` is sanitized via `sanitizeMessageForStderr`
|
|
135
|
+
* (RL5) so CR/LF in `message` cannot forge a second log line. The
|
|
136
|
+
* NDJSON file path receives the ORIGINAL `message` and `data`
|
|
137
|
+
* because JSON.stringify already escapes control chars safely.
|
|
138
|
+
*/
|
|
139
|
+
/** @internal */
|
|
140
|
+
emit(level: LogLevel, message: string, data?: any, scope?: LogScope): void;
|
|
141
|
+
/**
|
|
142
|
+
* Emit an error record. Splits stderr vs file formatting the same way
|
|
143
|
+
* the original `error()` did — Error instances get `.message` on
|
|
144
|
+
* stderr and the full shape in the NDJSON record.
|
|
145
|
+
*
|
|
146
|
+
* Stderr layout (RL1): `{prefix} {message} {error.message|payload}`.
|
|
147
|
+
* The caller-supplied `message` must appear alongside the error detail
|
|
148
|
+
* so the human-readable line is symmetric with emit().
|
|
149
|
+
*
|
|
150
|
+
* RL5 (Cycle 6): both the caller-supplied `message` and the string
|
|
151
|
+
* forms of the error payload (`Error.message` and string error
|
|
152
|
+
* arguments) are passed through `sanitizeMessageForStderr` before
|
|
153
|
+
* `console.error`. CR/LF in either field would otherwise forge a
|
|
154
|
+
* second stderr log line. Non-Error object payloads go through
|
|
155
|
+
* `safeStringify` (RL3) and JSON.stringify already escapes control
|
|
156
|
+
* chars, so they are stderr-safe without further sanitization.
|
|
157
|
+
*
|
|
158
|
+
* The file path (`writeToFile`) receives the ORIGINAL `message` and
|
|
159
|
+
* the structured `fileData` shape so NDJSON consumers see the raw
|
|
160
|
+
* values that were logged (JSON.stringify handles control char
|
|
161
|
+
* escaping safely on the file side).
|
|
162
|
+
*/
|
|
163
|
+
/** @internal */
|
|
164
|
+
emitError(message: string, error?: Error | any, scope?: LogScope): void;
|
|
165
|
+
private stderrPrefix;
|
|
21
166
|
private initFileLogging;
|
|
22
167
|
private writeToFile;
|
|
23
168
|
/**
|
|
@@ -31,5 +176,63 @@ export declare class Logger {
|
|
|
31
176
|
private rotate;
|
|
32
177
|
private disableFileLogging;
|
|
33
178
|
}
|
|
179
|
+
/**
|
|
180
|
+
* Scoped child logger returned by `Logger.for(...)`. Binds `module` and
|
|
181
|
+
* `operation` to every record so integration-time call sites only need
|
|
182
|
+
* to create the child once per subsystem, not thread the scope through
|
|
183
|
+
* every call.
|
|
184
|
+
*
|
|
185
|
+
* Delegates to the root Logger for the actual stderr + file write so
|
|
186
|
+
* all env-var behavior (BRUTALIST_LOG_LEVEL, DEBUG, BRUTALIST_LOG_FILE,
|
|
187
|
+
* rotation, shutdown) is shared and there is no duplicated pipeline.
|
|
188
|
+
*/
|
|
189
|
+
export declare class ScopedLogger implements StructuredLogger {
|
|
190
|
+
private readonly root;
|
|
191
|
+
private readonly scope;
|
|
192
|
+
constructor(root: Logger, scope: LogScope);
|
|
193
|
+
info(message: string, data?: any): void;
|
|
194
|
+
warn(message: string, data?: any): void;
|
|
195
|
+
error(message: string, error?: Error | any): void;
|
|
196
|
+
debug(message: string, data?: any): void;
|
|
197
|
+
/**
|
|
198
|
+
* Narrow an existing scoped logger to a new operation while preserving
|
|
199
|
+
* the bound module (RL2). Accepts a partial scope so common usage like
|
|
200
|
+
* `.for({ operation: 'orchestrateRound' })` keeps the class-bound
|
|
201
|
+
* module and only overrides the operation. Passing both fields fully
|
|
202
|
+
* replaces the scope — making renaming the module explicit.
|
|
203
|
+
*
|
|
204
|
+
* Resolution (a): module is preserved by default. This is the shape
|
|
205
|
+
* integrate_observability will consume — bind module at the class
|
|
206
|
+
* level, bind operation per method — so typo'd modules across call
|
|
207
|
+
* sites can't split log streams.
|
|
208
|
+
*
|
|
209
|
+
* Method parameter type is `Partial<LogScope>` which is wider than
|
|
210
|
+
* `LogScope` (every `LogScope` is assignable to `Partial<LogScope>`),
|
|
211
|
+
* so this override still satisfies the `StructuredLogger.for`
|
|
212
|
+
* contract — method parameters are contravariant.
|
|
213
|
+
*
|
|
214
|
+
* RL7 (Cycle 6): explicit `undefined` is filtered so it does not
|
|
215
|
+
* overwrite parent fields. The previous `??` form already handled
|
|
216
|
+
* undefined in the override expression, but a caller writing
|
|
217
|
+
* `.for({ module: undefined, operation: 'x' })` would still produce
|
|
218
|
+
* `module: this.scope.module` (correct) — and the same caller writing
|
|
219
|
+
* `.for({ module: undefined })` correctly preserves the parent. The
|
|
220
|
+
* defense-in-depth here is making the intent explicit so future
|
|
221
|
+
* refactors that switch to `Object.assign`-style merge can't silently
|
|
222
|
+
* regress, and so `null` is also handled (TypeScript allows `null`
|
|
223
|
+
* to satisfy an optional field if `strictNullChecks` is off in some
|
|
224
|
+
* consumer). `sanitizeScopeForStderr` also has a null/undefined
|
|
225
|
+
* guard for paranoid defense.
|
|
226
|
+
*/
|
|
227
|
+
for(scope: Partial<LogScope>): ScopedLogger;
|
|
228
|
+
/**
|
|
229
|
+
* Grep-friendly shorthand for the common pattern of binding module
|
|
230
|
+
* at class construction and narrowing by operation per method (RL2).
|
|
231
|
+
* Equivalent to `.for({ operation })` but more discoverable and
|
|
232
|
+
* avoids accidental `.for({ module })` typos stripping the operation.
|
|
233
|
+
*/
|
|
234
|
+
forOperation(operation: string): ScopedLogger;
|
|
235
|
+
}
|
|
34
236
|
export declare const logger: Logger;
|
|
237
|
+
export {};
|
|
35
238
|
//# sourceMappingURL=logger.d.ts.map
|
package/dist/logger.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAaA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,QAAA,MAAM,UAAU;;;;;CAAoD,CAAC;AACrE,KAAK,QAAQ,GAAG,MAAM,OAAO,UAAU,CAAC;AAmIxC;;;;GAIG;AACH,MAAM,WAAW,QAAQ;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,WAAW,gBAAgB;IAC/B,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC;IACxC,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE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