dsh-scout 0.9.0 → 0.9.2

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/model.d.ts CHANGED
@@ -1,3 +1,6 @@
1
+ import type { ScoutLanguage } from './i18n.js';
2
+ export { formatScoutString, isScoutLanguage, normalizeScoutLanguage, SCOUT_LANGUAGES, scoutStrings, } from './i18n.js';
3
+ export type { ScoutLanguage, ScoutStrings } from './i18n.js';
1
4
  export declare const EVIDENCE_LEVELS: readonly ["E0", "E1", "E2", "E3"];
2
5
  export type EvidenceLevel = typeof EVIDENCE_LEVELS[number];
3
6
  export declare const CLAIM_STATUSES: readonly ["verified", "reported", "inferred", "contradicted", "unknown", "needs_verification"];
@@ -9,7 +12,10 @@ export type ClaimImpact = typeof CLAIM_IMPACTS[number];
9
12
  export declare const CLAIM_DIMENSIONS: readonly ["identity", "role_existence", "reporting_line", "mandate", "company_and_founder", "product_and_technology", "market_and_competition", "financing_and_commercialization", "organization_and_hr", "risk", "role_fit"];
10
13
  export type ClaimDimension = typeof CLAIM_DIMENSIONS[number];
11
14
  export type Decision = 'PROCEED' | 'VERIFY' | 'STOP';
12
- export declare const EVENT_TYPES: readonly ["case_started", "source_added", "claim_added", "identity_verified", "claim_verified", "case_exported", "case_imported"];
15
+ export declare const DECISION_REASON_CODES: readonly ["identity", "unresolved", "missing_dimension", "proceed"];
16
+ export type DecisionReasonCode = typeof DECISION_REASON_CODES[number];
17
+ export declare function isDecisionReasonCode(value: unknown): value is DecisionReasonCode;
18
+ export declare const EVENT_TYPES: readonly ["case_started", "source_added", "claim_added", "identity_verified", "claim_verified", "case_exported", "case_imported", "case_rehydrated"];
13
19
  export type ScoutEventType = typeof EVENT_TYPES[number];
14
20
  export interface ScoutEvent {
15
21
  eventId: string;
@@ -70,6 +76,8 @@ export interface ScoutCase {
70
76
  };
71
77
  decision: Decision;
72
78
  decisionReason: string;
79
+ /** Optional reason code for the decision; older exports omit it. */
80
+ decisionReasonCode?: DecisionReasonCode;
73
81
  sources: ScoutSource[];
74
82
  claims: ScoutClaim[];
75
83
  interviewQuestions: string[];
@@ -81,6 +89,7 @@ export declare function createCase(input: {
81
89
  roleTitle: string;
82
90
  location?: string;
83
91
  decisionObjective?: string;
92
+ language?: ScoutLanguage;
84
93
  }): ScoutCase;
85
94
  export declare function addSource(scoutCase: ScoutCase, source: ScoutSource, authoritySuffixes?: readonly string[]): ScoutCase;
86
95
  export declare function isTrustedAuthorityUrl(value: string | null, authoritySuffixes?: readonly string[]): boolean;
@@ -94,6 +103,13 @@ export declare function inferEvidenceLevel(url: string | null, type: SourceType,
94
103
  evidenceLevel: EvidenceLevel;
95
104
  inferred: boolean;
96
105
  };
106
+ /**
107
+ * Normalize a source URL for deduplication: trim, lowercase the host, drop a
108
+ * trailing slash and any fragment. Empty or unparsable URLs return `undefined`.
109
+ */
110
+ export declare function normalizeSourceUrl(value: string | null | undefined): string | undefined;
111
+ /** Find a source by normalized URL (trim + trailing-slash + host case insensitive). */
112
+ export declare function findSourceByUrl(scoutCase: ScoutCase, url: string): ScoutSource | undefined;
97
113
  export declare function addClaim(scoutCase: ScoutCase, claim: ScoutClaim): ScoutCase;
98
114
  export declare function verifyClaim(scoutCase: ScoutCase, input: {
99
115
  claimId: string;
@@ -110,15 +126,49 @@ export declare function verifyIdentity(scoutCase: ScoutCase, input: {
110
126
  brandRelationship: string;
111
127
  sourceIds: string[];
112
128
  }, authoritySuffixes?: readonly string[]): ScoutCase;
113
- export declare function decideCase(scoutCase: ScoutCase): ScoutCase;
114
- /** Derive a deduplicated, prioritized interview question list from the case. */
115
- export declare function generateInterviewQuestions(scoutCase: ScoutCase): string[];
116
- export declare function renderReport(scoutCase: ScoutCase): string;
129
+ /** Pure decision reason code recomputed from the subject and claims, without stored state. */
130
+ export declare function explainDecision(scoutCase: ScoutCase): DecisionReasonCode;
131
+ export declare function decideCase(scoutCase: ScoutCase, opts?: {
132
+ language?: ScoutLanguage;
133
+ }): ScoutCase;
134
+ export interface DimensionCoverage {
135
+ dimension: ClaimDimension;
136
+ verified: number;
137
+ open: number;
138
+ untouched: boolean;
139
+ }
140
+ /** Investigation coverage per dimension, in `CLAIM_DIMENSIONS` order. */
141
+ export declare function computeCoverage(scoutCase: ScoutCase): DimensionCoverage[];
142
+ /**
143
+ * Derive a deduplicated, prioritized interview question list from the case.
144
+ * Order: pending next actions, missing required dimensions, untouched
145
+ * dimensions, then the case's own curated questions. The curated questions
146
+ * reserve their full quota, so an uninvestigated case cannot crowd them out of
147
+ * the 12-item cap.
148
+ */
149
+ export declare function generateInterviewQuestions(scoutCase: ScoutCase, opts?: {
150
+ language?: ScoutLanguage;
151
+ }): string[];
152
+ export declare function renderReport(scoutCase: ScoutCase, opts?: {
153
+ language?: ScoutLanguage;
154
+ }): string;
117
155
  export declare function appendEvent(scoutCase: ScoutCase, event: ScoutEvent): ScoutCase;
118
156
  export declare const EXPORT_FILE_NAMES: readonly ["case.json", "sources.json", "claims.json", "events.jsonl", "report.md"];
119
- /** Serialize a case into the durable five-file export payloads (no I/O). */
120
- export declare function exportCaseFiles(scoutCase: ScoutCase): Record<string, string>;
157
+ /**
158
+ * Serialize a case into the durable five-file export payloads (no I/O).
159
+ *
160
+ * `case.json` keeps the case's own `language` field, which records the language
161
+ * the case was created in; the language used to render `report.md` is decided by
162
+ * the caller through `opts.language` (falling back to the case language), so a
163
+ * case imported across a language boundary can still be exported in the
164
+ * configured language.
165
+ */
166
+ export declare function exportCaseFiles(scoutCase: ScoutCase, opts?: {
167
+ language?: ScoutLanguage;
168
+ }): Record<string, string>;
121
169
  /** Rebuild a case from the five-file export payloads, validating structure. */
122
170
  export declare function importCaseFromFiles(files: Record<string, string>): ScoutCase;
123
171
  /** Render a side-by-side comparison report for two or more cases. */
124
- export declare function renderComparison(cases: ScoutCase[]): string;
172
+ export declare function renderComparison(cases: ScoutCase[], opts?: {
173
+ language?: ScoutLanguage;
174
+ }): string;