dsh-scout 0.9.3 → 0.9.4
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 +39 -1
- package/README.en.md +18 -14
- package/README.md +18 -14
- package/dist/i18n.d.ts +157 -1
- package/dist/i18n.js +354 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +339 -88
- package/dist/model.d.ts +62 -9
- package/dist/model.js +655 -134
- package/docs/dsh-scout-product-contract.md +5 -3
- package/package.json +4 -1
- package/scripts/acceptance-report.mjs +622 -0
- package/scripts/profile-smoke.mjs +12 -15
- package/scripts/smoke-tool-call.mjs +43 -0
- package/tests/acceptance.test.mjs +57 -41
- package/tests/model.test.mjs +301 -69
- package/tests/package.test.mjs +6 -6
- package/tests/tools.test.mjs +382 -16
package/dist/model.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ export type Decision = 'PROCEED' | 'VERIFY' | 'STOP';
|
|
|
15
15
|
export declare const DECISION_REASON_CODES: readonly ["identity", "unresolved", "missing_dimension", "proceed"];
|
|
16
16
|
export type DecisionReasonCode = typeof DECISION_REASON_CODES[number];
|
|
17
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"];
|
|
18
|
+
export declare const EVENT_TYPES: readonly ["case_started", "source_added", "source_updated", "claim_added", "identity_verified", "claim_verified", "case_exported", "case_imported", "case_rehydrated"];
|
|
19
19
|
export type ScoutEventType = typeof EVENT_TYPES[number];
|
|
20
20
|
export interface ScoutEvent {
|
|
21
21
|
eventId: string;
|
|
@@ -45,6 +45,8 @@ export interface ScoutClaim {
|
|
|
45
45
|
sourceIds: string[];
|
|
46
46
|
nextAction: string;
|
|
47
47
|
confidenceNote: string;
|
|
48
|
+
/** Optional model-written interview question; the only claim field that feeds the question list. */
|
|
49
|
+
interviewQuestion?: string;
|
|
48
50
|
history?: Array<{
|
|
49
51
|
status: ClaimStatus;
|
|
50
52
|
evidenceLevel: EvidenceLevel;
|
|
@@ -53,6 +55,22 @@ export interface ScoutClaim {
|
|
|
53
55
|
confidenceNote: string;
|
|
54
56
|
}>;
|
|
55
57
|
}
|
|
58
|
+
/** The five identity fields a caller asserts when verifying the subject. */
|
|
59
|
+
export declare const IDENTITY_FIELDS: readonly ["legalEntity", "registrationNumber", "registeredRegion", "legalRepresentative", "brandRelationship"];
|
|
60
|
+
export type IdentityField = typeof IDENTITY_FIELDS[number];
|
|
61
|
+
/**
|
|
62
|
+
* Identity confidence tiers.
|
|
63
|
+
*
|
|
64
|
+
* - `verified`: an E3 registry/regulator/official-filing source backs the
|
|
65
|
+
* registration number itself (the strongest claim a due-diligence tool can make).
|
|
66
|
+
* - `corroborated`: no E3 registration evidence, but at least two independent
|
|
67
|
+
* sources cover every identity field consistently (typically 工商 aggregators).
|
|
68
|
+
* This is a *decision-useful* tier, never presented as official verification.
|
|
69
|
+
* - `needs_verification`: anything weaker.
|
|
70
|
+
*/
|
|
71
|
+
export declare const IDENTITY_STATUSES: readonly ["verified", "corroborated", "needs_verification"];
|
|
72
|
+
export type IdentityStatus = typeof IDENTITY_STATUSES[number];
|
|
73
|
+
export declare function isIdentityStatus(value: unknown): value is IdentityStatus;
|
|
56
74
|
export interface ScoutCase {
|
|
57
75
|
schemaVersion: 'dsh-scout.case.v0';
|
|
58
76
|
caseId: string;
|
|
@@ -67,7 +85,9 @@ export interface ScoutCase {
|
|
|
67
85
|
legalRepresentative?: string;
|
|
68
86
|
brandRelationship?: string;
|
|
69
87
|
identitySourceIds: string[];
|
|
70
|
-
identityStatus:
|
|
88
|
+
identityStatus: IdentityStatus;
|
|
89
|
+
/** Optional per-field provenance: which sources support which identity field. */
|
|
90
|
+
identityEvidence?: Partial<Record<IdentityField, string[]>>;
|
|
71
91
|
};
|
|
72
92
|
role: {
|
|
73
93
|
title: string;
|
|
@@ -105,7 +125,9 @@ export declare function inferEvidenceLevel(url: string | null, type: SourceType,
|
|
|
105
125
|
};
|
|
106
126
|
/**
|
|
107
127
|
* Normalize a source URL for deduplication: trim, lowercase the host, drop a
|
|
108
|
-
* trailing slash
|
|
128
|
+
* trailing slash, the fragment, and known campaign/tracking query parameters.
|
|
129
|
+
* Query parameters that can select the document itself (e.g. `?id=42`) are kept.
|
|
130
|
+
* Empty or unparsable URLs return `undefined`.
|
|
109
131
|
*/
|
|
110
132
|
export declare function normalizeSourceUrl(value: string | null | undefined): string | undefined;
|
|
111
133
|
/** Find a source by normalized URL (trim + trailing-slash + host case insensitive). */
|
|
@@ -118,14 +140,31 @@ export declare function verifyClaim(scoutCase: ScoutCase, input: {
|
|
|
118
140
|
nextAction: string;
|
|
119
141
|
confidenceNote: string;
|
|
120
142
|
}): ScoutCase;
|
|
121
|
-
export
|
|
143
|
+
export interface IdentityVerificationInput {
|
|
122
144
|
legalEntity: string;
|
|
123
145
|
registrationNumber: string;
|
|
124
146
|
registeredRegion: string;
|
|
125
147
|
legalRepresentative: string;
|
|
126
148
|
brandRelationship: string;
|
|
127
149
|
sourceIds: string[];
|
|
128
|
-
|
|
150
|
+
/**
|
|
151
|
+
* Optional per-field provenance. When provided, every field must be covered
|
|
152
|
+
* and the tier is derived from what actually supports the registration
|
|
153
|
+
* number: an E3 authoritative source there means `verified`, otherwise
|
|
154
|
+
* two-or-more independent sources covering all fields means `corroborated`.
|
|
155
|
+
*/
|
|
156
|
+
fieldSources?: Partial<Record<IdentityField, string[]>>;
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Verify the legal subject.
|
|
160
|
+
*
|
|
161
|
+
* Reaching `verified` requires an E3 registry/regulator/official-filing source
|
|
162
|
+
* that backs the registration number — a page that merely mentions the company
|
|
163
|
+
* does not count. Without that, two independent sources covering every identity
|
|
164
|
+
* field yield `corroborated`: decision-useful and honestly labelled, never
|
|
165
|
+
* presented as official verification.
|
|
166
|
+
*/
|
|
167
|
+
export declare function verifyIdentity(scoutCase: ScoutCase, input: IdentityVerificationInput, authoritySuffixes?: readonly string[]): ScoutCase;
|
|
129
168
|
/** Pure decision reason code recomputed from the subject and claims, without stored state. */
|
|
130
169
|
export declare function explainDecision(scoutCase: ScoutCase): DecisionReasonCode;
|
|
131
170
|
export declare function decideCase(scoutCase: ScoutCase, opts?: {
|
|
@@ -141,14 +180,28 @@ export interface DimensionCoverage {
|
|
|
141
180
|
export declare function computeCoverage(scoutCase: ScoutCase): DimensionCoverage[];
|
|
142
181
|
/**
|
|
143
182
|
* Derive a deduplicated, prioritized interview question list from the case.
|
|
144
|
-
*
|
|
145
|
-
*
|
|
146
|
-
*
|
|
147
|
-
*
|
|
183
|
+
*
|
|
184
|
+
* Only two sources feed the list now:
|
|
185
|
+
* - explicit `claim.interviewQuestion` values (what the model actually decided
|
|
186
|
+
* is worth asking), ordered by claim impact;
|
|
187
|
+
* - one dimension-default question for missing required dimensions, dimensions
|
|
188
|
+
* with open claims, and untouched dimensions.
|
|
189
|
+
*
|
|
190
|
+
* `claim.nextAction` is deliberately excluded — it is a research instruction
|
|
191
|
+
* ("verify this claim"), not something a candidate can ask in an interview.
|
|
192
|
+
* The case's curated questions reserve their full quota and are always kept.
|
|
148
193
|
*/
|
|
149
194
|
export declare function generateInterviewQuestions(scoutCase: ScoutCase, opts?: {
|
|
150
195
|
language?: ScoutLanguage;
|
|
151
196
|
}): string[];
|
|
197
|
+
/**
|
|
198
|
+
* Stage-based evidence report (0.9.4 readability rework).
|
|
199
|
+
*
|
|
200
|
+
* The body speaks the reader's language: no E-codes, no source ids, no internal
|
|
201
|
+
* status enums, and no item rendered five times. Sections follow the decision
|
|
202
|
+
* stages (verdict -> subject -> confirmed -> open -> risks -> questions -> gap),
|
|
203
|
+
* with a technical audit trail in the appendices.
|
|
204
|
+
*/
|
|
152
205
|
export declare function renderReport(scoutCase: ScoutCase, opts?: {
|
|
153
206
|
language?: ScoutLanguage;
|
|
154
207
|
}): string;
|