@manya-os/council 1.0.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/CHANGELOG.md +21 -0
- package/LICENSE +21 -0
- package/README.md +244 -0
- package/dist/cjs/index.js +4 -0
- package/dist/cjs/index.js.map +6 -0
- package/dist/cjs/package.json +1 -0
- package/dist/esm/index.mjs +4 -0
- package/dist/esm/index.mjs.map +6 -0
- package/dist/esm/package.json +1 -0
- package/dist/types/analysis/analysis.d.ts +53 -0
- package/dist/types/analysis/analysis.d.ts.map +1 -0
- package/dist/types/analysis/index.d.ts +8 -0
- package/dist/types/analysis/index.d.ts.map +1 -0
- package/dist/types/conflict/conflict.d.ts +63 -0
- package/dist/types/conflict/conflict.d.ts.map +1 -0
- package/dist/types/conflict/index.d.ts +8 -0
- package/dist/types/conflict/index.d.ts.map +1 -0
- package/dist/types/consensus/consensus.d.ts +72 -0
- package/dist/types/consensus/consensus.d.ts.map +1 -0
- package/dist/types/consensus/index.d.ts +9 -0
- package/dist/types/consensus/index.d.ts.map +1 -0
- package/dist/types/debate/debate.d.ts +75 -0
- package/dist/types/debate/debate.d.ts.map +1 -0
- package/dist/types/debate/index.d.ts +8 -0
- package/dist/types/debate/index.d.ts.map +1 -0
- package/dist/types/errors.d.ts +44 -0
- package/dist/types/errors.d.ts.map +1 -0
- package/dist/types/index.d.ts +42 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/logging.d.ts +40 -0
- package/dist/types/logging.d.ts.map +1 -0
- package/dist/types/minority/index.d.ts +8 -0
- package/dist/types/minority/index.d.ts.map +1 -0
- package/dist/types/minority/minority.d.ts +54 -0
- package/dist/types/minority/minority.d.ts.map +1 -0
- package/dist/types/reports/index.d.ts +9 -0
- package/dist/types/reports/index.d.ts.map +1 -0
- package/dist/types/reports/reports.d.ts +52 -0
- package/dist/types/reports/reports.d.ts.map +1 -0
- package/dist/types/router/index.d.ts +9 -0
- package/dist/types/router/index.d.ts.map +1 -0
- package/dist/types/router/router.d.ts +76 -0
- package/dist/types/router/router.d.ts.map +1 -0
- package/dist/types/scoring/index.d.ts +9 -0
- package/dist/types/scoring/index.d.ts.map +1 -0
- package/dist/types/scoring/scoring.d.ts +65 -0
- package/dist/types/scoring/scoring.d.ts.map +1 -0
- package/dist/types/synthesizer/index.d.ts +9 -0
- package/dist/types/synthesizer/index.d.ts.map +1 -0
- package/dist/types/synthesizer/synthesizer.d.ts +54 -0
- package/dist/types/synthesizer/synthesizer.d.ts.map +1 -0
- package/dist/types/types.d.ts +246 -0
- package/dist/types/types.d.ts.map +1 -0
- package/dist/types/util.d.ts +45 -0
- package/dist/types/util.d.ts.map +1 -0
- package/package.json +48 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analysis.d.ts","sourceRoot":"","sources":["../../../src/analysis/analysis.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAG5C;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAmCzD;AAED;;;;;;;;;;;;;GAaG;AACH,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA+B;IACxD,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAgB;IACtC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAA+B;IACzD,OAAO,CAAC,QAAQ,CAAC,YAAY,CAA+B;IAE5D;;;OAGG;IACH,MAAM,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI;IAchC,8DAA8D;IAC9D,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS;IAIrC,uEAAuE;IACvE,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,QAAQ,EAAE;IAKrC,yEAAyE;IACzE,eAAe,CAAC,YAAY,EAAE,MAAM,GAAG,QAAQ,EAAE;IAKjD,gDAAgD;IAChD,IAAI,IAAI,QAAQ,EAAE;IAIlB,6CAA6C;IAC7C,IAAI,IAAI,MAAM;CAGf"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @manya-os/council — analysis barrel.
|
|
3
|
+
*
|
|
4
|
+
* Copyright 2024 Manya Hael Foundation. All rights reserved.
|
|
5
|
+
* Licensed under the Apache License, Version 2.0.
|
|
6
|
+
*/
|
|
7
|
+
export { validateAnalysis, AnalysisCollector } from './analysis.js';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/analysis/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @manya-os/council — conflict detection.
|
|
3
|
+
*
|
|
4
|
+
* The {@link ConflictDetector} scans a set of {@link Analysis} objects (grouped
|
|
5
|
+
* by `problemId`) and detects three kinds of pairwise conflict:
|
|
6
|
+
*
|
|
7
|
+
* 1. `opposing_conclusion` — both analyses have confidence > 0.6 and
|
|
8
|
+
* opposite polarities (positive vs negative) inferred from their
|
|
9
|
+
* `content` text.
|
|
10
|
+
* 2. `factual_contradiction` — analyses whose `content` overlaps
|
|
11
|
+
* substantially (Jaccard ≥ 0.3) AND have opposite polarities, regardless
|
|
12
|
+
* of confidence.
|
|
13
|
+
* 3. `divergent_reasoning` — analyses with the SAME polarity but whose
|
|
14
|
+
* `reasoning` texts overlap very little (Jaccard < 0.2), suggesting the
|
|
15
|
+
* same conclusion was reached via different paths.
|
|
16
|
+
*
|
|
17
|
+
* Severity is `high` when 3+ analyses are involved or the confidence gap is
|
|
18
|
+
* ≥ 0.5; `medium` when the confidence gap is ≥ 0.2; `low` otherwise. Pairwise
|
|
19
|
+
* conflicts always involve exactly 2 analyses, so the 3+ rule is reserved for
|
|
20
|
+
* future expansion.
|
|
21
|
+
*
|
|
22
|
+
* Copyright 2024 Manya Hael Foundation. All rights reserved.
|
|
23
|
+
* Licensed under the Apache License, Version 2.0.
|
|
24
|
+
*/
|
|
25
|
+
import type { Analysis, Conflict, ConflictSeverity, ConflictType } from '../types.js';
|
|
26
|
+
/** All valid conflict types. */
|
|
27
|
+
export declare const CONFLICT_TYPES: ReadonlyArray<ConflictType>;
|
|
28
|
+
/** All valid conflict severities, least-to-most severe. */
|
|
29
|
+
export declare const CONFLICT_SEVERITIES: ReadonlyArray<ConflictSeverity>;
|
|
30
|
+
/** Minimum confidence (exclusive) for both analyses in an `opposing_conclusion` conflict. */
|
|
31
|
+
export declare const OPPOSING_CONFIDENCE_THRESHOLD = 0.6;
|
|
32
|
+
/** Minimum content-overlap Jaccard for a `factual_contradiction` conflict. */
|
|
33
|
+
export declare const FACTUAL_OVERLAP_THRESHOLD = 0.3;
|
|
34
|
+
/** Maximum reasoning-overlap Jaccard for a `divergent_reasoning` conflict. */
|
|
35
|
+
export declare const DIVERGENT_REASONING_MAX_OVERLAP = 0.2;
|
|
36
|
+
/** Minimum content-overlap Jaccard for a `divergent_reasoning` conflict. */
|
|
37
|
+
export declare const DIVERGENT_CONTENT_MIN_OVERLAP = 0.1;
|
|
38
|
+
/** Confidence-gap thresholds used to compute severity. */
|
|
39
|
+
export declare const SEVERITY_HIGH_GAP = 0.5;
|
|
40
|
+
export declare const SEVERITY_MEDIUM_GAP = 0.2;
|
|
41
|
+
/**
|
|
42
|
+
* Computes the severity of a conflict based on the number of analyses involved
|
|
43
|
+
* and the confidence gap between them.
|
|
44
|
+
*/
|
|
45
|
+
export declare function severityFor(numAnalyses: number, confidenceGap: number): ConflictSeverity;
|
|
46
|
+
/**
|
|
47
|
+
* Conflict detector. Stateless; safe to reuse across many `detect` calls.
|
|
48
|
+
*
|
|
49
|
+
* Usage:
|
|
50
|
+
* ```ts
|
|
51
|
+
* const detector = new ConflictDetector();
|
|
52
|
+
* const conflicts = detector.detect(analyses);
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
export declare class ConflictDetector {
|
|
56
|
+
/**
|
|
57
|
+
* Scans `analyses` and returns every detected conflict. Conflicts are
|
|
58
|
+
* pairwise and tagged by `type`. The returned array is sorted by type then
|
|
59
|
+
* by the ids of the analyses involved for deterministic output.
|
|
60
|
+
*/
|
|
61
|
+
detect(analyses: Analysis[]): Conflict[];
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=conflict.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conflict.d.ts","sourceRoot":"","sources":["../../../src/conflict/conflict.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAItF,gCAAgC;AAChC,eAAO,MAAM,cAAc,EAAE,aAAa,CAAC,YAAY,CAEtD,CAAC;AAEF,2DAA2D;AAC3D,eAAO,MAAM,mBAAmB,EAAE,aAAa,CAAC,gBAAgB,CAE/D,CAAC;AAEF,6FAA6F;AAC7F,eAAO,MAAM,6BAA6B,MAAM,CAAC;AAEjD,8EAA8E;AAC9E,eAAO,MAAM,yBAAyB,MAAM,CAAC;AAE7C,8EAA8E;AAC9E,eAAO,MAAM,+BAA+B,MAAM,CAAC;AAEnD,4EAA4E;AAC5E,eAAO,MAAM,6BAA6B,MAAM,CAAC;AAEjD,0DAA0D;AAC1D,eAAO,MAAM,iBAAiB,MAAM,CAAC;AACrC,eAAO,MAAM,mBAAmB,MAAM,CAAC;AAEvC;;;GAGG;AACH,wBAAgB,WAAW,CAAC,WAAW,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,gBAAgB,CAIxF;AAED;;;;;;;;GAQG;AACH,qBAAa,gBAAgB;IAC3B;;;;OAIG;IACH,MAAM,CAAC,QAAQ,EAAE,QAAQ,EAAE,GAAG,QAAQ,EAAE;CAgGzC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @manya-os/council — conflict barrel.
|
|
3
|
+
*
|
|
4
|
+
* Copyright 2024 Manya Hael Foundation. All rights reserved.
|
|
5
|
+
* Licensed under the Apache License, Version 2.0.
|
|
6
|
+
*/
|
|
7
|
+
export { ConflictDetector, severityFor, CONFLICT_TYPES, CONFLICT_SEVERITIES, OPPOSING_CONFIDENCE_THRESHOLD, FACTUAL_OVERLAP_THRESHOLD, DIVERGENT_REASONING_MAX_OVERLAP, DIVERGENT_CONTENT_MIN_OVERLAP, SEVERITY_HIGH_GAP, SEVERITY_MEDIUM_GAP, } from './conflict.js';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/conflict/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,gBAAgB,EAAE,WAAW,EAC7B,cAAc,EAAE,mBAAmB,EACnC,6BAA6B,EAAE,yBAAyB,EACxD,+BAA+B,EAAE,6BAA6B,EAC9D,iBAAiB,EAAE,mBAAmB,GACvC,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @manya-os/council — consensus building.
|
|
3
|
+
*
|
|
4
|
+
* The {@link ConsensusBuilder} aggregates a set of analyses (each carrying a
|
|
5
|
+
* polarity inferred from its `content` text and a `confidence` in `[0, 1]`)
|
|
6
|
+
* into a {@link Consensus} decision via weighted voting:
|
|
7
|
+
*
|
|
8
|
+
* - Each analysis contributes `specialistWeight × confidence` to its
|
|
9
|
+
* polarity's tally.
|
|
10
|
+
* - The polarity with the largest tally wins.
|
|
11
|
+
* - The weighted support ratio is `winnerTally / totalTally`.
|
|
12
|
+
* - When the ratio is `≥ threshold` (default `0.6`), a {@link Consensus} is
|
|
13
|
+
* returned; otherwise `null` (no consensus).
|
|
14
|
+
*
|
|
15
|
+
* `conflictsResolved` lists the ids of all conflicts pertaining to the
|
|
16
|
+
* problem; `openIssues` lists high-severity conflicts that remain unresolved.
|
|
17
|
+
*
|
|
18
|
+
* Copyright 2024 Manya Hael Foundation. All rights reserved.
|
|
19
|
+
* Licensed under the Apache License, Version 2.0.
|
|
20
|
+
*/
|
|
21
|
+
import type { Analysis, Conflict, Consensus } from '../types.js';
|
|
22
|
+
/** Default weighted-support threshold for consensus. */
|
|
23
|
+
export declare const DEFAULT_CONSENSUS_THRESHOLD = 0.6;
|
|
24
|
+
/** Options accepted by `ConsensusBuilder.build`. */
|
|
25
|
+
export interface ConsensusBuildOptions {
|
|
26
|
+
/**
|
|
27
|
+
* Map of `specialistId → weight`. When a specialist's id is not present,
|
|
28
|
+
* weight defaults to `1`. When omitted entirely, every specialist gets
|
|
29
|
+
* weight `1`.
|
|
30
|
+
*/
|
|
31
|
+
weights?: Record<string, number>;
|
|
32
|
+
/**
|
|
33
|
+
* Optional list of analyst ids who recorded a minority opinion. These are
|
|
34
|
+
* added to `dissentingAnalystIds` (de-duplicated) so that dissent is
|
|
35
|
+
* reflected even when the analyst's analysis was not strictly opposite in
|
|
36
|
+
* polarity.
|
|
37
|
+
*/
|
|
38
|
+
minorityAnalystIds?: string[];
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Consensus builder. Stateless aside from its configured threshold. Safe to
|
|
42
|
+
* reuse across many `build` calls.
|
|
43
|
+
*
|
|
44
|
+
* Usage:
|
|
45
|
+
* ```ts
|
|
46
|
+
* const builder = new ConsensusBuilder(0.6);
|
|
47
|
+
* const consensus = builder.build('p1', analyses, conflicts, {
|
|
48
|
+
* weights: { sec: 2, fin: 1 },
|
|
49
|
+
* });
|
|
50
|
+
* if (!consensus) console.log('no consensus');
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
export declare class ConsensusBuilder {
|
|
54
|
+
private readonly threshold;
|
|
55
|
+
/**
|
|
56
|
+
* @param threshold Weighted support ratio in `[0, 1]` required to reach
|
|
57
|
+
* consensus. Defaults to {@link DEFAULT_CONSENSUS_THRESHOLD}.
|
|
58
|
+
*/
|
|
59
|
+
constructor(threshold?: number);
|
|
60
|
+
/** Returns the configured threshold. */
|
|
61
|
+
getThreshold(): number;
|
|
62
|
+
/**
|
|
63
|
+
* Builds a {@link Consensus} for `problemId` from `analyses` and any
|
|
64
|
+
* detected `conflicts`. Returns `null` when:
|
|
65
|
+
* - there are no analyses,
|
|
66
|
+
* - no analysis has a non-`neutral` polarity,
|
|
67
|
+
* - the weighted support ratio of the winning polarity is below the
|
|
68
|
+
* configured threshold.
|
|
69
|
+
*/
|
|
70
|
+
build(problemId: string, analyses: Analysis[], conflicts?: Conflict[], options?: ConsensusBuildOptions): Consensus | null;
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=consensus.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"consensus.d.ts","sourceRoot":"","sources":["../../../src/consensus/consensus.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAIjE,wDAAwD;AACxD,eAAO,MAAM,2BAA2B,MAAM,CAAC;AAE/C,oDAAoD;AACpD,MAAM,WAAW,qBAAqB;IACpC;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC;;;;;OAKG;IACH,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;CAC/B;AAED;;;;;;;;;;;;GAYG;AACH,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;IAEnC;;;OAGG;gBACS,SAAS,GAAE,MAAoC;IAQ3D,wCAAwC;IACxC,YAAY,IAAI,MAAM;IAItB;;;;;;;OAOG;IACH,KAAK,CACH,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,QAAQ,EAAE,EACpB,SAAS,GAAE,QAAQ,EAAO,EAC1B,OAAO,GAAE,qBAA0B,GAClC,SAAS,GAAG,IAAI;CAyFpB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @manya-os/council — consensus barrel.
|
|
3
|
+
*
|
|
4
|
+
* Copyright 2024 Manya Hael Foundation. All rights reserved.
|
|
5
|
+
* Licensed under the Apache License, Version 2.0.
|
|
6
|
+
*/
|
|
7
|
+
export { ConsensusBuilder, DEFAULT_CONSENSUS_THRESHOLD } from './consensus.js';
|
|
8
|
+
export type { ConsensusBuildOptions } from './consensus.js';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/consensus/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,gBAAgB,EAAE,2BAA2B,EAAE,MAAM,gBAAgB,CAAC;AAC/E,YAAY,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @manya-os/council — structured debate.
|
|
3
|
+
*
|
|
4
|
+
* The {@link DebateFacilitator} opens a debate over a set of conflicts, accepts
|
|
5
|
+
* debate rounds (each a claim + evidence, optionally rebutting a prior round),
|
|
6
|
+
* and concludes the debate. Rounds are validated and rebuttals must reference
|
|
7
|
+
* an existing round id.
|
|
8
|
+
*
|
|
9
|
+
* Copyright 2024 Manya Hael Foundation. All rights reserved.
|
|
10
|
+
* Licensed under the Apache License, Version 2.0.
|
|
11
|
+
*/
|
|
12
|
+
import type { Debate, DebateRound } from '../types.js';
|
|
13
|
+
/** Default maximum number of rounds per debate. */
|
|
14
|
+
export declare const DEFAULT_MAX_DEBATE_ROUNDS = 10;
|
|
15
|
+
/**
|
|
16
|
+
* Validates a debate round structurally. Throws `DebateError` on invalid
|
|
17
|
+
* fields. Does NOT check `rebuttalTo` against existing rounds (that requires
|
|
18
|
+
* debate context).
|
|
19
|
+
*/
|
|
20
|
+
export declare function validateRound(round: DebateRound): void;
|
|
21
|
+
/**
|
|
22
|
+
* Stateful debate facilitator. Owns a map of debate id → {@link Debate}.
|
|
23
|
+
*
|
|
24
|
+
* Usage:
|
|
25
|
+
* ```ts
|
|
26
|
+
* const facilitator = new DebateFacilitator();
|
|
27
|
+
* const debate = facilitator.open('p1', ['c1']);
|
|
28
|
+
* facilitator.submitRound(debate.id, {
|
|
29
|
+
* id: 'r1', analystId: 'sec', claim: 'The proposal is sound.',
|
|
30
|
+
* evidence: 'Tests pass and risks are low.',
|
|
31
|
+
* });
|
|
32
|
+
* facilitator.conclude(debate.id);
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
export declare class DebateFacilitator {
|
|
36
|
+
private readonly debates;
|
|
37
|
+
private readonly maxRounds;
|
|
38
|
+
private counter;
|
|
39
|
+
/**
|
|
40
|
+
* @param maxRounds Maximum rounds per debate. Defaults to
|
|
41
|
+
* {@link DEFAULT_MAX_DEBATE_ROUNDS}.
|
|
42
|
+
*/
|
|
43
|
+
constructor(maxRounds?: number);
|
|
44
|
+
/**
|
|
45
|
+
* Opens a new debate over `problemId` triggered by the given conflict ids.
|
|
46
|
+
* Returns the newly created (empty, status `'open'`) debate.
|
|
47
|
+
*/
|
|
48
|
+
open(problemId: string, conflictIds?: string[]): Debate;
|
|
49
|
+
/**
|
|
50
|
+
* Appends `round` to the debate with id `debateId`. Throws `DebateError`
|
|
51
|
+
* when:
|
|
52
|
+
* - the debate does not exist,
|
|
53
|
+
* - the debate is already concluded,
|
|
54
|
+
* - the round is malformed,
|
|
55
|
+
* - the round's `rebuttalTo` does not reference an existing round,
|
|
56
|
+
* - a round with the same id already exists in the debate,
|
|
57
|
+
* - the maximum number of rounds has been reached.
|
|
58
|
+
*
|
|
59
|
+
* Returns the (mutated) debate.
|
|
60
|
+
*/
|
|
61
|
+
submitRound(debateId: string, round: DebateRound): Debate;
|
|
62
|
+
/**
|
|
63
|
+
* Concludes the debate with id `debateId`. Sets `status` to `'concluded'`
|
|
64
|
+
* and stamps `concludedAt`. Throws `DebateError` if the debate does not
|
|
65
|
+
* exist or is already concluded. Returns the (mutated) debate.
|
|
66
|
+
*/
|
|
67
|
+
conclude(debateId: string): Debate;
|
|
68
|
+
/** Returns the debate with the given id, or `undefined`. */
|
|
69
|
+
get(debateId: string): Debate | undefined;
|
|
70
|
+
/** Returns all debates, in opening order. */
|
|
71
|
+
list(): Debate[];
|
|
72
|
+
/** Returns the configured maximum number of rounds per debate. */
|
|
73
|
+
getMaxRounds(): number;
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=debate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"debate.d.ts","sourceRoot":"","sources":["../../../src/debate/debate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAGvD,mDAAmD;AACnD,eAAO,MAAM,yBAAyB,KAAK,CAAC;AAE5C;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,WAAW,GAAG,IAAI,CAqBtD;AAED;;;;;;;;;;;;;GAaG;AACH,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA6B;IACrD,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;IACnC,OAAO,CAAC,OAAO,CAAK;IAEpB;;;OAGG;gBACS,SAAS,GAAE,MAAkC;IAOzD;;;OAGG;IACH,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,WAAW,GAAE,MAAM,EAAO,GAAG,MAAM;IA0B3D;;;;;;;;;;;OAWG;IACH,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,GAAG,MAAM;IA6BzD;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;IAalC,4DAA4D;IAC5D,GAAG,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAIzC,6CAA6C;IAC7C,IAAI,IAAI,MAAM,EAAE;IAIhB,kEAAkE;IAClE,YAAY,IAAI,MAAM;CAGvB"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @manya-os/council — debate barrel.
|
|
3
|
+
*
|
|
4
|
+
* Copyright 2024 Manya Hael Foundation. All rights reserved.
|
|
5
|
+
* Licensed under the Apache License, Version 2.0.
|
|
6
|
+
*/
|
|
7
|
+
export { DebateFacilitator, validateRound, DEFAULT_MAX_DEBATE_ROUNDS } from './debate.js';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/debate/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @manya-os/council — typed error hierarchy.
|
|
3
|
+
*
|
|
4
|
+
* Every public @manya-os/council API throws a subclass of `CouncilError`. Errors
|
|
5
|
+
* carry a stable `code` string for programmatic discrimination.
|
|
6
|
+
*
|
|
7
|
+
* Copyright 2024 Manya Hael Foundation. All rights reserved.
|
|
8
|
+
* Licensed under the Apache License, Version 2.0.
|
|
9
|
+
*/
|
|
10
|
+
/** Base class for all @manya-os/council errors. */
|
|
11
|
+
export declare class CouncilError extends Error {
|
|
12
|
+
readonly code: string;
|
|
13
|
+
readonly cause?: unknown;
|
|
14
|
+
constructor(message: string, code?: string, cause?: unknown);
|
|
15
|
+
}
|
|
16
|
+
/** Raised when specialist routing fails or a specialist is malformed. */
|
|
17
|
+
export declare class RoutingError extends CouncilError {
|
|
18
|
+
constructor(message: string, cause?: unknown);
|
|
19
|
+
}
|
|
20
|
+
/** Raised when an analysis is malformed or cannot be submitted. */
|
|
21
|
+
export declare class AnalysisError extends CouncilError {
|
|
22
|
+
constructor(message: string, cause?: unknown);
|
|
23
|
+
}
|
|
24
|
+
/** Raised when confidence scoring fails (e.g. invalid weights or inputs). */
|
|
25
|
+
export declare class ScoringError extends CouncilError {
|
|
26
|
+
constructor(message: string, cause?: unknown);
|
|
27
|
+
}
|
|
28
|
+
/** Raised when conflict detection fails or encounters malformed input. */
|
|
29
|
+
export declare class ConflictError extends CouncilError {
|
|
30
|
+
constructor(message: string, cause?: unknown);
|
|
31
|
+
}
|
|
32
|
+
/** Raised when a debate cannot be opened, advanced, or concluded. */
|
|
33
|
+
export declare class DebateError extends CouncilError {
|
|
34
|
+
constructor(message: string, cause?: unknown);
|
|
35
|
+
}
|
|
36
|
+
/** Raised when consensus cannot be built (e.g. invalid threshold). */
|
|
37
|
+
export declare class ConsensusError extends CouncilError {
|
|
38
|
+
constructor(message: string, cause?: unknown);
|
|
39
|
+
}
|
|
40
|
+
/** Raised when decision synthesis fails (e.g. invalid inputs). */
|
|
41
|
+
export declare class SynthesisError extends CouncilError {
|
|
42
|
+
constructor(message: string, cause?: unknown);
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,mDAAmD;AACnD,qBAAa,YAAa,SAAQ,KAAK;IACrC,SAAgB,IAAI,EAAE,MAAM,CAAC;IAC7B,SAAyB,KAAK,CAAC,EAAE,OAAO,CAAC;gBAC7B,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO;CAO5D;AAED,yEAAyE;AACzE,qBAAa,YAAa,SAAQ,YAAY;gBAChC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO;CAC7C;AAED,mEAAmE;AACnE,qBAAa,aAAc,SAAQ,YAAY;gBACjC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO;CAC7C;AAED,6EAA6E;AAC7E,qBAAa,YAAa,SAAQ,YAAY;gBAChC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO;CAC7C;AAED,0EAA0E;AAC1E,qBAAa,aAAc,SAAQ,YAAY;gBACjC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO;CAC7C;AAED,qEAAqE;AACrE,qBAAa,WAAY,SAAQ,YAAY;gBAC/B,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO;CAC7C;AAED,sEAAsE;AACtE,qBAAa,cAAe,SAAQ,YAAY;gBAClC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO;CAC7C;AAED,kEAAkE;AAClE,qBAAa,cAAe,SAAQ,YAAY;gBAClC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO;CAC7C"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @manya-os/council — multi-agent consensus engine for the MANYA Intelligence OS.
|
|
3
|
+
*
|
|
4
|
+
* Public API surface for @manya-os/council. Everything exported here is part of
|
|
5
|
+
* the stable, semver-bound public API.
|
|
6
|
+
*
|
|
7
|
+
* Capabilities:
|
|
8
|
+
* - Specialist routing (`SpecialistRegistry`, `route`, `routeAll`).
|
|
9
|
+
* - Independent analysis collection (`AnalysisCollector`).
|
|
10
|
+
* - Weighted confidence scoring (`scoreAnalysis`, `aggregateScores`,
|
|
11
|
+
* `detectOutliers`).
|
|
12
|
+
* - Conflict detection (`ConflictDetector`).
|
|
13
|
+
* - Structured debate (`DebateFacilitator`).
|
|
14
|
+
* - Minority opinion tracking (`MinorityOpinionTracker`).
|
|
15
|
+
* - Consensus building (`ConsensusBuilder`).
|
|
16
|
+
* - Review reports (`buildReport`, `serializeReport`, `summarizeReport`).
|
|
17
|
+
* - Decision synthesis (`synthesize`, `classifyConsensus`).
|
|
18
|
+
*
|
|
19
|
+
* Copyright 2024 Manya Hael Foundation. All rights reserved.
|
|
20
|
+
* Conceived, directed, and owned by Uviwe Menyiwe (Azura Daemon), founder
|
|
21
|
+
* of the Manya Hael Foundation.
|
|
22
|
+
*
|
|
23
|
+
* Licensed under the Apache License, Version 2.0.
|
|
24
|
+
*/
|
|
25
|
+
export * from './types.js';
|
|
26
|
+
export * from './errors.js';
|
|
27
|
+
export { Logger, LogLevel, ConsoleLogger, SilentLogger, scrubMetadata, shouldScrubField, SCRUBBED_FIELD_NAMES, } from './logging.js';
|
|
28
|
+
export { validateSpecialist, matchScore, route, routeAll, SpecialistRegistry, } from './router/router.js';
|
|
29
|
+
export type { SpecialistMatch } from './router/router.js';
|
|
30
|
+
export { validateAnalysis, AnalysisCollector } from './analysis/analysis.js';
|
|
31
|
+
export { scoreAnalysis, aggregateScores, detectOutliers, DEFAULT_OUTLIER_THRESHOLD, } from './scoring/scoring.js';
|
|
32
|
+
export type { WeightedScore, AggregatedScore } from './scoring/scoring.js';
|
|
33
|
+
export { ConflictDetector, severityFor, CONFLICT_TYPES, CONFLICT_SEVERITIES, OPPOSING_CONFIDENCE_THRESHOLD, FACTUAL_OVERLAP_THRESHOLD, DIVERGENT_REASONING_MAX_OVERLAP, DIVERGENT_CONTENT_MIN_OVERLAP, SEVERITY_HIGH_GAP, SEVERITY_MEDIUM_GAP, } from './conflict/conflict.js';
|
|
34
|
+
export { DebateFacilitator, validateRound, DEFAULT_MAX_DEBATE_ROUNDS } from './debate/debate.js';
|
|
35
|
+
export { validateMinorityOpinion, MinorityOpinionTracker } from './minority/minority.js';
|
|
36
|
+
export { ConsensusBuilder, DEFAULT_CONSENSUS_THRESHOLD } from './consensus/consensus.js';
|
|
37
|
+
export type { ConsensusBuildOptions } from './consensus/consensus.js';
|
|
38
|
+
export { buildReport, serializeReport, summarizeReport } from './reports/reports.js';
|
|
39
|
+
export type { BuildReportInput } from './reports/reports.js';
|
|
40
|
+
export { synthesize, classifyConsensus, DEFAULT_SYNTHESIS_THRESHOLD, STRONG_CONSENSUS_RATIO, } from './synthesizer/synthesizer.js';
|
|
41
|
+
export type { SynthesizeOptions } from './synthesizer/synthesizer.js';
|
|
42
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAGH,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAG5B,OAAO,EACL,MAAM,EAAE,QAAQ,EAAE,aAAa,EAAE,YAAY,EAC7C,aAAa,EAAE,gBAAgB,EAAE,oBAAoB,GACtD,MAAM,cAAc,CAAC;AAGtB,OAAO,EACL,kBAAkB,EAAE,UAAU,EAAE,KAAK,EAAE,QAAQ,EAAE,kBAAkB,GACpE,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAG1D,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAG7E,OAAO,EACL,aAAa,EAAE,eAAe,EAAE,cAAc,EAAE,yBAAyB,GAC1E,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAG3E,OAAO,EACL,gBAAgB,EAAE,WAAW,EAC7B,cAAc,EAAE,mBAAmB,EACnC,6BAA6B,EAAE,yBAAyB,EACxD,+BAA+B,EAAE,6BAA6B,EAC9D,iBAAiB,EAAE,mBAAmB,GACvC,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAGjG,OAAO,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAGzF,OAAO,EAAE,gBAAgB,EAAE,2BAA2B,EAAE,MAAM,0BAA0B,CAAC;AACzF,YAAY,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAGtE,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACrF,YAAY,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAG7D,OAAO,EACL,UAAU,EAAE,iBAAiB,EAC7B,2BAA2B,EAAE,sBAAsB,GACpD,MAAM,8BAA8B,CAAC;AACtC,YAAY,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @manya-os/council — structured logging (mirrors @manya-os/keyring pattern).
|
|
3
|
+
*
|
|
4
|
+
* Copyright 2024 Manya Hael Foundation. All rights reserved.
|
|
5
|
+
* Licensed under the Apache License, Version 2.0.
|
|
6
|
+
*/
|
|
7
|
+
/** Logger interface used throughout @manya-os/council. */
|
|
8
|
+
export interface Logger {
|
|
9
|
+
debug(msg: string, meta?: Record<string, unknown>): void;
|
|
10
|
+
info(msg: string, meta?: Record<string, unknown>): void;
|
|
11
|
+
warn(msg: string, meta?: Record<string, unknown>): void;
|
|
12
|
+
error(msg: string, meta?: Record<string, unknown>): void;
|
|
13
|
+
}
|
|
14
|
+
/** Severity levels supported by the logger. `'silent'` emits nothing. */
|
|
15
|
+
export type LogLevel = 'debug' | 'info' | 'warn' | 'error' | 'silent';
|
|
16
|
+
/** Field names that are always redacted when scrubbing log metadata. */
|
|
17
|
+
export declare const SCRUBBED_FIELD_NAMES: readonly ["taxId", "secret", "token", "apiKey", "password"];
|
|
18
|
+
/** Returns true when `name` matches a scrubbed field (case-insensitive, suffix-aware). */
|
|
19
|
+
export declare function shouldScrubField(name: string): boolean;
|
|
20
|
+
/** Recursively scrubs sensitive fields from `meta`, returning a safe copy. */
|
|
21
|
+
export declare function scrubMetadata(meta: unknown): unknown;
|
|
22
|
+
/** Logger that writes JSON lines to stdout/stderr. */
|
|
23
|
+
export declare class ConsoleLogger implements Logger {
|
|
24
|
+
private readonly level;
|
|
25
|
+
private readonly levelRank;
|
|
26
|
+
constructor(level?: LogLevel);
|
|
27
|
+
debug(msg: string, meta?: Record<string, unknown>): void;
|
|
28
|
+
info(msg: string, meta?: Record<string, unknown>): void;
|
|
29
|
+
warn(msg: string, meta?: Record<string, unknown>): void;
|
|
30
|
+
error(msg: string, meta?: Record<string, unknown>): void;
|
|
31
|
+
private emit;
|
|
32
|
+
}
|
|
33
|
+
/** Logger that discards everything. */
|
|
34
|
+
export declare class SilentLogger implements Logger {
|
|
35
|
+
debug(): void;
|
|
36
|
+
info(): void;
|
|
37
|
+
warn(): void;
|
|
38
|
+
error(): void;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=logging.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logging.d.ts","sourceRoot":"","sources":["../../src/logging.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,0DAA0D;AAC1D,MAAM,WAAW,MAAM;IACrB,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IACzD,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IACxD,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IACxD,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;CAC1D;AAED,yEAAyE;AACzE,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAC;AAMtE,wEAAwE;AACxE,eAAO,MAAM,oBAAoB,6DAEvB,CAAC;AAEX,0FAA0F;AAC1F,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAQtD;AAED,8EAA8E;AAC9E,wBAAgB,aAAa,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAWpD;AAED,sDAAsD;AACtD,qBAAa,aAAc,YAAW,MAAM;IAE9B,OAAO,CAAC,QAAQ,CAAC,KAAK;IADlC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;gBACN,KAAK,GAAE,QAAiB;IAGrD,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IACxD,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IACvD,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IACvD,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IACxD,OAAO,CAAC,IAAI;CASb;AAED,uCAAuC;AACvC,qBAAa,YAAa,YAAW,MAAM;IACzC,KAAK,IAAI,IAAI;IACb,IAAI,IAAI,IAAI;IACZ,IAAI,IAAI,IAAI;IACZ,KAAK,IAAI,IAAI;CACd"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @manya-os/council — minority opinion barrel.
|
|
3
|
+
*
|
|
4
|
+
* Copyright 2024 Manya Hael Foundation. All rights reserved.
|
|
5
|
+
* Licensed under the Apache License, Version 2.0.
|
|
6
|
+
*/
|
|
7
|
+
export { validateMinorityOpinion, MinorityOpinionTracker } from './minority.js';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/minority/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @manya-os/council — minority opinion tracking.
|
|
3
|
+
*
|
|
4
|
+
* The {@link MinorityOpinionTracker} is a stateful store for
|
|
5
|
+
* {@link MinorityOpinion} records. Analysts who disagree with the consensus
|
|
6
|
+
* can record a minority opinion (with a position, reasoning, and explicit
|
|
7
|
+
* dissent reason) so that dissent is preserved alongside the decision.
|
|
8
|
+
*
|
|
9
|
+
* Copyright 2024 Manya Hael Foundation. All rights reserved.
|
|
10
|
+
* Licensed under the Apache License, Version 2.0.
|
|
11
|
+
*/
|
|
12
|
+
import type { MinorityOpinion } from '../types.js';
|
|
13
|
+
/**
|
|
14
|
+
* Validates a minority opinion structurally. Throws `CouncilError` on invalid
|
|
15
|
+
* fields.
|
|
16
|
+
*/
|
|
17
|
+
export declare function validateMinorityOpinion(opinion: MinorityOpinion): void;
|
|
18
|
+
/**
|
|
19
|
+
* Stateful minority opinion tracker. Records are indexed by problem id and
|
|
20
|
+
* analyst id for fast lookup.
|
|
21
|
+
*
|
|
22
|
+
* Usage:
|
|
23
|
+
* ```ts
|
|
24
|
+
* const tracker = new MinorityOpinionTracker();
|
|
25
|
+
* tracker.record({
|
|
26
|
+
* id: 'mo1', problemId: 'p1', analystId: 'fin',
|
|
27
|
+
* position: 'Reject the proposal.', reasoning: 'Cost is too high.',
|
|
28
|
+
* dissentReason: 'The consensus ignored the budget impact.',
|
|
29
|
+
* });
|
|
30
|
+
* tracker.getForProblem('p1'); // [opinion]
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export declare class MinorityOpinionTracker {
|
|
34
|
+
private readonly opinions;
|
|
35
|
+
private readonly order;
|
|
36
|
+
private readonly byProblem;
|
|
37
|
+
private readonly byAnalyst;
|
|
38
|
+
/**
|
|
39
|
+
* Validates and stores `opinion`. Throws `CouncilError` when the opinion is
|
|
40
|
+
* malformed or an opinion with the same id has already been recorded.
|
|
41
|
+
*/
|
|
42
|
+
record(opinion: MinorityOpinion): this;
|
|
43
|
+
/** Returns the opinion with the given id, or `undefined`. */
|
|
44
|
+
get(id: string): MinorityOpinion | undefined;
|
|
45
|
+
/** Returns all minority opinions for the given problem, in record order. */
|
|
46
|
+
getForProblem(problemId: string): MinorityOpinion[];
|
|
47
|
+
/** Returns all minority opinions by the given analyst, in record order. */
|
|
48
|
+
getByAnalyst(analystId: string): MinorityOpinion[];
|
|
49
|
+
/** Returns all minority opinions in record order. */
|
|
50
|
+
list(): MinorityOpinion[];
|
|
51
|
+
/** Returns the number of opinions stored. */
|
|
52
|
+
size(): number;
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=minority.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"minority.d.ts","sourceRoot":"","sources":["../../../src/minority/minority.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAGnD;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,eAAe,GAAG,IAAI,CAsBtE;AAED;;;;;;;;;;;;;;GAcG;AACH,qBAAa,sBAAsB;IACjC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAsC;IAC/D,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAgB;IACtC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAA+B;IACzD,OAAO,CAAC,QAAQ,CAAC,SAAS,CAA+B;IAEzD;;;OAGG;IACH,MAAM,CAAC,OAAO,EAAE,eAAe,GAAG,IAAI;IActC,6DAA6D;IAC7D,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS;IAI5C,4EAA4E;IAC5E,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,eAAe,EAAE;IAKnD,2EAA2E;IAC3E,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,eAAe,EAAE;IAKlD,qDAAqD;IACrD,IAAI,IAAI,eAAe,EAAE;IAIzB,6CAA6C;IAC7C,IAAI,IAAI,MAAM;CAGf"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @manya-os/council — reports barrel.
|
|
3
|
+
*
|
|
4
|
+
* Copyright 2024 Manya Hael Foundation. All rights reserved.
|
|
5
|
+
* Licensed under the Apache License, Version 2.0.
|
|
6
|
+
*/
|
|
7
|
+
export { buildReport, serializeReport, summarizeReport } from './reports.js';
|
|
8
|
+
export type { BuildReportInput } from './reports.js';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/reports/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC7E,YAAY,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @manya-os/council — review reports.
|
|
3
|
+
*
|
|
4
|
+
* The reports module aggregates everything the council produced for a single
|
|
5
|
+
* problem — analyses, conflicts, debates, minority opinions, the consensus
|
|
6
|
+
* (if any), and recommendations — into a single {@link ReviewReport}. The
|
|
7
|
+
* report can be serialized to JSON (`serializeReport`) or summarized into a
|
|
8
|
+
* single human-readable paragraph (`summarizeReport`).
|
|
9
|
+
*
|
|
10
|
+
* Copyright 2024 Manya Hael Foundation. All rights reserved.
|
|
11
|
+
* Licensed under the Apache License, Version 2.0.
|
|
12
|
+
*/
|
|
13
|
+
import type { Analysis, Conflict, Consensus, Debate, MinorityOpinion, ReviewReport } from '../types.js';
|
|
14
|
+
/** Inputs to `buildReport`. */
|
|
15
|
+
export interface BuildReportInput {
|
|
16
|
+
/** The problem id the report covers. */
|
|
17
|
+
problemId: string;
|
|
18
|
+
/** All analyses included in the review. */
|
|
19
|
+
analyses: Analysis[];
|
|
20
|
+
/** All conflicts detected. Defaults to `[]`. */
|
|
21
|
+
conflicts?: Conflict[];
|
|
22
|
+
/** All debates held. Defaults to `[]`. */
|
|
23
|
+
debates?: Debate[];
|
|
24
|
+
/** All minority opinions recorded. Defaults to `[]`. */
|
|
25
|
+
minorityOpinions?: MinorityOpinion[];
|
|
26
|
+
/** The consensus reached, if any. Defaults to `null`. */
|
|
27
|
+
consensus?: Consensus | null;
|
|
28
|
+
/** Actionable recommendations. Defaults to `[]`. */
|
|
29
|
+
recommendations?: string[];
|
|
30
|
+
/** Optional explicit report id. Auto-generated when omitted. */
|
|
31
|
+
reportId?: string;
|
|
32
|
+
/** Optional explicit generation timestamp (ISO 8601). Defaults to now. */
|
|
33
|
+
generatedAt?: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Builds a {@link ReviewReport} from the given inputs. Defensively copies all
|
|
37
|
+
* array inputs and computes a short summary.
|
|
38
|
+
*
|
|
39
|
+
* Throws `CouncilError` when `problemId` is missing or `analyses` is not an
|
|
40
|
+
* array.
|
|
41
|
+
*/
|
|
42
|
+
export declare function buildReport(input: BuildReportInput): ReviewReport;
|
|
43
|
+
/**
|
|
44
|
+
* Serializes a {@link ReviewReport} to a pretty-printed JSON string. Throws
|
|
45
|
+
* `CouncilError` when serialization fails (e.g. circular references).
|
|
46
|
+
*/
|
|
47
|
+
export declare function serializeReport(report: ReviewReport): string;
|
|
48
|
+
/**
|
|
49
|
+
* Summarizes a {@link ReviewReport} into a single human-readable paragraph.
|
|
50
|
+
*/
|
|
51
|
+
export declare function summarizeReport(report: ReviewReport): string;
|
|
52
|
+
//# sourceMappingURL=reports.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reports.d.ts","sourceRoot":"","sources":["../../../src/reports/reports.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EACV,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,eAAe,EAAE,YAAY,EACrE,MAAM,aAAa,CAAC;AAGrB,+BAA+B;AAC/B,MAAM,WAAW,gBAAgB;IAC/B,wCAAwC;IACxC,SAAS,EAAE,MAAM,CAAC;IAClB,2CAA2C;IAC3C,QAAQ,EAAE,QAAQ,EAAE,CAAC;IACrB,gDAAgD;IAChD,SAAS,CAAC,EAAE,QAAQ,EAAE,CAAC;IACvB,0CAA0C;IAC1C,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,wDAAwD;IACxD,gBAAgB,CAAC,EAAE,eAAe,EAAE,CAAC;IACrC,yDAAyD;IACzD,SAAS,CAAC,EAAE,SAAS,GAAG,IAAI,CAAC;IAC7B,oDAAoD;IACpD,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3B,gEAAgE;IAChE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,0EAA0E;IAC1E,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,GAAG,YAAY,CAkCjE;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,CAS5D;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,CAuB5D"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @manya-os/council — router barrel.
|
|
3
|
+
*
|
|
4
|
+
* Copyright 2024 Manya Hael Foundation. All rights reserved.
|
|
5
|
+
* Licensed under the Apache License, Version 2.0.
|
|
6
|
+
*/
|
|
7
|
+
export { validateSpecialist, matchScore, route, routeAll, SpecialistRegistry, } from './router.js';
|
|
8
|
+
export type { SpecialistMatch } from './router.js';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/router/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,kBAAkB,EAAE,UAAU,EAAE,KAAK,EAAE,QAAQ,EAAE,kBAAkB,GACpE,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC"}
|