dsh-score 0.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.
@@ -0,0 +1,214 @@
1
+ /**
2
+ * The structured scoring contract `dsh-score/v1`: one score card per target,
3
+ * plus the leaderboard record that aggregates them. The zod schemas are the
4
+ * single source of truth — the same schemas validate records at the durable
5
+ * boundary of the `score` storage domain, and the compiled types type the
6
+ * runtime.
7
+ *
8
+ * Every conclusion a score card carries is backed by an {@link EvidenceLink}
9
+ * (source, sanitized detail, and an audit timestamp). A dimension that has no
10
+ * evidence reports `no-evidence` — it never fabricates a number.
11
+ *
12
+ * @module dsh-score/result
13
+ */
14
+ import { z } from 'zod';
15
+ /** Schema discriminator of every record this plugin writes (version 1). */
16
+ export declare const RESULT_SCHEMA: "dsh-score/v1";
17
+ /** The five scored dimensions, in canonical order. */
18
+ export declare const DIMENSIONS: readonly ["install", "maintenance", "documentation", "security", "compliance"];
19
+ export type Dimension = (typeof DIMENSIONS)[number];
20
+ /** Outcome of one dimension: passing, concerning, failing, or no evidence gathered. */
21
+ export declare const DimensionStatusSchema: z.ZodUnion<readonly [z.ZodLiteral<"pass">, z.ZodLiteral<"warn">, z.ZodLiteral<"fail">, z.ZodLiteral<"no-evidence">]>;
22
+ export type DimensionStatus = z.infer<typeof DimensionStatusSchema>;
23
+ /** How the target was addressed. */
24
+ export declare const TargetKindSchema: z.ZodUnion<readonly [z.ZodLiteral<"repo">, z.ZodLiteral<"npm">]>;
25
+ export type TargetKind = z.infer<typeof TargetKindSchema>;
26
+ /** One audit link: where a fact came from, what was observed, and when. */
27
+ export declare const EvidenceLinkSchema: z.ZodObject<{
28
+ source: z.ZodString;
29
+ detail: z.ZodString;
30
+ observedAt: z.ZodString;
31
+ }, z.core.$strip>;
32
+ export type EvidenceLink = z.infer<typeof EvidenceLinkSchema>;
33
+ /** One dimension's verdict: status, 0..100 score, weight, summary, and evidence. */
34
+ export declare const DimensionScoreSchema: z.ZodObject<{
35
+ dimension: z.ZodEnum<{
36
+ install: "install";
37
+ maintenance: "maintenance";
38
+ documentation: "documentation";
39
+ security: "security";
40
+ compliance: "compliance";
41
+ }>;
42
+ status: z.ZodUnion<readonly [z.ZodLiteral<"pass">, z.ZodLiteral<"warn">, z.ZodLiteral<"fail">, z.ZodLiteral<"no-evidence">]>;
43
+ score: z.ZodNumber;
44
+ weight: z.ZodNumber;
45
+ summary: z.ZodString;
46
+ evidence: z.ZodArray<z.ZodObject<{
47
+ source: z.ZodString;
48
+ detail: z.ZodString;
49
+ observedAt: z.ZodString;
50
+ }, z.core.$strip>>;
51
+ }, z.core.$strip>;
52
+ export type DimensionScore = z.infer<typeof DimensionScoreSchema>;
53
+ /** One complete score card for a target. */
54
+ export declare const ScoreResultSchema: z.ZodObject<{
55
+ schema: z.ZodLiteral<"dsh-score/v1">;
56
+ scoreId: z.ZodString;
57
+ target: z.ZodObject<{
58
+ kind: z.ZodUnion<readonly [z.ZodLiteral<"repo">, z.ZodLiteral<"npm">]>;
59
+ spec: z.ZodString;
60
+ }, z.core.$strip>;
61
+ scoredAt: z.ZodString;
62
+ durationMs: z.ZodNumber;
63
+ pluginVersion: z.ZodString;
64
+ dimensions: z.ZodObject<{
65
+ install: z.ZodObject<{
66
+ dimension: z.ZodEnum<{
67
+ install: "install";
68
+ maintenance: "maintenance";
69
+ documentation: "documentation";
70
+ security: "security";
71
+ compliance: "compliance";
72
+ }>;
73
+ status: z.ZodUnion<readonly [z.ZodLiteral<"pass">, z.ZodLiteral<"warn">, z.ZodLiteral<"fail">, z.ZodLiteral<"no-evidence">]>;
74
+ score: z.ZodNumber;
75
+ weight: z.ZodNumber;
76
+ summary: z.ZodString;
77
+ evidence: z.ZodArray<z.ZodObject<{
78
+ source: z.ZodString;
79
+ detail: z.ZodString;
80
+ observedAt: z.ZodString;
81
+ }, z.core.$strip>>;
82
+ }, z.core.$strip>;
83
+ maintenance: z.ZodObject<{
84
+ dimension: z.ZodEnum<{
85
+ install: "install";
86
+ maintenance: "maintenance";
87
+ documentation: "documentation";
88
+ security: "security";
89
+ compliance: "compliance";
90
+ }>;
91
+ status: z.ZodUnion<readonly [z.ZodLiteral<"pass">, z.ZodLiteral<"warn">, z.ZodLiteral<"fail">, z.ZodLiteral<"no-evidence">]>;
92
+ score: z.ZodNumber;
93
+ weight: z.ZodNumber;
94
+ summary: z.ZodString;
95
+ evidence: z.ZodArray<z.ZodObject<{
96
+ source: z.ZodString;
97
+ detail: z.ZodString;
98
+ observedAt: z.ZodString;
99
+ }, z.core.$strip>>;
100
+ }, z.core.$strip>;
101
+ documentation: z.ZodObject<{
102
+ dimension: z.ZodEnum<{
103
+ install: "install";
104
+ maintenance: "maintenance";
105
+ documentation: "documentation";
106
+ security: "security";
107
+ compliance: "compliance";
108
+ }>;
109
+ status: z.ZodUnion<readonly [z.ZodLiteral<"pass">, z.ZodLiteral<"warn">, z.ZodLiteral<"fail">, z.ZodLiteral<"no-evidence">]>;
110
+ score: z.ZodNumber;
111
+ weight: z.ZodNumber;
112
+ summary: z.ZodString;
113
+ evidence: z.ZodArray<z.ZodObject<{
114
+ source: z.ZodString;
115
+ detail: z.ZodString;
116
+ observedAt: z.ZodString;
117
+ }, z.core.$strip>>;
118
+ }, z.core.$strip>;
119
+ security: z.ZodObject<{
120
+ dimension: z.ZodEnum<{
121
+ install: "install";
122
+ maintenance: "maintenance";
123
+ documentation: "documentation";
124
+ security: "security";
125
+ compliance: "compliance";
126
+ }>;
127
+ status: z.ZodUnion<readonly [z.ZodLiteral<"pass">, z.ZodLiteral<"warn">, z.ZodLiteral<"fail">, z.ZodLiteral<"no-evidence">]>;
128
+ score: z.ZodNumber;
129
+ weight: z.ZodNumber;
130
+ summary: z.ZodString;
131
+ evidence: z.ZodArray<z.ZodObject<{
132
+ source: z.ZodString;
133
+ detail: z.ZodString;
134
+ observedAt: z.ZodString;
135
+ }, z.core.$strip>>;
136
+ }, z.core.$strip>;
137
+ compliance: z.ZodObject<{
138
+ dimension: z.ZodEnum<{
139
+ install: "install";
140
+ maintenance: "maintenance";
141
+ documentation: "documentation";
142
+ security: "security";
143
+ compliance: "compliance";
144
+ }>;
145
+ status: z.ZodUnion<readonly [z.ZodLiteral<"pass">, z.ZodLiteral<"warn">, z.ZodLiteral<"fail">, z.ZodLiteral<"no-evidence">]>;
146
+ score: z.ZodNumber;
147
+ weight: z.ZodNumber;
148
+ summary: z.ZodString;
149
+ evidence: z.ZodArray<z.ZodObject<{
150
+ source: z.ZodString;
151
+ detail: z.ZodString;
152
+ observedAt: z.ZodString;
153
+ }, z.core.$strip>>;
154
+ }, z.core.$strip>;
155
+ }, z.core.$strip>;
156
+ total: z.ZodNumber;
157
+ grade: z.ZodString;
158
+ verdict: z.ZodString;
159
+ }, z.core.$strip>;
160
+ export type ScoreResult = z.infer<typeof ScoreResultSchema>;
161
+ /** One leaderboard row: the per-target total plus per-dimension statuses. */
162
+ export declare const LeaderboardRowSchema: z.ZodObject<{
163
+ target: z.ZodString;
164
+ kind: z.ZodUnion<readonly [z.ZodLiteral<"repo">, z.ZodLiteral<"npm">]>;
165
+ total: z.ZodNumber;
166
+ grade: z.ZodString;
167
+ verdict: z.ZodString;
168
+ durationMs: z.ZodNumber;
169
+ install: z.ZodUnion<readonly [z.ZodLiteral<"pass">, z.ZodLiteral<"warn">, z.ZodLiteral<"fail">, z.ZodLiteral<"no-evidence">]>;
170
+ maintenance: z.ZodUnion<readonly [z.ZodLiteral<"pass">, z.ZodLiteral<"warn">, z.ZodLiteral<"fail">, z.ZodLiteral<"no-evidence">]>;
171
+ documentation: z.ZodUnion<readonly [z.ZodLiteral<"pass">, z.ZodLiteral<"warn">, z.ZodLiteral<"fail">, z.ZodLiteral<"no-evidence">]>;
172
+ security: z.ZodUnion<readonly [z.ZodLiteral<"pass">, z.ZodLiteral<"warn">, z.ZodLiteral<"fail">, z.ZodLiteral<"no-evidence">]>;
173
+ compliance: z.ZodUnion<readonly [z.ZodLiteral<"pass">, z.ZodLiteral<"warn">, z.ZodLiteral<"fail">, z.ZodLiteral<"no-evidence">]>;
174
+ }, z.core.$strip>;
175
+ export type LeaderboardRow = z.infer<typeof LeaderboardRowSchema>;
176
+ /** Aggregated leaderboard record keyed by its id. */
177
+ export declare const LeaderboardRecordSchema: z.ZodObject<{
178
+ schema: z.ZodLiteral<"dsh-score/v1">;
179
+ id: z.ZodString;
180
+ createdAt: z.ZodString;
181
+ durationMs: z.ZodNumber;
182
+ rows: z.ZodArray<z.ZodObject<{
183
+ target: z.ZodString;
184
+ kind: z.ZodUnion<readonly [z.ZodLiteral<"repo">, z.ZodLiteral<"npm">]>;
185
+ total: z.ZodNumber;
186
+ grade: z.ZodString;
187
+ verdict: z.ZodString;
188
+ durationMs: z.ZodNumber;
189
+ install: z.ZodUnion<readonly [z.ZodLiteral<"pass">, z.ZodLiteral<"warn">, z.ZodLiteral<"fail">, z.ZodLiteral<"no-evidence">]>;
190
+ maintenance: z.ZodUnion<readonly [z.ZodLiteral<"pass">, z.ZodLiteral<"warn">, z.ZodLiteral<"fail">, z.ZodLiteral<"no-evidence">]>;
191
+ documentation: z.ZodUnion<readonly [z.ZodLiteral<"pass">, z.ZodLiteral<"warn">, z.ZodLiteral<"fail">, z.ZodLiteral<"no-evidence">]>;
192
+ security: z.ZodUnion<readonly [z.ZodLiteral<"pass">, z.ZodLiteral<"warn">, z.ZodLiteral<"fail">, z.ZodLiteral<"no-evidence">]>;
193
+ compliance: z.ZodUnion<readonly [z.ZodLiteral<"pass">, z.ZodLiteral<"warn">, z.ZodLiteral<"fail">, z.ZodLiteral<"no-evidence">]>;
194
+ }, z.core.$strip>>;
195
+ totals: z.ZodObject<{
196
+ total: z.ZodNumber;
197
+ pass: z.ZodNumber;
198
+ warn: z.ZodNumber;
199
+ fail: z.ZodNumber;
200
+ noEvidence: z.ZodNumber;
201
+ }, z.core.$strip>;
202
+ }, z.core.$strip>;
203
+ export type LeaderboardRecord = z.infer<typeof LeaderboardRecordSchema>;
204
+ /** Weighted average over dimensions that actually gathered evidence. */
205
+ export declare function computeTotal(dimensions: readonly DimensionScore[]): number;
206
+ /** Whether any dimension gathered evidence (as opposed to a fully inconclusive card). */
207
+ export declare function hasEvidence(dimensions: readonly DimensionScore[]): boolean;
208
+ /** Letter grade for a weighted total; `N/A` when no dimension had evidence. */
209
+ export declare function gradeOf(total: number, evidenced: boolean): string;
210
+ /** One-line whole-card verdict from the total and evidence coverage. */
211
+ export declare function verdictOf(total: number, evidenced: boolean): string;
212
+ /** Compile the per-target tallies for one leaderboard record. */
213
+ export declare function totalsOf(rows: readonly LeaderboardRow[]): LeaderboardRecord['totals'];
214
+ //# sourceMappingURL=result.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"result.d.ts","sourceRoot":"","sources":["../../src/result.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,2EAA2E;AAC3E,eAAO,MAAM,aAAa,EAAG,cAAuB,CAAA;AAEpD,sDAAsD;AACtD,eAAO,MAAM,UAAU,gFAAiF,CAAA;AACxG,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC,CAAA;AAEnD,uFAAuF;AACvF,eAAO,MAAM,qBAAqB,sHAKhC,CAAA;AACF,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAA;AAEnE,oCAAoC;AACpC,eAAO,MAAM,gBAAgB,kEAAiD,CAAA;AAC9E,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAA;AAEzD,2EAA2E;AAC3E,eAAO,MAAM,kBAAkB;;;;iBAO7B,CAAA;AACF,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAA;AAE7D,oFAAoF;AACpF,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;iBAa/B,CAAA;AACF,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAA;AAEjE,4CAA4C;AAC5C,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA+B5B,CAAA;AACF,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAA;AAE3D,6EAA6E;AAC7E,eAAO,MAAM,oBAAoB;;;;;;;;;;;;iBAmB/B,CAAA;AACF,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAA;AAEjE,qDAAqD;AACrD,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;iBAmBlC,CAAA;AACF,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAA;AAEvE,wEAAwE;AACxE,wBAAgB,YAAY,CAAC,UAAU,EAAE,SAAS,cAAc,EAAE,GAAG,MAAM,CAU1E;AAED,yFAAyF;AACzF,wBAAgB,WAAW,CAAC,UAAU,EAAE,SAAS,cAAc,EAAE,GAAG,OAAO,CAE1E;AAED,+EAA+E;AAC/E,wBAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,GAAG,MAAM,CAOjE;AAED,wEAAwE;AACxE,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,GAAG,MAAM,CAMnE;AAED,iEAAiE;AACjE,wBAAgB,QAAQ,CAAC,IAAI,EAAE,SAAS,cAAc,EAAE,GAAG,iBAAiB,CAAC,QAAQ,CAAC,CAarF"}
@@ -0,0 +1,64 @@
1
+ /**
2
+ * Pure sanitizers for every string that reaches a report, a log, or the model.
3
+ * Nothing here reads the environment or the clock: report content is the only
4
+ * caller, and the sanitizers must stay testable with extreme inputs (token
5
+ * literals, credential-bearing URLs, hostile repo specs, machine-local paths).
6
+ *
7
+ * The same secret patterns drive two jobs — redaction for display and
8
+ * detection for the security dimension — so the compiled regexes are exported.
9
+ *
10
+ * @module dsh-score/sanitize
11
+ */
12
+ /** GitHub personal access tokens (`ghp_` prefix, ≥20 body chars). */
13
+ export declare const GITHUB_TOKEN: RegExp;
14
+ /** npm access tokens (`npm_` prefix, ≥20 body chars). */
15
+ export declare const NPM_TOKEN: RegExp;
16
+ /** OpenAI-style keys (`sk-` prefix, ≥16 body chars) and common jwt/aws/twilio shapes. */
17
+ export declare const API_KEY: RegExp;
18
+ /** `scheme://user:pass@host` — keeps the scheme and host, drops the credentials. */
19
+ export declare const URL_CREDENTIALS: RegExp;
20
+ /** `Authorization: Bearer <token>`-style header lines. */
21
+ export declare const BEARER: RegExp;
22
+ /** Maximum length of a sanitized target spec recorded in a report. */
23
+ export declare const MAX_TARGET_SPEC_LENGTH = 1000;
24
+ /** Marker substituted for every redacted secret. */
25
+ export declare const REDACTED = "***REDACTED***";
26
+ /** Secret pattern name → the compiled matcher, in a stable display order. */
27
+ export declare const SECRET_PATTERNS: ReadonlyArray<{
28
+ name: string;
29
+ pattern: RegExp;
30
+ }>;
31
+ /**
32
+ * Replace credential-shaped substrings with {@link REDACTED}.
33
+ *
34
+ * @param text - any output or user-supplied string.
35
+ * @returns the same text with secrets redacted.
36
+ */
37
+ export declare function redactSecrets(text: string): string;
38
+ /**
39
+ * Detect which secret pattern names occur in a text block, de-duplicated in
40
+ * a stable order. Detection (unlike redaction) reports the full pattern name.
41
+ *
42
+ * @param text - any scanned content.
43
+ * @returns the matched pattern names, in stable order.
44
+ */
45
+ export declare function scanSecretPatterns(text: string): string[];
46
+ /**
47
+ * Sanitize one user-supplied target spec for recording and display: strip
48
+ * control characters, redact embedded credentials, cap the length, and keep
49
+ * surrounding whitespace off the recorded value.
50
+ *
51
+ * @param spec - the raw target as the user supplied it.
52
+ * @returns the sanitized spec; never throws.
53
+ */
54
+ export declare function sanitizeTarget(spec: string): string;
55
+ /**
56
+ * Bound a multi-line output stream to a short tail for one-line summaries.
57
+ * The tail keeps the END of the text (errors and final results cluster there).
58
+ *
59
+ * @param text - collected output.
60
+ * @param maxChars - retained character count.
61
+ * @returns the tail, prefixed with a truncation marker when shortened.
62
+ */
63
+ export declare function tailText(text: string, maxChars: number): string;
64
+ //# sourceMappingURL=sanitize.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sanitize.d.ts","sourceRoot":"","sources":["../../src/sanitize.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,qEAAqE;AACrE,eAAO,MAAM,YAAY,QAA2B,CAAA;AAEpD,yDAAyD;AACzD,eAAO,MAAM,SAAS,QAA2B,CAAA;AAEjD,yFAAyF;AACzF,eAAO,MAAM,OAAO,QAA8E,CAAA;AAElG,oFAAoF;AACpF,eAAO,MAAM,eAAe,QAA0D,CAAA;AAEtF,0DAA0D;AAC1D,eAAO,MAAM,MAAM,QAA2C,CAAA;AAM9D,sEAAsE;AACtE,eAAO,MAAM,sBAAsB,OAAQ,CAAA;AAE3C,oDAAoD;AACpD,eAAO,MAAM,QAAQ,mBAAmB,CAAA;AAExC,6EAA6E;AAC7E,eAAO,MAAM,eAAe,EAAE,aAAa,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAM5E,CAAA;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAOlD;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAQzD;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEnD;AAED;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAI/D"}
@@ -0,0 +1,65 @@
1
+ /**
2
+ * The single-target scoring pipeline: classify and sanitize the target, gather
3
+ * evidence through the {@link ProbeDriver}, read reserved test-drive install
4
+ * evidence from the already-open `test_drive` domain (best-effort — absent
5
+ * means `no-evidence`), evaluate the five dimensions, and persist the score
6
+ * card keyed by a deterministic hash of the target spec (the score cache).
7
+ *
8
+ * Every domain access is best-effort: a missing `storageDomain` service or a
9
+ * failing medium is logged and the score is still returned — persistence
10
+ * degrades, scoring never fabricates.
11
+ *
12
+ * @module dsh-score/score
13
+ */
14
+ import type { Context } from '@deepseek-ai/cordis';
15
+ import type { Domain } from '@deepseek-ai/dsh-storage-domain';
16
+ import type { ResolvedConfig } from './config.ts';
17
+ import type { InstallEvidence } from './dimensions.ts';
18
+ import type { scoreDomainSpec } from './domain.ts';
19
+ import { ProbeDriver } from './probe.ts';
20
+ import type { ScoreResult } from './result.ts';
21
+ /** Prefix of a score-card key (deterministic, so it doubles as the cache key). */
22
+ export declare const SCORE_KEY_PREFIX = "sc_";
23
+ /** Deterministic table key for one target spec (sanitized, hashed). */
24
+ export declare function scoreKey(spec: string): string;
25
+ /** Everything the pipeline needs at runtime; assembled by `src/index.ts`. */
26
+ export interface ScoreDeps {
27
+ ctx: Context;
28
+ config: ResolvedConfig;
29
+ driver: ProbeDriver;
30
+ log: (line: string) => void;
31
+ domain: () => Promise<Domain<typeof scoreDomainSpec>>;
32
+ }
33
+ /**
34
+ * Read the reserved install evidence from the already-open `test_drive`
35
+ * domain. Best-effort and never hard-dependent: when the storage-domain
36
+ * service, the `test_drive` domain, or a matching record is absent, this
37
+ * returns undefined and the install dimension reports `no-evidence`.
38
+ *
39
+ * @param ctx - context carrying the optional `storageDomain` service.
40
+ * @param spec - the scored target spec.
41
+ * @param packageName - npm package name (alternative match key), when known.
42
+ * @returns the newest matching drive verdict, or undefined.
43
+ */
44
+ export declare function readTestDriveEvidence(ctx: Context, spec: string, packageName: string | undefined): InstallEvidence | undefined;
45
+ /** The single-target scoring pipeline. */
46
+ export declare class ScoreRunner {
47
+ private readonly deps;
48
+ constructor(deps: ScoreDeps);
49
+ /** Persist one settled score card; a failing medium is logged, never thrown. */
50
+ private record;
51
+ /** Return a still-fresh cached card for the target, or undefined. */
52
+ private cached;
53
+ /**
54
+ * Score one target through the full pipeline.
55
+ *
56
+ * @param target - raw target spec (repo or npm package).
57
+ * @param options - caller cancellation and cache override.
58
+ * @returns the structured score card; never throws for missing evidence.
59
+ */
60
+ score(target: string, options?: {
61
+ signal?: AbortSignal | undefined;
62
+ refresh?: boolean;
63
+ }): Promise<ScoreResult>;
64
+ }
65
+ //# sourceMappingURL=score.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"score.d.ts","sourceRoot":"","sources":["../../src/score.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,KAAK,EAAE,MAAM,EAAW,MAAM,iCAAiC,CAAA;AACtE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAEjD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACtD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAClD,OAAO,EAAE,WAAW,EAAuD,MAAM,YAAY,CAAA;AAI7F,OAAO,KAAK,EAAgB,WAAW,EAAE,MAAM,aAAa,CAAA;AAI5D,kFAAkF;AAClF,eAAO,MAAM,gBAAgB,QAAQ,CAAA;AAErC,uEAAuE;AACvE,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE7C;AAED,6EAA6E;AAC7E,MAAM,WAAW,SAAS;IACxB,GAAG,EAAE,OAAO,CAAA;IACZ,MAAM,EAAE,cAAc,CAAA;IACtB,MAAM,EAAE,WAAW,CAAA;IACnB,GAAG,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IAC3B,MAAM,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,OAAO,eAAe,CAAC,CAAC,CAAA;CACtD;AAkCD;;;;;;;;;;GAUG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,SAAS,GAAG,eAAe,GAAG,SAAS,CAuB9H;AAqCD,0CAA0C;AAC1C,qBAAa,WAAW;IACV,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,SAAS;IAE5C,gFAAgF;YAClE,MAAM;IASpB,qEAAqE;YACvD,MAAM;IAYpB;;;;;;OAMG;IACG,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE;QAAE,MAAM,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;QAAC,OAAO,CAAC,EAAE,OAAO,CAAA;KAAO,GAAG,OAAO,CAAC,WAAW,CAAC;CAyCzH"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * The two model tools: `score` (one target through the full scoring pipeline,
3
+ * optionally as a background job) and `score_report` (fetch a stored score
4
+ * card or leaderboard by id, or the latest leaderboard). Canonical outputs are
5
+ * the structured records themselves; the renderers turn them into Markdown.
6
+ *
7
+ * @module dsh-score/tools
8
+ */
9
+ import type { Context } from '@deepseek-ai/cordis';
10
+ import type { Domain } from '@deepseek-ai/dsh-storage-domain';
11
+ import type { BatchDeps } from './batch.ts';
12
+ import type { ResolvedConfig } from './config.ts';
13
+ import type { scoreDomainSpec } from './domain.ts';
14
+ import { ScoreRunner } from './score.ts';
15
+ /** Everything both tools need; assembled by `src/index.ts`. */
16
+ export interface ToolServices extends BatchDeps {
17
+ ctx: Context;
18
+ config: ResolvedConfig;
19
+ domain: () => Promise<Domain<typeof scoreDomainSpec>>;
20
+ runner: ScoreRunner;
21
+ }
22
+ /** Canonical background branch returned when `score` runs as a job. */
23
+ export interface BackgroundHandle {
24
+ kind: 'background';
25
+ jobId: string;
26
+ }
27
+ /** Build both tool definitions over the shared services. */
28
+ export declare function allTools(services: ToolServices): import("@deepseek-ai/dsh-tools").ToolDefinition[];
29
+ //# sourceMappingURL=tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../src/tools.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAElD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAA;AAI7D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAC3C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AACjD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAIlD,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAIxC,+DAA+D;AAC/D,MAAM,WAAW,YAAa,SAAQ,SAAS;IAC7C,GAAG,EAAE,OAAO,CAAA;IACZ,MAAM,EAAE,cAAc,CAAA;IACtB,MAAM,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,OAAO,eAAe,CAAC,CAAC,CAAA;IACrD,MAAM,EAAE,WAAW,CAAA;CACpB;AA0GD,uEAAuE;AACvE,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,YAAY,CAAA;IAClB,KAAK,EAAE,MAAM,CAAA;CACd;AA2BD,4DAA4D;AAC5D,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,YAAY,qDAoF9C"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Producer version, kept in lockstep with `package.json` by
3
+ * `scripts/release.mjs`; `tests/version.spec.ts` trips when they drift.
4
+ * The structured score records it as `score.pluginVersion`.
5
+ * @module dsh-score/version
6
+ */
7
+ export declare const VERSION = "0.1.0";
8
+ //# sourceMappingURL=version.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAO,MAAM,OAAO,UAAU,CAAA"}
package/package.json ADDED
@@ -0,0 +1,144 @@
1
+ {
2
+ "name": "dsh-score",
3
+ "version": "0.1.0",
4
+ "description": "Multi-dimensional quality scoring for DeepSeek Harness plugins: scores one repo or npm package across install success (consuming dsh-test-drive results), maintenance activity, documentation completeness, security scan, and protocol compliance — every conclusion backed by real CLI evidence with audit timestamps — and produces a JSON/Markdown leaderboard report",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/PerryLink/dsh-score.git"
8
+ },
9
+ "homepage": "https://github.com/PerryLink/dsh-score#readme",
10
+ "bugs": {
11
+ "url": "https://github.com/PerryLink/dsh-score/issues"
12
+ },
13
+ "author": "PerryLink",
14
+ "private": false,
15
+ "type": "module",
16
+ "main": "./lib/index.js",
17
+ "types": "./lib/types/index.d.ts",
18
+ "exports": {
19
+ ".": {
20
+ "types": "./lib/types/index.d.ts",
21
+ "default": "./lib/index.js"
22
+ },
23
+ "./package.json": "./package.json"
24
+ },
25
+ "files": [
26
+ "lib",
27
+ "cordis.patch.yml",
28
+ "CHANGELOG.md",
29
+ "THIRD_PARTY_NOTICES.md",
30
+ "SECURITY.md",
31
+ "README.md",
32
+ "README.zh.md",
33
+ "README.es.md",
34
+ "README.pt.md",
35
+ "README.hi.md",
36
+ "LICENSE"
37
+ ],
38
+ "dsh": {
39
+ "bundle": {
40
+ "patch": "./cordis.patch.yml"
41
+ }
42
+ },
43
+ "dshWorkshop": {
44
+ "schema": "omdsh-workshop-package/v1",
45
+ "type": "plugin",
46
+ "integration": {
47
+ "protocol": "harness-profile",
48
+ "artifact": "cordis.patch.yml"
49
+ },
50
+ "install": {
51
+ "mode": "transactional",
52
+ "adapter": "profile-bundle",
53
+ "failurePolicy": "generation-rollback",
54
+ "touchesCurrentBeforeActivation": false
55
+ },
56
+ "lifecycle": {
57
+ "activation": "hot-reload",
58
+ "dispose": "supported"
59
+ },
60
+ "permissions": [
61
+ "fs:read",
62
+ "subprocess:spawn",
63
+ "session:append",
64
+ "network:inherit",
65
+ "native-code:none"
66
+ ],
67
+ "compatibility": {
68
+ "dshVersions": [
69
+ "0.1.0-rc.6"
70
+ ]
71
+ },
72
+ "capability": {
73
+ "id": "plugin-quality-score",
74
+ "kind": "tool",
75
+ "invocation": "score, /score, score_report, score_batch",
76
+ "expected": "scores one repo or npm package across five dimensions (install success, maintenance, documentation, security, protocol compliance) from real CLI evidence and produces a JSON/Markdown leaderboard report"
77
+ },
78
+ "evidence": {
79
+ "install": null,
80
+ "failureIsolation": null,
81
+ "hotReload": null,
82
+ "remove": null
83
+ }
84
+ },
85
+ "keywords": [
86
+ "dsh",
87
+ "dsh-plugin",
88
+ "deepseek-harness",
89
+ "deepseek",
90
+ "cordis",
91
+ "plugin-scoring",
92
+ "quality-score",
93
+ "leaderboard",
94
+ "supply-chain"
95
+ ],
96
+ "engines": {
97
+ "node": "^22.19.0 || >=24.0.0"
98
+ },
99
+ "packageManager": "pnpm@11.7.0",
100
+ "peerDependencies": {
101
+ "@deepseek-ai/cordis": "^4.0.1",
102
+ "@deepseek-ai/schemastery": "^3.18.0",
103
+ "@deepseek-ai/dsh-agent": "0.1.0-rc.6",
104
+ "@deepseek-ai/dsh-commands": "0.1.0-rc.6",
105
+ "@deepseek-ai/dsh-jobs": "0.1.0-rc.6",
106
+ "@deepseek-ai/dsh-storage-domain": "0.1.0-rc.6",
107
+ "@deepseek-ai/dsh-subprocess": "0.1.0-rc.6",
108
+ "@deepseek-ai/dsh-tools": "0.1.0-rc.6"
109
+ },
110
+ "dependencies": {
111
+ "tsdown": "^0.22.14",
112
+ "typescript": "^5.9.0",
113
+ "zod": "^4.4.3"
114
+ },
115
+ "devDependencies": {
116
+ "@deepseek-ai/cordis": "^4.0.1",
117
+ "@deepseek-ai/schemastery": "^3.18.0",
118
+ "@deepseek-ai/dsh-agent": "0.1.0-rc.6",
119
+ "@deepseek-ai/dsh-commands": "0.1.0-rc.6",
120
+ "@deepseek-ai/dsh-jobs": "0.1.0-rc.6",
121
+ "@deepseek-ai/dsh-jobs-local": "0.1.0-rc.6",
122
+ "@deepseek-ai/dsh-llm": "0.1.0-rc.6",
123
+ "@deepseek-ai/dsh-session": "0.1.0-rc.6",
124
+ "@deepseek-ai/dsh-storage": "0.1.0-rc.6",
125
+ "@deepseek-ai/dsh-storage-domain": "0.1.0-rc.6",
126
+ "@deepseek-ai/dsh-subprocess": "0.1.0-rc.6",
127
+ "@deepseek-ai/dsh-subprocess-local": "0.1.0-rc.6",
128
+ "@deepseek-ai/dsh-tools": "0.1.0-rc.6",
129
+ "@types/node": "^22.19.0",
130
+ "vitest": "^3.2.0",
131
+ "zod": "^4.4.3"
132
+ },
133
+ "scripts": {
134
+ "build": "node scripts/prepare.mjs",
135
+ "prepare": "node scripts/prepare.mjs",
136
+ "typecheck": "tsc -p tsconfig.json --noEmit && tsc -p tsconfig.test.json --noEmit",
137
+ "typecheck:ci": "tsc -p tsconfig.ci.json --noEmit",
138
+ "test": "vitest run",
139
+ "test:watch": "vitest",
140
+ "verify:self-contained": "node scripts/verify-self-contained.mjs",
141
+ "verify:artifacts": "node scripts/verify-artifacts.mjs"
142
+ },
143
+ "license": "Apache-2.0"
144
+ }