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,55 @@
1
+ /**
2
+ * The `score-batch` background-job producer over `ctx.jobs`. One job scores a
3
+ * list of targets (serially or with bounded concurrency), streams per-target
4
+ * progress lines through `readOutput`, and on settlement writes the leaderboard
5
+ * record (JSON) into the storage domain plus the latest-leaderboard pointer, so
6
+ * `score_report` can fetch the Markdown/JSON pair by id.
7
+ *
8
+ * @module dsh-score/batch
9
+ */
10
+ import type { Agent } from '@deepseek-ai/dsh-agent';
11
+ import type { Context } from '@deepseek-ai/cordis';
12
+ import type { JobId } from '@deepseek-ai/dsh-jobs';
13
+ import type { LeaderboardRecord, LeaderboardRow, ScoreResult } from './result.ts';
14
+ import type { ScoreDeps } from './score.ts';
15
+ /** The job kind this producer registers (declaration-merged into JobKindMap). */
16
+ export declare const SCORE_BATCH_KIND: "score-batch";
17
+ declare module '@deepseek-ai/dsh-jobs' {
18
+ interface JobKindMap {
19
+ 'score-batch': typeof SCORE_BATCH_KIND;
20
+ }
21
+ }
22
+ /** id prefix of a leaderboard record. */
23
+ export declare const LEADERBOARD_ID_PREFIX = "lb_";
24
+ /** Fresh unique leaderboard id. */
25
+ export declare function freshLeaderboardId(): string;
26
+ /** Everything one batch job needs; assembled by `src/index.ts`. */
27
+ export interface BatchDeps extends ScoreDeps {
28
+ ctx: Context;
29
+ }
30
+ /** Settled leaderboard-write facts (tests assert the pointer landed). */
31
+ export interface BatchSettlement {
32
+ leaderboardId: string;
33
+ leaderboard: LeaderboardRecord;
34
+ }
35
+ /** Project one score card into a leaderboard row. */
36
+ export declare function rowOf(result: ScoreResult): LeaderboardRow;
37
+ /** One progress line after a target settles. */
38
+ export declare function progressLine(index: number, total: number, result: ScoreResult): string;
39
+ /** The batch work function shared by the job producer and direct tests. */
40
+ export declare function runBatch(deps: BatchDeps, targets: readonly string[], signal: AbortSignal, onProgress: (line: string) => void): Promise<BatchSettlement>;
41
+ /** One-line settlement summary for notices and the final flush. */
42
+ export declare function leaderboardSummary(leaderboard: LeaderboardRecord): string;
43
+ /**
44
+ * Start one `score-batch` background job. The returned id doubles as the
45
+ * handle the model uses to read output and, via the final flush line, to find
46
+ * the leaderboard record for `score_report`.
47
+ *
48
+ * @param deps - batch dependencies.
49
+ * @param targets - raw target specs.
50
+ * @param owner - the owning agent (from the command invocation).
51
+ * @param label - one-line model-facing label.
52
+ * @returns the registry-issued job id.
53
+ */
54
+ export declare function startBatchJob(deps: BatchDeps, targets: readonly string[], owner: Agent, label: string): JobId;
55
+ //# sourceMappingURL=batch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"batch.d.ts","sourceRoot":"","sources":["../../src/batch.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAA;AACnD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,KAAK,EAAY,KAAK,EAAuB,MAAM,uBAAuB,CAAA;AAEjF,OAAO,KAAK,EAAE,iBAAiB,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAGjF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAE3C,iFAAiF;AACjF,eAAO,MAAM,gBAAgB,EAAG,aAAsB,CAAA;AAEtD,OAAO,QAAQ,uBAAuB,CAAC;IACrC,UAAU,UAAU;QAClB,aAAa,EAAE,OAAO,gBAAgB,CAAA;KACvC;CACF;AAED,yCAAyC;AACzC,eAAO,MAAM,qBAAqB,QAAQ,CAAA;AAE1C,mCAAmC;AACnC,wBAAgB,kBAAkB,IAAI,MAAM,CAE3C;AAED,mEAAmE;AACnE,MAAM,WAAW,SAAU,SAAQ,SAAS;IAC1C,GAAG,EAAE,OAAO,CAAA;CACb;AAED,yEAAyE;AACzE,MAAM,WAAW,eAAe;IAC9B,aAAa,EAAE,MAAM,CAAA;IACrB,WAAW,EAAE,iBAAiB,CAAA;CAC/B;AAED,qDAAqD;AACrD,wBAAgB,KAAK,CAAC,MAAM,EAAE,WAAW,GAAG,cAAc,CAczD;AAED,gDAAgD;AAChD,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,GAAG,MAAM,CAEtF;AAED,2EAA2E;AAC3E,wBAAsB,QAAQ,CAC5B,IAAI,EAAE,SAAS,EACf,OAAO,EAAE,SAAS,MAAM,EAAE,EAC1B,MAAM,EAAE,WAAW,EACnB,UAAU,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GACjC,OAAO,CAAC,eAAe,CAAC,CAsC1B;AAED,mEAAmE;AACnE,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,iBAAiB,GAAG,MAAM,CAGzE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,MAAM,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,GAAG,KAAK,CA2C7G"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * The `/score` slash command: parse a whitespace/comma-separated target list
3
+ * from the command input and start one `score-batch` background job over
4
+ * `ctx.jobs`. The command itself never runs the scores — the job owns the
5
+ * work, the progress stream, and the final leaderboard snapshot.
6
+ *
7
+ * @module dsh-score/command
8
+ */
9
+ import type { CommandInvocation, CommandResult } from '@deepseek-ai/dsh-commands';
10
+ import type { BatchDeps } from './batch.ts';
11
+ /** Split raw command input into target specs (whitespace and commas separate). */
12
+ export declare function parseTargets(rawInput: string): string[];
13
+ /**
14
+ * Execute `/score <targets...>`: validate the target list against the
15
+ * configured batch cap and start the batch job for the invoking agent.
16
+ *
17
+ * @param deps - batch dependencies.
18
+ * @param invocation - the command invocation.
19
+ * @returns the command result naming the started job.
20
+ */
21
+ export declare function handleScore(deps: BatchDeps, invocation: CommandInvocation): CommandResult;
22
+ //# sourceMappingURL=command.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../src/command.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AACjF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAG3C,kFAAkF;AAClF,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,CAKvD;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,SAAS,EAAE,UAAU,EAAE,iBAAiB,GAAG,aAAa,CAazF"}
@@ -0,0 +1,84 @@
1
+ /**
2
+ * Plugin configuration and its explicit resolve step. `resolveConfig` re-judges
3
+ * every default and bound so programmatic construction that bypasses
4
+ * Schemastery normalization still fails loud instead of running with hidden
5
+ * defaults (the explicit-resolve contract). Every tunable is a Config field —
6
+ * no scoring threshold or weight is hardcoded in the evaluators.
7
+ *
8
+ * @module dsh-score/config
9
+ */
10
+ import z from '@deepseek-ai/schemastery';
11
+ import type { Dimension } from './result.ts';
12
+ /** Default deadline for one git/gh/npm probe command in milliseconds. */
13
+ export declare const DEFAULT_PROBE_TIMEOUT_MS = 60000;
14
+ export declare const MIN_PROBE_TIMEOUT_MS = 1000;
15
+ export declare const MAX_PROBE_TIMEOUT_MS = 600000;
16
+ /** Default cap on the sanitized output tail recorded per probe, in bytes. */
17
+ export declare const DEFAULT_OUTPUT_TAIL_BYTES = 8000;
18
+ export declare const MIN_OUTPUT_TAIL_BYTES = 256;
19
+ export declare const MAX_OUTPUT_TAIL_BYTES = 256000;
20
+ /** Default staleness for a cached score card before it is re-scored. */
21
+ export declare const DEFAULT_CACHE_MAX_AGE_MS = 86400000;
22
+ export declare const MAX_CACHE_MAX_AGE_MS = 2592000000;
23
+ /** Default commit-recency thresholds in days. */
24
+ export declare const DEFAULT_STALE_COMMIT_WARN_DAYS = 90;
25
+ export declare const DEFAULT_STALE_COMMIT_FAIL_DAYS = 365;
26
+ /** Default open-issue-age thresholds in days (issue response proxy). */
27
+ export declare const DEFAULT_STALE_ISSUE_WARN_DAYS = 30;
28
+ export declare const DEFAULT_STALE_ISSUE_FAIL_DAYS = 180;
29
+ /** Bound shared by every day-count threshold. */
30
+ export declare const MIN_DAYS = 1;
31
+ export declare const MAX_DAYS = 3650;
32
+ /** Default batch cap and concurrency. */
33
+ export declare const DEFAULT_MAX_BATCH_TARGETS = 20;
34
+ export declare const MAX_BATCH_TARGETS = 200;
35
+ export declare const DEFAULT_BATCH_CONCURRENCY = 1;
36
+ export declare const MAX_BATCH_CONCURRENCY = 4;
37
+ /** Default dimension weights (sum 100). Install is the heaviest because it is the only measured signal. */
38
+ export declare const DEFAULT_WEIGHTS: Record<Dimension, number>;
39
+ /** Configuration for the dsh-score quality-scoring tools. */
40
+ export interface Config {
41
+ /** Deadline for one git/gh/npm probe command in milliseconds (default 60000). */
42
+ probeTimeoutMs?: number;
43
+ /** Cap on the sanitized output tail recorded per probe in bytes (default 8000). */
44
+ outputTailBytes?: number;
45
+ /** How long a cached score card is reused before re-scoring, in milliseconds (default 86400000). */
46
+ cacheMaxAgeMs?: number;
47
+ /** Commit age (days) at which maintenance drops to warn (default 90). */
48
+ staleCommitWarnDays?: number;
49
+ /** Commit age (days) at which maintenance drops to fail (default 365). */
50
+ staleCommitFailDays?: number;
51
+ /** Oldest-open-issue age (days) at which maintenance drops to warn (default 30). */
52
+ staleIssueWarnDays?: number;
53
+ /** Oldest-open-issue age (days) at which maintenance drops to fail (default 180). */
54
+ staleIssueFailDays?: number;
55
+ /** Maximum targets one `/score` batch accepts (default 20). */
56
+ maxBatchTargets?: number;
57
+ /** Batch concurrency (default 1). */
58
+ batchConcurrency?: number;
59
+ /** Per-dimension weights used to sum the total (defaults sum to 100). */
60
+ weights?: Partial<Record<Dimension, number>>;
61
+ }
62
+ /** Fully resolved configuration captured at plugin load. */
63
+ export interface ResolvedConfig {
64
+ probeTimeoutMs: number;
65
+ outputTailBytes: number;
66
+ cacheMaxAgeMs: number;
67
+ staleCommitWarnDays: number;
68
+ staleCommitFailDays: number;
69
+ staleIssueWarnDays: number;
70
+ staleIssueFailDays: number;
71
+ maxBatchTargets: number;
72
+ batchConcurrency: number;
73
+ weights: Record<Dimension, number>;
74
+ }
75
+ /** Schemastery schema for loader-validated configuration. */
76
+ export declare const Config: z<Config>;
77
+ /**
78
+ * Resolve raw config to the runtime policy, re-validating defaults and bounds.
79
+ *
80
+ * @param config - raw loader config; `undefined` for a bare row.
81
+ * @returns the frozen resolved config.
82
+ */
83
+ export declare function resolveConfig(config: Config | undefined): ResolvedConfig;
84
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,CAAC,MAAM,0BAA0B,CAAA;AACxC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAE5C,yEAAyE;AACzE,eAAO,MAAM,wBAAwB,QAAS,CAAA;AAC9C,eAAO,MAAM,oBAAoB,OAAQ,CAAA;AACzC,eAAO,MAAM,oBAAoB,SAAU,CAAA;AAE3C,6EAA6E;AAC7E,eAAO,MAAM,yBAAyB,OAAQ,CAAA;AAC9C,eAAO,MAAM,qBAAqB,MAAM,CAAA;AACxC,eAAO,MAAM,qBAAqB,SAAU,CAAA;AAE5C,wEAAwE;AACxE,eAAO,MAAM,wBAAwB,WAAa,CAAA;AAClD,eAAO,MAAM,oBAAoB,aAAgB,CAAA;AAEjD,iDAAiD;AACjD,eAAO,MAAM,8BAA8B,KAAK,CAAA;AAChD,eAAO,MAAM,8BAA8B,MAAM,CAAA;AAEjD,wEAAwE;AACxE,eAAO,MAAM,6BAA6B,KAAK,CAAA;AAC/C,eAAO,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1B,kBAAkB,EAAE,MAAM,CAAA;IAC1B,eAAe,EAAE,MAAM,CAAA;IACvB,gBAAgB,EAAE,MAAM,CAAA;IACxB,OAAO,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,CAAA;CACnC;AAED,6DAA6D;AAC7D,eAAO,MAAM,MAAM,EAAE,CAAC,CAAC,MAAM,CAiB3B,CAAA;AAcF;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,cAAc,CA0DxE"}
@@ -0,0 +1,67 @@
1
+ /**
2
+ * The five dimension evaluators. Each is a PURE function of gathered evidence,
3
+ * the resolved config, and an injected "now" timestamp — no filesystem,
4
+ * network, or clock access — so every score is reproducible from its inputs
5
+ * and every conclusion carries an audit link. A dimension without usable
6
+ * evidence returns `no-evidence` with score 0 and never fabricates a number.
7
+ *
8
+ * @module dsh-score/dimensions
9
+ */
10
+ import type { ResolvedConfig } from './config.ts';
11
+ import type { NpmFacts, RepoFacts } from './probe.ts';
12
+ import type { Dimension, DimensionScore } from './result.ts';
13
+ /** Install evidence reserved for dsh-test-drive results (see {@link InstallEvidence}). */
14
+ export interface InstallEvidence {
15
+ /** The drive verdict, when a test-drive record existed for the target. */
16
+ verdict?: 'pass' | 'fail' | 'partial' | 'unknown';
17
+ /** Sanitized detail: the run id and reason, when available. */
18
+ detail?: string;
19
+ /** ISO-8601 timestamp of the test-drive record. */
20
+ observedAt?: string;
21
+ }
22
+ /** Everything the evaluators read; assembled by the scoring pipeline. */
23
+ export interface EvalInputs {
24
+ config: ResolvedConfig;
25
+ /** ISO-8601 audit timestamp for every derived evidence link. */
26
+ now: string;
27
+ target: {
28
+ kind: 'repo' | 'npm';
29
+ spec: string;
30
+ };
31
+ repo?: RepoFacts;
32
+ npm?: NpmFacts;
33
+ testDrive?: InstallEvidence;
34
+ }
35
+ /** Whole days between an ISO timestamp and `now` (negative when in the future). */
36
+ export declare function daysSince(iso: string, now: Date): number;
37
+ /** SPDX identifiers treated as acceptable open-source licenses. */
38
+ export declare const LICENSE_ALLOWLIST: ReadonlySet<string>;
39
+ /** SPDX values that mean "no usable license signal". */
40
+ export declare const LICENSE_MISSING: ReadonlySet<string>;
41
+ /** Suspicious markers inside package.json lifecycle scripts (install-time code execution). */
42
+ export declare const MALICIOUS_SCRIPT_MARKERS: ReadonlyArray<RegExp>;
43
+ /**
44
+ * Scan a parsed package.json for suspicious install-time script markers.
45
+ *
46
+ * @param packageJson - the parsed manifest, or undefined.
47
+ * @returns the matched marker source text (one entry per matched script key).
48
+ */
49
+ export declare function scanMaliciousScripts(packageJson: unknown): string[];
50
+ /** License classification from an SPDX id (or npm license string). */
51
+ export declare function licenseCompliance(spdx: string | undefined): {
52
+ known: boolean;
53
+ acceptable: boolean;
54
+ };
55
+ /** The install-success dimension, consuming reserved test-drive evidence. */
56
+ export declare function evaluateInstall(input: EvalInputs): DimensionScore;
57
+ /** The maintenance dimension: commit recency, issue age, and archived status. */
58
+ export declare function evaluateMaintenance(input: EvalInputs): DimensionScore;
59
+ /** The documentation dimension: multi-language README, CHANGELOG, SECURITY presence. */
60
+ export declare function evaluateDocumentation(input: EvalInputs): DimensionScore;
61
+ /** The security dimension: license compliance, secret leaks, and malicious script markers. */
62
+ export declare function evaluateSecurity(input: EvalInputs): DimensionScore;
63
+ /** The compliance dimension: `dsh.bundle.patch` manifest and `dsh-plugin` topic/keyword. */
64
+ export declare function evaluateCompliance(input: EvalInputs): DimensionScore;
65
+ /** Evaluate all five dimensions for one target. */
66
+ export declare function evaluateAll(input: EvalInputs): Record<Dimension, DimensionScore>;
67
+ //# sourceMappingURL=dimensions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dimensions.d.ts","sourceRoot":"","sources":["../../src/dimensions.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AACjD,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,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G;AAED,6EAA6E;AAC7E,wBAAgB,eAAe,CAAC,KAAK,EAAE,UAAU,GAAG,cAAc,CAkBjE;AAED,iFAAiF;AACjF,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,UAAU,GAAG,cAAc,CAkDrE;AAED,wFAAwF;AACxF,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,UAAU,GAAG,cAAc,CAgCvE;AAED,8FAA8F;AAC9F,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,UAAU,GAAG,cAAc,CAiDlE;AAED,4FAA4F;AAC5F,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,UAAU,GAAG,cAAc,CAgDpE;AAED,mDAAmD;AACnD,wBAAgB,WAAW,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAAC,SAAS,EAAE,cAAc,CAAC,CAQhF"}
@@ -0,0 +1,138 @@
1
+ /**
2
+ * The `score` storage domain: the durable home of score cards and leaderboard
3
+ * records. Opened through `ctx.storageDomain` (a public service), with record
4
+ * schemas validated at the durable boundary; the domain stays open for the
5
+ * plugin's lifetime and closes through the registered effect.
6
+ *
7
+ * @module dsh-score/domain
8
+ */
9
+ import { z } from 'zod';
10
+ /** Domain name (also the backend unit name; UNIT_NAME_RE forbids hyphens). */
11
+ export declare const DOMAIN_NAME = "score";
12
+ /** Domain format version; bump when a record format changes incompatibly. */
13
+ export declare const DOMAIN_VERSION = 1;
14
+ /** Latest-leaderboard pointer value; `''` id means "no leaderboard yet". */
15
+ export declare const LatestLeaderboardSchema: z.ZodObject<{
16
+ leaderboardId: z.ZodString;
17
+ createdAt: z.ZodString;
18
+ }, z.core.$strip>;
19
+ /** Storage-domain spec: one table of score cards, one of leaderboards, plus the latest pointer. */
20
+ export declare const scoreDomainSpec: {
21
+ name: string;
22
+ version: number;
23
+ global: {
24
+ schema: z.ZodObject<{
25
+ leaderboardId: z.ZodString;
26
+ createdAt: z.ZodString;
27
+ }, z.core.$strip>;
28
+ initial: {
29
+ leaderboardId: string;
30
+ createdAt: string;
31
+ };
32
+ };
33
+ tables: {
34
+ scores: import("@deepseek-ai/dsh-storage-domain").DomainTableSpec<string, {
35
+ schema: "dsh-score/v1";
36
+ scoreId: string;
37
+ target: {
38
+ kind: "repo" | "npm";
39
+ spec: string;
40
+ };
41
+ scoredAt: string;
42
+ durationMs: number;
43
+ pluginVersion: string;
44
+ dimensions: {
45
+ install: {
46
+ dimension: "install" | "maintenance" | "documentation" | "security" | "compliance";
47
+ status: "pass" | "warn" | "fail" | "no-evidence";
48
+ score: number;
49
+ weight: number;
50
+ summary: string;
51
+ evidence: {
52
+ source: string;
53
+ detail: string;
54
+ observedAt: string;
55
+ }[];
56
+ };
57
+ maintenance: {
58
+ dimension: "install" | "maintenance" | "documentation" | "security" | "compliance";
59
+ status: "pass" | "warn" | "fail" | "no-evidence";
60
+ score: number;
61
+ weight: number;
62
+ summary: string;
63
+ evidence: {
64
+ source: string;
65
+ detail: string;
66
+ observedAt: string;
67
+ }[];
68
+ };
69
+ documentation: {
70
+ dimension: "install" | "maintenance" | "documentation" | "security" | "compliance";
71
+ status: "pass" | "warn" | "fail" | "no-evidence";
72
+ score: number;
73
+ weight: number;
74
+ summary: string;
75
+ evidence: {
76
+ source: string;
77
+ detail: string;
78
+ observedAt: string;
79
+ }[];
80
+ };
81
+ security: {
82
+ dimension: "install" | "maintenance" | "documentation" | "security" | "compliance";
83
+ status: "pass" | "warn" | "fail" | "no-evidence";
84
+ score: number;
85
+ weight: number;
86
+ summary: string;
87
+ evidence: {
88
+ source: string;
89
+ detail: string;
90
+ observedAt: string;
91
+ }[];
92
+ };
93
+ compliance: {
94
+ dimension: "install" | "maintenance" | "documentation" | "security" | "compliance";
95
+ status: "pass" | "warn" | "fail" | "no-evidence";
96
+ score: number;
97
+ weight: number;
98
+ summary: string;
99
+ evidence: {
100
+ source: string;
101
+ detail: string;
102
+ observedAt: string;
103
+ }[];
104
+ };
105
+ };
106
+ total: number;
107
+ grade: string;
108
+ verdict: string;
109
+ }>;
110
+ leaderboards: import("@deepseek-ai/dsh-storage-domain").DomainTableSpec<string, {
111
+ schema: "dsh-score/v1";
112
+ id: string;
113
+ createdAt: string;
114
+ durationMs: number;
115
+ rows: {
116
+ target: string;
117
+ kind: "repo" | "npm";
118
+ total: number;
119
+ grade: string;
120
+ verdict: string;
121
+ durationMs: number;
122
+ install: "pass" | "warn" | "fail" | "no-evidence";
123
+ maintenance: "pass" | "warn" | "fail" | "no-evidence";
124
+ documentation: "pass" | "warn" | "fail" | "no-evidence";
125
+ security: "pass" | "warn" | "fail" | "no-evidence";
126
+ compliance: "pass" | "warn" | "fail" | "no-evidence";
127
+ }[];
128
+ totals: {
129
+ total: number;
130
+ pass: number;
131
+ warn: number;
132
+ fail: number;
133
+ noEvidence: number;
134
+ };
135
+ }>;
136
+ };
137
+ };
138
+ //# sourceMappingURL=domain.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"domain.d.ts","sourceRoot":"","sources":["../../src/domain.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAIvB,8EAA8E;AAC9E,eAAO,MAAM,WAAW,UAAU,CAAA;AAElC,6EAA6E;AAC7E,eAAO,MAAM,cAAc,IAAI,CAAA;AAE/B,4EAA4E;AAC5E,eAAO,MAAM,uBAAuB;;;iBAGlC,CAAA;AAEF,mGAAmG;AACnG,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAQ1B,CAAA"}
@@ -0,0 +1,50 @@
1
+ /**
2
+ * `dsh-score` — multi-dimensional quality scoring for DeepSeek Harness plugins.
3
+ *
4
+ * Host-only function plugin — no default export (the Loader unwraps
5
+ * `exports.default ?? exports`). It scores one target at a time across five
6
+ * dimensions (install success via reserved dsh-test-drive evidence, maintenance
7
+ * activity, documentation completeness, security scan, and protocol compliance),
8
+ * all from real `gh`/`npm` CLI evidence with audit links and timestamps. Score
9
+ * cards land as structured records (JSON) in the `score` storage domain, render
10
+ * as Markdown, and feed ranking pipelines; batches run as `score-batch`
11
+ * background jobs over `ctx.jobs`.
12
+ *
13
+ * @module dsh-score
14
+ */
15
+ import type { Context } from '@deepseek-ai/cordis';
16
+ import { Config } from './config.ts';
17
+ export declare const name = "dsh-score";
18
+ /**
19
+ * Public services only. `storageDomain` is deliberately OPTIONAL: the shipped
20
+ * `dsh-base` bundle (headless profile) does not mount it, and the plugin must
21
+ * still boot there — score persistence degrades to disabled with a logged
22
+ * reason, tools keep working. Install evidence reads the already-open
23
+ * `test_drive` domain via the same optional service, never a hard dependency.
24
+ */
25
+ export declare const inject: string[];
26
+ export { VERSION } from './version.ts';
27
+ export { Config, resolveConfig } from './config.ts';
28
+ export { RESULT_SCHEMA, DIMENSIONS, computeTotal, hasEvidence, gradeOf, verdictOf, totalsOf, ScoreResultSchema, LeaderboardRecordSchema } from './result.ts';
29
+ export type { Dimension, DimensionStatus, TargetKind, EvidenceLink, DimensionScore, ScoreResult, LeaderboardRow, LeaderboardRecord } from './result.ts';
30
+ export { sanitizeTarget, redactSecrets, scanSecretPatterns, tailText, REDACTED, SECRET_PATTERNS } from './sanitize.ts';
31
+ export { classifyTarget, parseRepoRef, extractRepoFromNpmUrl, parseRepoMeta, parseLatestCommit, parseFileList, parseGithubContent, parseOldestOpenIssue, parseNpmView, parseNpmShim, ProbeDriver } from './probe.ts';
32
+ export type { RepoRef, RepoFacts, NpmFacts, TargetEvidence, ProbeOutcome, ChildRunResult } from './probe.ts';
33
+ export { evaluateAll, evaluateInstall, evaluateMaintenance, evaluateDocumentation, evaluateSecurity, evaluateCompliance, scanMaliciousScripts, licenseCompliance, daysSince, LICENSE_ALLOWLIST, MALICIOUS_SCRIPT_MARKERS } from './dimensions.ts';
34
+ export type { InstallEvidence, EvalInputs } from './dimensions.ts';
35
+ export { ScoreRunner, scoreKey, readTestDriveEvidence, SCORE_KEY_PREFIX } from './score.ts';
36
+ export type { ScoreDeps } from './score.ts';
37
+ export { renderScoreCard, renderLeaderboard, statusMark, formatDuration } from './report.ts';
38
+ export { SCORE_BATCH_KIND, startBatchJob, runBatch, leaderboardSummary, rowOf, progressLine, freshLeaderboardId, LEADERBOARD_ID_PREFIX } from './batch.ts';
39
+ export { parseTargets } from './command.ts';
40
+ export { scoreDomainSpec, DOMAIN_NAME, DOMAIN_VERSION } from './domain.ts';
41
+ /**
42
+ * Mount the plugin: resolve config, open the score domain (lazily), register
43
+ * the tools and the `/score` command as effects, and own the domain handle
44
+ * through an effect disposer (teardown closes it).
45
+ *
46
+ * @param ctx - context carrying tools/commands/subprocess/jobs/storageDomain.
47
+ * @param config - raw loader config; defaults applied through {@link resolveConfig}.
48
+ */
49
+ export declare function apply(ctx: Context, config: Config): void;
50
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAMlD,OAAO,EAAE,MAAM,EAAiB,MAAM,aAAa,CAAA;AAOnD,eAAO,MAAM,IAAI,cAAc,CAAA;AAE/B;;;;;;GAMG;AACH,eAAO,MAAM,MAAM,UAA8C,CAAA;AAEjE,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AACnD,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAA;AAC5J,YAAY,EAAE,SAAS,EAAE,eAAe,EAAE,UAAU,EAAE,YAAY,EAAE,cAAc,EAAE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,wBAAgB,KAAK,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAoCxD"}
@@ -0,0 +1,137 @@
1
+ /**
2
+ * The evidence-gathering layer: runs `gh` and `npm` as managed subprocesses
3
+ * over `ctx.subprocess` and parses their output into structured facts. Every
4
+ * command records an {@link EvidenceLink} (source, command, audit timestamp);
5
+ * a command that fails or returns unparsable output contributes NO fact — the
6
+ * consuming dimension then reports `no-evidence` honestly, never a number.
7
+ *
8
+ * No shell is ever involved (argv-only), so hostile target specs stay argv
9
+ * entries. `gh` reads its own credential store (the provider scrubs ambient
10
+ * env credentials), and every recorded string is sanitized before it leaves
11
+ * this layer.
12
+ *
13
+ * @module dsh-score/probe
14
+ */
15
+ import type { Context } from '@deepseek-ai/cordis';
16
+ import type { ResolvedConfig } from './config.ts';
17
+ import type { EvidenceLink, TargetKind } from './result.ts';
18
+ /** Cap on collected output per probe stream (in-memory tail). */
19
+ export declare const COLLECT_MAX_BYTES: number;
20
+ /** Cap on the complete spill file per stream. */
21
+ export declare const SPILL_MAX_BYTES: number;
22
+ /** Grace between SIGTERM and SIGKILL for a probe process. */
23
+ export declare const PROBE_GRACE_MS = 5000;
24
+ /** Outcome of one spawned probe process. */
25
+ export interface ChildRunResult {
26
+ exitCode: number | null;
27
+ stdout: string;
28
+ stderr: string;
29
+ truncated: boolean;
30
+ durationMs: number;
31
+ timedOut: boolean;
32
+ }
33
+ /** A GitHub repository reference parsed from a target spec. */
34
+ export interface RepoRef {
35
+ owner: string;
36
+ repo: string;
37
+ }
38
+ /** Structured facts one `gh`/`npm` probe may reveal (absent = no evidence). */
39
+ export interface RepoFacts {
40
+ pushedAt?: string;
41
+ openIssues?: number;
42
+ licenseSpdx?: string;
43
+ defaultBranch?: string;
44
+ topics?: string[];
45
+ archived?: boolean;
46
+ lastCommitAt?: string;
47
+ files?: string[];
48
+ packageJson?: unknown;
49
+ cordisPatch?: string;
50
+ readmeText?: string;
51
+ oldestOpenIssueAt?: string;
52
+ }
53
+ /** Structured facts one `npm view` may reveal (absent = no evidence). */
54
+ export interface NpmFacts {
55
+ name?: string;
56
+ version?: string;
57
+ license?: string;
58
+ repositoryUrl?: string;
59
+ keywords?: string[];
60
+ modifiedAt?: string;
61
+ packageJson?: unknown;
62
+ }
63
+ /** Everything gathered about one target, plus the audit links. */
64
+ export interface TargetEvidence {
65
+ target: {
66
+ kind: TargetKind;
67
+ spec: string;
68
+ };
69
+ repo?: RepoFacts;
70
+ npm?: NpmFacts;
71
+ evidence: EvidenceLink[];
72
+ }
73
+ /** A fact plus the audit links that produced it. */
74
+ export interface ProbeOutcome<T> {
75
+ value?: T;
76
+ evidence: EvidenceLink[];
77
+ }
78
+ /** Parse the JS target out of an npm-generated `.cmd`/`.bat` shim (Windows). */
79
+ export declare function parseNpmShim(shimPath: string, shimText: string): string;
80
+ /** Whether a target spec names a git/github source. */
81
+ export declare function isRepoSpec(spec: string): boolean;
82
+ /** Classify a sanitized target spec as a repo or an npm package. */
83
+ export declare function classifyTarget(spec: string): TargetKind;
84
+ /** Extract owner/repo from a target spec; undefined when it does not name a GitHub repo. */
85
+ export declare function parseRepoRef(spec: string): RepoRef | undefined;
86
+ /** Extract owner/repo from an npm `repository.url` (github only). */
87
+ export declare function extractRepoFromNpmUrl(url: string): RepoRef | undefined;
88
+ /** Parse the `gh api repos/<owner>/<repo>` object into repo facts. */
89
+ export declare function parseRepoMeta(json: unknown): RepoFacts;
90
+ /** Parse the newest commit date from `gh api .../commits?per_page=1`. */
91
+ export declare function parseLatestCommit(json: unknown): string | undefined;
92
+ /** Parse the root file-name list from `gh api .../contents`. */
93
+ export declare function parseFileList(json: unknown): string[];
94
+ /** Decode the `content` field of a `gh api .../contents/<file>` response. */
95
+ export declare function parseGithubContent(json: unknown): string | undefined;
96
+ /** Parse the oldest open issue's creation date from `gh api .../issues`. */
97
+ export declare function parseOldestOpenIssue(json: unknown): string | undefined;
98
+ /** Parse the `npm view <pkg> --json` manifest into npm facts. */
99
+ export declare function parseNpmView(json: unknown): NpmFacts;
100
+ /** Driver dependencies for the subprocess probe seam. */
101
+ export interface ProbeDeps {
102
+ ctx: Context;
103
+ config: ResolvedConfig;
104
+ log: (line: string) => void;
105
+ }
106
+ /**
107
+ * Locate and run `gh`/`npm` through the subprocess seam, cache each located
108
+ * argv prefix, and parse responses. `npm` on Windows resolves to a `.cmd` shim
109
+ * that cannot be spawned directly — the shim is parsed into `[node, js]`.
110
+ */
111
+ export declare class ProbeDriver {
112
+ private readonly deps;
113
+ private readonly located;
114
+ constructor(deps: ProbeDeps);
115
+ /** Resolve the spawn argv prefix `[program, ...args]` for one CLI. */
116
+ locate(program: string): Promise<readonly string[]>;
117
+ private resolveLocation;
118
+ /** Run one CLI invocation with collected stdio and a deadline. */
119
+ run(program: string, args: readonly string[], signal?: AbortSignal | undefined): Promise<ChildRunResult>;
120
+ /** Run one `gh api <endpoint>` and parse JSON; records an audit link either way. */
121
+ ghJson(endpoint: string, signal?: AbortSignal | undefined): Promise<ProbeOutcome<unknown>>;
122
+ /** Run one `npm view <pkg> --json`; records an audit link either way. */
123
+ npmJson(pkgSpec: string, signal?: AbortSignal | undefined): Promise<ProbeOutcome<unknown>>;
124
+ /** Probe one GitHub repo: metadata, latest commit, file list, and key file contents. */
125
+ probeRepo(ref: RepoRef, signal?: AbortSignal | undefined): Promise<{
126
+ facts: RepoFacts;
127
+ evidence: EvidenceLink[];
128
+ }>;
129
+ /** Probe one npm package manifest; a github repository URL is also parsed out. */
130
+ probeNpm(spec: string, signal?: AbortSignal | undefined): Promise<{
131
+ facts: NpmFacts;
132
+ evidence: EvidenceLink[];
133
+ }>;
134
+ }
135
+ /** Sanitize one evidence detail string for the audit link (redacts stray credentials). */
136
+ export declare function sanitizeEvidenceDetail(detail: string): string;
137
+ //# sourceMappingURL=probe.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"probe.d.ts","sourceRoot":"","sources":["../../src/probe.ts"],"names":[],"mappings":"AAAA;;;;;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G,wFAAwF;IAClF,SAAS,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,SAAS,GAAG,OAAO,CAAC;QAAE,KAAK,EAAE,SAAS,CAAC;QAAC,QAAQ,EAAE,YAAY,EAAE,CAAA;KAAE,CAAC;IAgDxH,kFAAkF;IAC5E,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,SAAS,GAAG,OAAO,CAAC;QAAE,KAAK,EAAE,QAAQ,CAAC;QAAC,QAAQ,EAAE,YAAY,EAAE,CAAA;KAAE,CAAC;CAIvH;AAED,0FAA0F;AAC1F,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAE7D"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Pure Markdown renderers for score cards and leaderboards. These are the
3
+ * human-readable half of the report pair (JSON is the canonical record in the
4
+ * storage domain); the renderers are pure functions of their inputs so they
5
+ * stay replay-safe and trivially testable.
6
+ *
7
+ * @module dsh-score/report
8
+ */
9
+ import type { DimensionStatus, LeaderboardRecord, ScoreResult } from './result.ts';
10
+ /** Emoji/symbol mark for a dimension status. */
11
+ export declare function statusMark(status: DimensionStatus): string;
12
+ /** Human-duration rendering for one number of milliseconds. */
13
+ export declare function formatDuration(ms: number): string;
14
+ /** Render one score card as a Markdown risk card. */
15
+ export declare function renderScoreCard(result: ScoreResult): string;
16
+ /** Render one leaderboard as a Markdown report. */
17
+ export declare function renderLeaderboard(record: LeaderboardRecord): string;
18
+ //# sourceMappingURL=report.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"report.d.ts","sourceRoot":"","sources":["../../src/report.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAElF,gDAAgD;AAChD,wBAAgB,UAAU,CAAC,MAAM,EAAE,eAAe,GAAG,MAAM,CAO1D;AAED,+DAA+D;AAC/D,wBAAgB,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAGjD;AAWD,qDAAqD;AACrD,wBAAgB,eAAe,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,CAwB3D;AAED,mDAAmD;AACnD,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,iBAAiB,GAAG,MAAM,CAsBnE"}