@balpal4495/quorum 3.0.4 → 3.1.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/dist/advisor/ask.d.ts +13 -0
- package/dist/advisor/ask.d.ts.map +1 -0
- package/dist/advisor/ask.js +67 -0
- package/dist/advisor/ask.js.map +1 -0
- package/dist/advisor/index.d.ts +3 -0
- package/dist/advisor/index.d.ts.map +1 -0
- package/dist/advisor/index.js +2 -0
- package/dist/advisor/index.js.map +1 -0
- package/dist/advisor/prompt.d.ts +5 -0
- package/dist/advisor/prompt.d.ts.map +1 -0
- package/{modules/advisor/prompt.ts → dist/advisor/prompt.js} +22 -26
- package/dist/advisor/prompt.js.map +1 -0
- package/dist/advisor/types.d.ts +23 -0
- package/dist/advisor/types.d.ts.map +1 -0
- package/dist/advisor/types.js +2 -0
- package/dist/advisor/types.js.map +1 -0
- package/dist/compass/behavior.d.ts +4 -0
- package/dist/compass/behavior.d.ts.map +1 -0
- package/dist/compass/behavior.js +138 -0
- package/dist/compass/behavior.js.map +1 -0
- package/dist/compass/create.d.ts +3 -0
- package/dist/compass/create.d.ts.map +1 -0
- package/dist/compass/create.js +289 -0
- package/dist/compass/create.js.map +1 -0
- package/dist/compass/evidence/collect.d.ts +11 -0
- package/dist/compass/evidence/collect.d.ts.map +1 -0
- package/dist/compass/evidence/collect.js +86 -0
- package/dist/compass/evidence/collect.js.map +1 -0
- package/dist/compass/index.d.ts +8 -0
- package/dist/compass/index.d.ts.map +1 -0
- package/dist/compass/index.js +8 -0
- package/dist/compass/index.js.map +1 -0
- package/dist/compass/prompts/index.d.ts +28 -0
- package/dist/compass/prompts/index.d.ts.map +1 -0
- package/{modules/compass/prompts/index.ts → dist/compass/prompts/index.js} +13 -38
- package/dist/compass/prompts/index.js.map +1 -0
- package/dist/compass/prompts/system.d.ts +2 -0
- package/dist/compass/prompts/system.d.ts.map +1 -0
- package/{modules/compass/prompts/system.ts → dist/compass/prompts/system.js} +2 -1
- package/dist/compass/prompts/system.js.map +1 -0
- package/dist/compass/propose.d.ts +15 -0
- package/dist/compass/propose.d.ts.map +1 -0
- package/dist/compass/propose.js +128 -0
- package/dist/compass/propose.js.map +1 -0
- package/dist/compass/schemas.d.ts +1271 -0
- package/dist/compass/schemas.d.ts.map +1 -0
- package/dist/compass/schemas.js +113 -0
- package/dist/compass/schemas.js.map +1 -0
- package/dist/compass/score.d.ts +25 -0
- package/dist/compass/score.d.ts.map +1 -0
- package/dist/compass/score.js +89 -0
- package/dist/compass/score.js.map +1 -0
- package/dist/compass/sources/index.d.ts +9 -0
- package/dist/compass/sources/index.d.ts.map +1 -0
- package/dist/compass/sources/index.js +408 -0
- package/dist/compass/sources/index.js.map +1 -0
- package/dist/compass/types.d.ts +334 -0
- package/dist/compass/types.d.ts.map +1 -0
- package/dist/compass/types.js +2 -0
- package/dist/compass/types.js.map +1 -0
- package/dist/council/advisors.d.ts +15 -0
- package/dist/council/advisors.d.ts.map +1 -0
- package/dist/council/advisors.js +46 -0
- package/dist/council/advisors.js.map +1 -0
- package/dist/council/chairman.d.ts +13 -0
- package/dist/council/chairman.d.ts.map +1 -0
- package/dist/council/chairman.js +145 -0
- package/dist/council/chairman.js.map +1 -0
- package/dist/council/deliberate.d.ts +22 -0
- package/dist/council/deliberate.d.ts.map +1 -0
- package/dist/council/deliberate.js +99 -0
- package/dist/council/deliberate.js.map +1 -0
- package/dist/council/frame.d.ts +8 -0
- package/dist/council/frame.d.ts.map +1 -0
- package/dist/council/frame.js +40 -0
- package/dist/council/frame.js.map +1 -0
- package/dist/council/index.d.ts +6 -0
- package/dist/council/index.d.ts.map +1 -0
- package/dist/council/index.js +4 -0
- package/dist/council/index.js.map +1 -0
- package/dist/council/personas.d.ts +18 -0
- package/dist/council/personas.d.ts.map +1 -0
- package/dist/council/personas.js +44 -0
- package/dist/council/personas.js.map +1 -0
- package/dist/council/reviewers.d.ts +13 -0
- package/dist/council/reviewers.d.ts.map +1 -0
- package/dist/council/reviewers.js +59 -0
- package/dist/council/reviewers.js.map +1 -0
- package/dist/council/risk.d.ts +16 -0
- package/dist/council/risk.d.ts.map +1 -0
- package/dist/council/risk.js +74 -0
- package/dist/council/risk.js.map +1 -0
- package/dist/council/types.d.ts +95 -0
- package/dist/council/types.d.ts.map +1 -0
- package/dist/council/types.js +2 -0
- package/dist/council/types.js.map +1 -0
- package/dist/jury/evaluate.d.ts +13 -0
- package/dist/jury/evaluate.d.ts.map +1 -0
- package/{modules/jury/evaluate.ts → dist/jury/evaluate.js} +60 -84
- package/dist/jury/evaluate.js.map +1 -0
- package/dist/jury/index.d.ts +6 -0
- package/dist/jury/index.d.ts.map +1 -0
- package/dist/jury/index.js +4 -0
- package/dist/jury/index.js.map +1 -0
- package/dist/jury/preflight.d.ts +26 -0
- package/dist/jury/preflight.d.ts.map +1 -0
- package/dist/jury/preflight.js +71 -0
- package/dist/jury/preflight.js.map +1 -0
- package/dist/jury/schema.d.ts +57 -0
- package/dist/jury/schema.d.ts.map +1 -0
- package/dist/jury/schema.js +21 -0
- package/dist/jury/schema.js.map +1 -0
- package/dist/jury/types.d.ts +47 -0
- package/dist/jury/types.d.ts.map +1 -0
- package/dist/jury/types.js +2 -0
- package/dist/jury/types.js.map +1 -0
- package/dist/oracle/adapters/lance-db.d.ts +15 -0
- package/dist/oracle/adapters/lance-db.d.ts.map +1 -0
- package/dist/oracle/adapters/lance-db.js +68 -0
- package/dist/oracle/adapters/lance-db.js.map +1 -0
- package/dist/oracle/adapters/xenova-embedder.d.ts +21 -0
- package/dist/oracle/adapters/xenova-embedder.d.ts.map +1 -0
- package/dist/oracle/adapters/xenova-embedder.js +36 -0
- package/dist/oracle/adapters/xenova-embedder.js.map +1 -0
- package/dist/oracle/bm25.d.ts +20 -0
- package/dist/oracle/bm25.d.ts.map +1 -0
- package/dist/oracle/bm25.js +82 -0
- package/dist/oracle/bm25.js.map +1 -0
- package/dist/oracle/index.d.ts +21 -0
- package/dist/oracle/index.d.ts.map +1 -0
- package/dist/oracle/index.js +25 -0
- package/dist/oracle/index.js.map +1 -0
- package/dist/oracle/log.d.ts +6 -0
- package/dist/oracle/log.d.ts.map +1 -0
- package/dist/oracle/log.js +12 -0
- package/dist/oracle/log.js.map +1 -0
- package/dist/oracle/propose.d.ts +25 -0
- package/dist/oracle/propose.d.ts.map +1 -0
- package/dist/oracle/propose.js +133 -0
- package/dist/oracle/propose.js.map +1 -0
- package/dist/oracle/query.d.ts +17 -0
- package/dist/oracle/query.d.ts.map +1 -0
- package/dist/oracle/query.js +106 -0
- package/dist/oracle/query.js.map +1 -0
- package/dist/oracle/summary.d.ts +11 -0
- package/dist/oracle/summary.d.ts.map +1 -0
- package/dist/oracle/summary.js +102 -0
- package/dist/oracle/summary.js.map +1 -0
- package/dist/oracle/types.d.ts +31 -0
- package/dist/oracle/types.d.ts.map +1 -0
- package/dist/oracle/types.js +2 -0
- package/dist/oracle/types.js.map +1 -0
- package/dist/sentinel/assert.d.ts +28 -0
- package/dist/sentinel/assert.d.ts.map +1 -0
- package/dist/sentinel/assert.js +63 -0
- package/dist/sentinel/assert.js.map +1 -0
- package/dist/sentinel/coverage.d.ts +14 -0
- package/dist/sentinel/coverage.d.ts.map +1 -0
- package/dist/sentinel/coverage.js +96 -0
- package/dist/sentinel/coverage.js.map +1 -0
- package/dist/sentinel/drift.d.ts +12 -0
- package/dist/sentinel/drift.d.ts.map +1 -0
- package/dist/sentinel/drift.js +149 -0
- package/dist/sentinel/drift.js.map +1 -0
- package/dist/sentinel/index.d.ts +7 -0
- package/dist/sentinel/index.d.ts.map +1 -0
- package/dist/sentinel/index.js +5 -0
- package/dist/sentinel/index.js.map +1 -0
- package/dist/sentinel/review.d.ts +15 -0
- package/dist/sentinel/review.d.ts.map +1 -0
- package/dist/sentinel/review.js +177 -0
- package/dist/sentinel/review.js.map +1 -0
- package/dist/setup.d.ts +103 -0
- package/dist/setup.d.ts.map +1 -0
- package/dist/setup.js +87 -0
- package/dist/setup.js.map +1 -0
- package/dist/shared/types.d.ts +173 -0
- package/dist/shared/types.d.ts.map +1 -0
- package/dist/shared/types.js +16 -0
- package/dist/shared/types.js.map +1 -0
- package/package.json +13 -8
- package/.github/copilot-instructions.md +0 -117
- package/CLAUDE.md +0 -146
- package/GEMINI.md +0 -73
- package/SETUP.md +0 -264
- package/evals/__tests__/eval.test.ts +0 -31
- package/evals/cases/auth_hs256_rejected.json +0 -46
- package/evals/cases/auth_rs256_valid.json +0 -30
- package/evals/cases/cache_missing_lock.json +0 -31
- package/evals/cases/db_naive_not_null.json +0 -32
- package/evals/cases/logging_pii_leak.json +0 -32
- package/evals/cases/migration_with_rollback.json +0 -43
- package/evals/cases/no_evidence_novel_design.json +0 -16
- package/evals/cases/payment_no_idempotency.json +0 -33
- package/evals/cases/redis_session_rejected.json +0 -32
- package/evals/cases/safe_refactor.json +0 -17
- package/evals/runner.ts +0 -226
- package/modules/AGENTS.md +0 -78
- package/modules/CLAUDE.md +0 -93
- package/modules/README.md +0 -504
- package/modules/advisor/ask.ts +0 -87
- package/modules/advisor/index.ts +0 -2
- package/modules/advisor/types.ts +0 -26
- package/modules/compass/behavior.ts +0 -161
- package/modules/compass/create.ts +0 -365
- package/modules/compass/evidence/collect.ts +0 -109
- package/modules/compass/index.ts +0 -7
- package/modules/compass/propose.ts +0 -152
- package/modules/compass/schemas.ts +0 -121
- package/modules/compass/score.ts +0 -77
- package/modules/compass/sources/index.ts +0 -413
- package/modules/compass/types.ts +0 -431
- package/modules/council/advisors.ts +0 -71
- package/modules/council/chairman.ts +0 -183
- package/modules/council/deliberate.ts +0 -141
- package/modules/council/frame.ts +0 -54
- package/modules/council/index.ts +0 -9
- package/modules/council/personas.ts +0 -57
- package/modules/council/reviewers.ts +0 -82
- package/modules/council/risk.ts +0 -89
- package/modules/council/types.ts +0 -107
- package/modules/jury/index.ts +0 -5
- package/modules/jury/preflight.ts +0 -101
- package/modules/jury/schema.ts +0 -24
- package/modules/jury/types.ts +0 -50
- package/modules/oracle/adapters/lance-db.ts +0 -81
- package/modules/oracle/adapters/xenova-embedder.ts +0 -43
- package/modules/oracle/bm25.ts +0 -92
- package/modules/oracle/index.ts +0 -36
- package/modules/oracle/log.ts +0 -15
- package/modules/oracle/propose.ts +0 -164
- package/modules/oracle/query.ts +0 -146
- package/modules/oracle/summary.ts +0 -116
- package/modules/oracle/types.ts +0 -32
- package/modules/sentinel/assert.ts +0 -95
- package/modules/sentinel/coverage.ts +0 -106
- package/modules/sentinel/drift.ts +0 -163
- package/modules/sentinel/index.ts +0 -6
- package/modules/sentinel/review.ts +0 -208
- package/modules/setup.ts +0 -202
- package/modules/shared/types.ts +0 -193
package/modules/compass/types.ts
DELETED
|
@@ -1,431 +0,0 @@
|
|
|
1
|
-
import type { LLMProvider, OracleClient } from "../shared/types"
|
|
2
|
-
import type { AdvisorOutput } from "../advisor/types"
|
|
3
|
-
|
|
4
|
-
// ── Evidence ──────────────────────────────────────────────────────────────────
|
|
5
|
-
|
|
6
|
-
export type CompassEvidenceKind =
|
|
7
|
-
| "chronicle"
|
|
8
|
-
| "advisor"
|
|
9
|
-
| "sentinel"
|
|
10
|
-
| "code"
|
|
11
|
-
| "docs"
|
|
12
|
-
| "tests"
|
|
13
|
-
| "config"
|
|
14
|
-
| "cli"
|
|
15
|
-
| "package"
|
|
16
|
-
| "issue"
|
|
17
|
-
| "analytics"
|
|
18
|
-
| "support"
|
|
19
|
-
| "inference"
|
|
20
|
-
| "assumption"
|
|
21
|
-
| "unknown"
|
|
22
|
-
|
|
23
|
-
export interface CompassEvidenceRef {
|
|
24
|
-
id: string
|
|
25
|
-
kind: CompassEvidenceKind
|
|
26
|
-
source: string
|
|
27
|
-
path?: string
|
|
28
|
-
line?: number
|
|
29
|
-
entry_id?: string
|
|
30
|
-
summary: string
|
|
31
|
-
quote?: string
|
|
32
|
-
confidence: number
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
// ── Source scanner interface ──────────────────────────────────────────────────
|
|
36
|
-
|
|
37
|
-
export interface ProductSourceFinding {
|
|
38
|
-
id: string
|
|
39
|
-
kind: CompassEvidenceKind
|
|
40
|
-
source: string
|
|
41
|
-
path?: string
|
|
42
|
-
line?: number
|
|
43
|
-
title: string
|
|
44
|
-
summary: string
|
|
45
|
-
raw?: string
|
|
46
|
-
confidence: number
|
|
47
|
-
tags: string[]
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export interface ProductSourceScanInput {
|
|
51
|
-
rootDir: string
|
|
52
|
-
area?: string
|
|
53
|
-
include?: string[]
|
|
54
|
-
exclude?: string[]
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
export interface ProductSource {
|
|
58
|
-
id: string
|
|
59
|
-
kind: "docs" | "code" | "tests" | "config" | "cli" | "package" | "issue" | "analytics" | "support"
|
|
60
|
-
scan(input: ProductSourceScanInput): Promise<ProductSourceFinding[]>
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
// ── Bearings ──────────────────────────────────────────────────────────────────
|
|
64
|
-
|
|
65
|
-
export interface ProductBearing {
|
|
66
|
-
id: string
|
|
67
|
-
title: string
|
|
68
|
-
summary: string
|
|
69
|
-
area?: string
|
|
70
|
-
evidence: CompassEvidenceRef[]
|
|
71
|
-
confidence: number
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
// ── Terrain / behaviour map ───────────────────────────────────────────────────
|
|
75
|
-
|
|
76
|
-
export type BehaviorBasis = "documented" | "implemented" | "tested" | "observed" | "inferred"
|
|
77
|
-
|
|
78
|
-
export interface ProductBehavior {
|
|
79
|
-
id: string
|
|
80
|
-
area: string
|
|
81
|
-
name: string
|
|
82
|
-
description: string
|
|
83
|
-
current_behavior: string
|
|
84
|
-
evidence: CompassEvidenceRef[]
|
|
85
|
-
basis: BehaviorBasis[]
|
|
86
|
-
confidence: number
|
|
87
|
-
notes?: string[]
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
export interface ProductBehaviorGap {
|
|
91
|
-
id: string
|
|
92
|
-
area: string
|
|
93
|
-
gap: string
|
|
94
|
-
why_it_matters: string
|
|
95
|
-
evidence: CompassEvidenceRef[]
|
|
96
|
-
confidence: number
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
export interface ProductBehaviorContradiction {
|
|
100
|
-
id: string
|
|
101
|
-
area: string
|
|
102
|
-
docs_claim: string
|
|
103
|
-
implementation_claim: string
|
|
104
|
-
evidence: CompassEvidenceRef[]
|
|
105
|
-
severity: "low" | "medium" | "high"
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
export interface BehaviorMap {
|
|
109
|
-
generated_at: string
|
|
110
|
-
area?: string
|
|
111
|
-
behaviors: ProductBehavior[]
|
|
112
|
-
gaps: ProductBehaviorGap[]
|
|
113
|
-
contradictions: ProductBehaviorContradiction[]
|
|
114
|
-
confidence: number
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
export interface BehaviorMapInput {
|
|
118
|
-
area?: string
|
|
119
|
-
source?: string
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
export interface BehaviorQuestionInput {
|
|
123
|
-
question: string
|
|
124
|
-
area?: string
|
|
125
|
-
deterministic?: boolean
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
export interface BehaviorAnswer {
|
|
129
|
-
question: string
|
|
130
|
-
what_exists: string[]
|
|
131
|
-
what_appears_missing: string[]
|
|
132
|
-
product_implication: string
|
|
133
|
-
evidence: CompassEvidenceRef[]
|
|
134
|
-
confidence: number
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
// ── Observations ──────────────────────────────────────────────────────────────
|
|
138
|
-
|
|
139
|
-
export interface ProductObservation {
|
|
140
|
-
id: string
|
|
141
|
-
kind: "product_observation"
|
|
142
|
-
title: string
|
|
143
|
-
observation: string
|
|
144
|
-
area: string
|
|
145
|
-
evidence: CompassEvidenceRef[]
|
|
146
|
-
implications: string[]
|
|
147
|
-
confidence: number
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
// ── Hypotheses ────────────────────────────────────────────────────────────────
|
|
151
|
-
|
|
152
|
-
export interface ProductHypothesis {
|
|
153
|
-
id: string
|
|
154
|
-
kind: "product_hypothesis"
|
|
155
|
-
title: string
|
|
156
|
-
hypothesis: string
|
|
157
|
-
target_user?: string
|
|
158
|
-
problem?: string
|
|
159
|
-
assumptions: string[]
|
|
160
|
-
validation_signals: string[]
|
|
161
|
-
invalidation_signals: string[]
|
|
162
|
-
evidence: CompassEvidenceRef[]
|
|
163
|
-
confidence: number
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
// ── Scoring ───────────────────────────────────────────────────────────────────
|
|
167
|
-
|
|
168
|
-
export interface ProductScoreBreakdown {
|
|
169
|
-
strategic_fit: number
|
|
170
|
-
user_problem_clarity: number
|
|
171
|
-
evidence_strength: number
|
|
172
|
-
leverage: number
|
|
173
|
-
feasibility: number
|
|
174
|
-
time_to_signal: number
|
|
175
|
-
reversibility: number
|
|
176
|
-
complexity_penalty: number
|
|
177
|
-
dependency_penalty: number
|
|
178
|
-
contradiction_penalty: number
|
|
179
|
-
evidence_gap_penalty: number
|
|
180
|
-
total: number
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
// ── Opportunities ─────────────────────────────────────────────────────────────
|
|
184
|
-
|
|
185
|
-
export interface ProductOpportunity {
|
|
186
|
-
id: string
|
|
187
|
-
title: string
|
|
188
|
-
area: string
|
|
189
|
-
why_it_matters: string
|
|
190
|
-
evidence_strength: "strong" | "medium" | "weak" | "inferred"
|
|
191
|
-
suggested_next_step: string
|
|
192
|
-
evidence: CompassEvidenceRef[]
|
|
193
|
-
confidence: number
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
export interface OpportunitiesInput {
|
|
197
|
-
goal?: string
|
|
198
|
-
area?: string
|
|
199
|
-
limit?: number
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
// ── Pathways ──────────────────────────────────────────────────────────────────
|
|
203
|
-
|
|
204
|
-
export interface ProductPathwayPhase {
|
|
205
|
-
name: string
|
|
206
|
-
outcome: string
|
|
207
|
-
user_value: string
|
|
208
|
-
build_notes?: string[]
|
|
209
|
-
dependencies: string[]
|
|
210
|
-
risks: string[]
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
export interface ProductPathway {
|
|
214
|
-
id: string
|
|
215
|
-
kind: "product_pathway"
|
|
216
|
-
title: string
|
|
217
|
-
goal: string
|
|
218
|
-
target_user?: string
|
|
219
|
-
problem?: string
|
|
220
|
-
current_behaviors: string[]
|
|
221
|
-
opportunity: string
|
|
222
|
-
why_now: string
|
|
223
|
-
smallest_useful_version: string
|
|
224
|
-
phases: ProductPathwayPhase[]
|
|
225
|
-
dependencies: string[]
|
|
226
|
-
risks: string[]
|
|
227
|
-
assumptions: string[]
|
|
228
|
-
open_questions: string[]
|
|
229
|
-
evidence: CompassEvidenceRef[]
|
|
230
|
-
scores: ProductScoreBreakdown
|
|
231
|
-
confidence: number
|
|
232
|
-
time_to_signal: string
|
|
233
|
-
reversibility: "high" | "medium" | "low"
|
|
234
|
-
suggested_next_step: string
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
export interface PathwaysInput {
|
|
238
|
-
goal: string
|
|
239
|
-
horizon?: string
|
|
240
|
-
appetite?: "small" | "medium" | "large"
|
|
241
|
-
area?: string
|
|
242
|
-
limit?: number
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
// ── Bets ──────────────────────────────────────────────────────────────────────
|
|
246
|
-
|
|
247
|
-
export interface ProductBet {
|
|
248
|
-
id: string
|
|
249
|
-
kind: "product_bet"
|
|
250
|
-
title: string
|
|
251
|
-
thesis: string
|
|
252
|
-
why_now: string
|
|
253
|
-
target_user?: string
|
|
254
|
-
upside: string
|
|
255
|
-
downside: string
|
|
256
|
-
assumptions: string[]
|
|
257
|
-
validation_signals: string[]
|
|
258
|
-
invalidation_signals: string[]
|
|
259
|
-
kill_criteria: string[]
|
|
260
|
-
first_experiment: string
|
|
261
|
-
build_path: string[]
|
|
262
|
-
evidence: CompassEvidenceRef[]
|
|
263
|
-
scores: ProductScoreBreakdown
|
|
264
|
-
confidence: number
|
|
265
|
-
time_to_signal: string
|
|
266
|
-
reversibility: "high" | "medium" | "low"
|
|
267
|
-
appetite: "small" | "medium" | "large"
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
export interface BigBetsInput {
|
|
271
|
-
horizon?: string
|
|
272
|
-
goal?: string
|
|
273
|
-
appetite?: "small" | "medium" | "large"
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
// ── Idea scoring ──────────────────────────────────────────────────────────────
|
|
277
|
-
|
|
278
|
-
export interface ProductIdeaScore {
|
|
279
|
-
idea: string
|
|
280
|
-
summary: string
|
|
281
|
-
recommendation: "pursue" | "pursue-small-test" | "investigate-more" | "defer" | "avoid"
|
|
282
|
-
scores: ProductScoreBreakdown
|
|
283
|
-
evidence: CompassEvidenceRef[]
|
|
284
|
-
supporting_reasons: string[]
|
|
285
|
-
risks: string[]
|
|
286
|
-
assumptions: string[]
|
|
287
|
-
open_questions: string[]
|
|
288
|
-
suggested_next_step: string
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
export interface ScoreIdeaInput {
|
|
292
|
-
idea: string
|
|
293
|
-
context?: string
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
// ── Product brief ─────────────────────────────────────────────────────────────
|
|
297
|
-
|
|
298
|
-
export interface ProductBrief {
|
|
299
|
-
title: string
|
|
300
|
-
problem: string
|
|
301
|
-
target_user?: string
|
|
302
|
-
current_behavior: string[]
|
|
303
|
-
product_opportunity: string
|
|
304
|
-
recommended_solution: string
|
|
305
|
-
smallest_useful_version: string
|
|
306
|
-
non_goals: string[]
|
|
307
|
-
user_flow: string[]
|
|
308
|
-
implementation_notes: string[]
|
|
309
|
-
dependencies: string[]
|
|
310
|
-
risks: string[]
|
|
311
|
-
open_questions: string[]
|
|
312
|
-
assumptions: string[]
|
|
313
|
-
validation_signals: string[]
|
|
314
|
-
invalidation_signals: string[]
|
|
315
|
-
evidence: CompassEvidenceRef[]
|
|
316
|
-
suggested_quorum_checks: string[]
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
export interface ProductBriefInput {
|
|
320
|
-
title: string
|
|
321
|
-
pathway_id?: string
|
|
322
|
-
idea?: string
|
|
323
|
-
context?: string
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
// ── Compass brief ─────────────────────────────────────────────────────────────
|
|
327
|
-
|
|
328
|
-
export interface CompassBrief {
|
|
329
|
-
generated_at: string
|
|
330
|
-
area?: string
|
|
331
|
-
product_direction: string
|
|
332
|
-
known_from_chronicle: string[]
|
|
333
|
-
known_from_behavior: string[]
|
|
334
|
-
inferred: string[]
|
|
335
|
-
assumptions: string[]
|
|
336
|
-
unknowns: string[]
|
|
337
|
-
opportunities: ProductOpportunity[]
|
|
338
|
-
missing_evidence: string[]
|
|
339
|
-
recommended_next_step: string
|
|
340
|
-
confidence: number
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
export interface CompassBriefInput {
|
|
344
|
-
area?: string
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
// ── Proposals ─────────────────────────────────────────────────────────────────
|
|
348
|
-
|
|
349
|
-
export type CompassArtifactKind =
|
|
350
|
-
| "product_observation"
|
|
351
|
-
| "product_hypothesis"
|
|
352
|
-
| "product_pathway"
|
|
353
|
-
| "product_bet"
|
|
354
|
-
| "product_idea_score"
|
|
355
|
-
| "product_outcome"
|
|
356
|
-
|
|
357
|
-
export interface CompassProposalInput {
|
|
358
|
-
artifact_kind: CompassArtifactKind
|
|
359
|
-
artifact_id: string
|
|
360
|
-
payload: ProductPathway | ProductBet | ProductObservation | ProductIdeaScore
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
export interface CompassProposalResult {
|
|
364
|
-
proposal_id: string
|
|
365
|
-
message: string
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
// ── Outcomes ──────────────────────────────────────────────────────────────────
|
|
369
|
-
|
|
370
|
-
export type CompassOutcomeResult =
|
|
371
|
-
| "validated"
|
|
372
|
-
| "partially-validated"
|
|
373
|
-
| "invalidated"
|
|
374
|
-
| "unclear"
|
|
375
|
-
| "superseded"
|
|
376
|
-
|
|
377
|
-
export interface CompassOutcomeInput {
|
|
378
|
-
entry_id: string
|
|
379
|
-
result: CompassOutcomeResult
|
|
380
|
-
note?: string
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
export interface CompassOutcomeResultPayload {
|
|
384
|
-
proposal_id: string
|
|
385
|
-
message: string
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
// ── Main Compass interface ────────────────────────────────────────────────────
|
|
389
|
-
|
|
390
|
-
export interface Compass {
|
|
391
|
-
brief(input?: CompassBriefInput): Promise<CompassBrief>
|
|
392
|
-
mapBehaviors(input?: BehaviorMapInput): Promise<BehaviorMap>
|
|
393
|
-
behavior(input: BehaviorQuestionInput): Promise<BehaviorAnswer>
|
|
394
|
-
opportunities(input?: OpportunitiesInput): Promise<ProductOpportunity[]>
|
|
395
|
-
pathways(input: PathwaysInput): Promise<ProductPathway[]>
|
|
396
|
-
bigBets(input: BigBetsInput): Promise<ProductBet[]>
|
|
397
|
-
scoreIdea(input: ScoreIdeaInput): Promise<ProductIdeaScore>
|
|
398
|
-
productBrief(input: ProductBriefInput): Promise<ProductBrief>
|
|
399
|
-
propose(input: CompassProposalInput): Promise<CompassProposalResult>
|
|
400
|
-
outcome(input: CompassOutcomeInput): Promise<CompassOutcomeResultPayload>
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
// ── Options ───────────────────────────────────────────────────────────────────
|
|
404
|
-
|
|
405
|
-
export interface CreateCompassOptions {
|
|
406
|
-
oracle: OracleClient
|
|
407
|
-
advisor?: {
|
|
408
|
-
ask: (question: string) => Promise<AdvisorOutput>
|
|
409
|
-
}
|
|
410
|
-
/**
|
|
411
|
-
* Required for LLM-backed commands: brief (with synthesis), pathways,
|
|
412
|
-
* bigBets, scoreIdea, productBrief, behavior (non-deterministic).
|
|
413
|
-
* Not required for deterministic mapBehaviors.
|
|
414
|
-
*/
|
|
415
|
-
llm?: LLMProvider
|
|
416
|
-
rootDir?: string
|
|
417
|
-
chronicleDir?: string
|
|
418
|
-
sources?: ProductSource[]
|
|
419
|
-
models?: {
|
|
420
|
-
brief?: string
|
|
421
|
-
pathways?: string
|
|
422
|
-
bets?: string
|
|
423
|
-
score?: string
|
|
424
|
-
}
|
|
425
|
-
/**
|
|
426
|
-
* How aggressively to surface low-evidence recommendations.
|
|
427
|
-
* "strict" penalises more. "exploratory" allows weaker evidence through.
|
|
428
|
-
* Default: "balanced"
|
|
429
|
-
*/
|
|
430
|
-
minimumEvidence?: "strict" | "balanced" | "exploratory"
|
|
431
|
-
}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import type { LLMProvider, OracleResult } from "../shared/types"
|
|
2
|
-
import { entryText } from "../shared/types"
|
|
3
|
-
import type { AdvisorPersona } from "./personas"
|
|
4
|
-
|
|
5
|
-
export interface AdvisorResponse {
|
|
6
|
-
persona: string
|
|
7
|
-
response: string
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
function formatEvidence(evidence: OracleResult[]): string {
|
|
11
|
-
if (evidence.length === 0) {
|
|
12
|
-
return "No Oracle entries are available. Reason from absence of evidence — name what is missing."
|
|
13
|
-
}
|
|
14
|
-
return evidence
|
|
15
|
-
.map(e =>
|
|
16
|
-
`[${e.id}] (${e.status})
|
|
17
|
-
${entryText(e)}
|
|
18
|
-
Areas: ${e.affected_areas.join(", ")}${e.scope ? " | " + e.scope.join(", ") : ""}`,
|
|
19
|
-
)
|
|
20
|
-
.join("\n\n")
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Run all advisors in parallel.
|
|
25
|
-
* Each advisor receives the framed question, the Oracle evidence pack,
|
|
26
|
-
* and their persona's system prompt fragment.
|
|
27
|
-
*
|
|
28
|
-
* Advisors MUST cite specific Oracle entry IDs — this is enforced in the prompt.
|
|
29
|
-
*/
|
|
30
|
-
export async function fanOutAdvisors(
|
|
31
|
-
framedQuestion: string,
|
|
32
|
-
evidence: OracleResult[],
|
|
33
|
-
personas: readonly AdvisorPersona[],
|
|
34
|
-
llm: LLMProvider,
|
|
35
|
-
model?: string,
|
|
36
|
-
): Promise<AdvisorResponse[]> {
|
|
37
|
-
const evidenceText = formatEvidence(evidence)
|
|
38
|
-
|
|
39
|
-
return Promise.all(
|
|
40
|
-
personas.map(async (persona): Promise<AdvisorResponse> => {
|
|
41
|
-
const systemPrompt = [
|
|
42
|
-
`You are a Council advisor — ${persona.name}.`,
|
|
43
|
-
"",
|
|
44
|
-
persona.systemFragment,
|
|
45
|
-
"",
|
|
46
|
-
"Rules:",
|
|
47
|
-
"- Reason ONLY from the Oracle evidence provided. Do not use general knowledge.",
|
|
48
|
-
"- Cite specific Oracle entry IDs (e.g. [abc-123]) for every claim you make.",
|
|
49
|
-
"- If the evidence is insufficient to support a claim, say so explicitly.",
|
|
50
|
-
"- Keep your response focused and under 400 words.",
|
|
51
|
-
].join("\n")
|
|
52
|
-
|
|
53
|
-
const userPrompt = [
|
|
54
|
-
framedQuestion,
|
|
55
|
-
"",
|
|
56
|
-
"## Oracle Evidence",
|
|
57
|
-
evidenceText,
|
|
58
|
-
].join("\n")
|
|
59
|
-
|
|
60
|
-
const response = await llm(
|
|
61
|
-
[
|
|
62
|
-
{ role: "system", content: systemPrompt },
|
|
63
|
-
{ role: "user", content: userPrompt },
|
|
64
|
-
],
|
|
65
|
-
model,
|
|
66
|
-
)
|
|
67
|
-
|
|
68
|
-
return { persona: persona.name, response }
|
|
69
|
-
}),
|
|
70
|
-
)
|
|
71
|
-
}
|
|
@@ -1,183 +0,0 @@
|
|
|
1
|
-
import { z } from "zod"
|
|
2
|
-
import type { LLMProvider, OracleResult } from "../shared/types"
|
|
3
|
-
import { entryText } from "../shared/types"
|
|
4
|
-
import type { AdvisorResponse } from "./advisors"
|
|
5
|
-
import type { ReviewerResponse } from "./reviewers"
|
|
6
|
-
import type { CouncilOutput, CitationValidation } from "./types"
|
|
7
|
-
|
|
8
|
-
const BlockerSchema = z.object({
|
|
9
|
-
issue: z.string().min(1),
|
|
10
|
-
evidence: z.array(z.string()),
|
|
11
|
-
required_fix: z.string().min(1),
|
|
12
|
-
})
|
|
13
|
-
|
|
14
|
-
const WarningSchema = z.object({
|
|
15
|
-
issue: z.string().min(1),
|
|
16
|
-
suggested_fix: z.string().optional(),
|
|
17
|
-
})
|
|
18
|
-
|
|
19
|
-
const AdvisorSplitSchema = z.object({
|
|
20
|
-
proceed: z.number().int().min(0),
|
|
21
|
-
redesign: z.number().int().min(0),
|
|
22
|
-
"investigate-more": z.number().int().min(0),
|
|
23
|
-
})
|
|
24
|
-
|
|
25
|
-
const ChairmanOutputSchema = z.object({
|
|
26
|
-
satisfied: z.boolean(),
|
|
27
|
-
verdict: z.string().min(1),
|
|
28
|
-
blockers: z.array(BlockerSchema),
|
|
29
|
-
warnings: z.array(WarningSchema),
|
|
30
|
-
evidence_cited: z.array(z.string()),
|
|
31
|
-
advisor_split: AdvisorSplitSchema,
|
|
32
|
-
recommendation: z.enum(["proceed", "redesign", "investigate-more"]),
|
|
33
|
-
})
|
|
34
|
-
|
|
35
|
-
function formatAdvisors(responses: AdvisorResponse[]): string {
|
|
36
|
-
return responses
|
|
37
|
-
.map(r => `## ${r.persona}\n${r.response}`)
|
|
38
|
-
.join("\n\n---\n\n")
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
function formatReviewers(responses: ReviewerResponse[]): string {
|
|
42
|
-
return responses
|
|
43
|
-
.map(r => `## ${r.reviewerId}\n${r.review}`)
|
|
44
|
-
.join("\n\n---\n\n")
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
function formatEvidence(evidence: OracleResult[]): string {
|
|
48
|
-
if (evidence.length === 0) return "No Oracle evidence."
|
|
49
|
-
return evidence
|
|
50
|
-
.map(
|
|
51
|
-
e =>
|
|
52
|
-
`[${e.id}] (${e.status}, confidence: ${e.confidence.toFixed(2)}) ${entryText(e)}`,
|
|
53
|
-
)
|
|
54
|
-
.join("\n")
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Validate that every ID in evidence_cited actually appeared in the evidence pack.
|
|
59
|
-
* Hallucinated IDs are cited but were never in the evidence sent to Council.
|
|
60
|
-
*/
|
|
61
|
-
function validateCitations(
|
|
62
|
-
citedIds: string[],
|
|
63
|
-
evidence: OracleResult[],
|
|
64
|
-
): CitationValidation {
|
|
65
|
-
const evidenceIds = new Set(evidence.map(e => e.id))
|
|
66
|
-
const valid_ids: string[] = []
|
|
67
|
-
const hallucinated_ids: string[] = []
|
|
68
|
-
|
|
69
|
-
for (const id of citedIds) {
|
|
70
|
-
if (evidenceIds.has(id)) {
|
|
71
|
-
valid_ids.push(id)
|
|
72
|
-
} else {
|
|
73
|
-
hallucinated_ids.push(id)
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
return { valid_ids, hallucinated_ids }
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
const CHAIRMAN_SYSTEM_PROMPT = [
|
|
81
|
-
"You are the Council Chairman. You synthesise the final verdict from all advisor and reviewer inputs.",
|
|
82
|
-
"",
|
|
83
|
-
"Your output must classify findings by severity:",
|
|
84
|
-
" blockers — issues that MUST be resolved before the design can proceed",
|
|
85
|
-
" (e.g. no rollback plan for a destructive migration, repeated a documented failure mode)",
|
|
86
|
-
" warnings — issues that SHOULD be addressed but do not block execution",
|
|
87
|
-
" (e.g. no test coverage for an edge case, a preferred pattern not followed)",
|
|
88
|
-
"",
|
|
89
|
-
"For each blocker, cite the Oracle entry IDs that evidence it and state the required fix precisely.",
|
|
90
|
-
"For each warning, a suggested_fix is optional but preferred.",
|
|
91
|
-
"",
|
|
92
|
-
"advisor_split: count how many advisors recommended each option from their responses.",
|
|
93
|
-
" High split (no clear majority) is a signal of genuine uncertainty — reflect this in your verdict.",
|
|
94
|
-
"",
|
|
95
|
-
"satisfied = true → no blockers, design can proceed to the human gate",
|
|
96
|
-
"satisfied = false → at least one blocker exists, or the design needs rework",
|
|
97
|
-
"",
|
|
98
|
-
"evidence_cited: list every Oracle entry ID that materially influenced the verdict.",
|
|
99
|
-
" Only cite IDs that appeared in the Oracle Evidence section below.",
|
|
100
|
-
" Do not cite IDs from memory or general knowledge.",
|
|
101
|
-
"",
|
|
102
|
-
"Return ONLY valid JSON — no markdown fences, no explanation:",
|
|
103
|
-
JSON.stringify({
|
|
104
|
-
satisfied: "<boolean>",
|
|
105
|
-
verdict: "<string ≤400 words — clear synthesis citing entry IDs>",
|
|
106
|
-
blockers: [{ issue: "<string>", evidence: ["<Oracle entry ID>"], required_fix: "<string>" }],
|
|
107
|
-
warnings: [{ issue: "<string>", suggested_fix: "<string — optional>" }],
|
|
108
|
-
evidence_cited: ["<Oracle entry ID — only IDs present in the evidence pack>"],
|
|
109
|
-
advisor_split: { proceed: "<int>", redesign: "<int>", "investigate-more": "<int>" },
|
|
110
|
-
recommendation: "proceed | redesign | investigate-more",
|
|
111
|
-
}),
|
|
112
|
-
].join("\n")
|
|
113
|
-
|
|
114
|
-
/**
|
|
115
|
-
* Chairman synthesises the verdict from all advisor and reviewer inputs.
|
|
116
|
-
* Classifies findings into blockers and warnings, validates citations,
|
|
117
|
-
* and tracks advisor split to surface genuine disagreement.
|
|
118
|
-
*
|
|
119
|
-
* Throws if the LLM returns non-JSON or output fails schema validation.
|
|
120
|
-
*/
|
|
121
|
-
export async function chairman(
|
|
122
|
-
advisorResponses: AdvisorResponse[],
|
|
123
|
-
reviewerResponses: ReviewerResponse[],
|
|
124
|
-
evidence: OracleResult[],
|
|
125
|
-
llm: LLMProvider,
|
|
126
|
-
model?: string,
|
|
127
|
-
): Promise<CouncilOutput> {
|
|
128
|
-
const userPrompt = [
|
|
129
|
-
"## Advisor Responses",
|
|
130
|
-
formatAdvisors(advisorResponses),
|
|
131
|
-
"",
|
|
132
|
-
"## Reviewer Critiques",
|
|
133
|
-
formatReviewers(reviewerResponses),
|
|
134
|
-
"",
|
|
135
|
-
"## Oracle Evidence",
|
|
136
|
-
formatEvidence(evidence),
|
|
137
|
-
].join("\n")
|
|
138
|
-
|
|
139
|
-
const raw = await llm(
|
|
140
|
-
[
|
|
141
|
-
{ role: "system", content: CHAIRMAN_SYSTEM_PROMPT },
|
|
142
|
-
{ role: "user", content: userPrompt },
|
|
143
|
-
],
|
|
144
|
-
model,
|
|
145
|
-
)
|
|
146
|
-
|
|
147
|
-
let parsed: unknown
|
|
148
|
-
try {
|
|
149
|
-
const cleaned = raw
|
|
150
|
-
.replace(/^```(?:json)?\s*/m, "")
|
|
151
|
-
.replace(/\s*```$/m, "")
|
|
152
|
-
.trim()
|
|
153
|
-
parsed = JSON.parse(cleaned)
|
|
154
|
-
} catch {
|
|
155
|
-
throw new Error(
|
|
156
|
-
`Council chairman: LLM returned non-JSON. Raw (first 300 chars): ${raw.slice(0, 300)}`,
|
|
157
|
-
)
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
const result = ChairmanOutputSchema.safeParse(parsed)
|
|
161
|
-
if (!result.success) {
|
|
162
|
-
throw new Error(
|
|
163
|
-
`Council chairman: output failed schema validation. Issues: ${JSON.stringify(result.error.issues)}`,
|
|
164
|
-
)
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
const data = result.data
|
|
168
|
-
|
|
169
|
-
// Validate citations — flag any IDs cited that weren't in the evidence pack
|
|
170
|
-
const citation_validation = validateCitations(data.evidence_cited, evidence)
|
|
171
|
-
|
|
172
|
-
// Derive flat challenges array for backwards compatibility
|
|
173
|
-
const challenges = [
|
|
174
|
-
...data.blockers.map(b => `[BLOCKER] ${b.issue}`),
|
|
175
|
-
...data.warnings.map(w => w.issue),
|
|
176
|
-
]
|
|
177
|
-
|
|
178
|
-
return {
|
|
179
|
-
...data,
|
|
180
|
-
challenges,
|
|
181
|
-
citation_validation,
|
|
182
|
-
}
|
|
183
|
-
}
|