dsh-triage 0.0.0-stage → 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.
- package/LICENSE +21 -0
- package/README.md +52 -2
- package/client.js +293 -0
- package/cordis.patch.yml +23 -0
- package/dist/audit-data.d.ts +94 -0
- package/dist/audit-data.d.ts.map +1 -0
- package/dist/audit-data.js +246 -0
- package/dist/audit-data.js.map +1 -0
- package/dist/badge.d.ts +71 -0
- package/dist/badge.d.ts.map +1 -0
- package/dist/badge.js +101 -0
- package/dist/badge.js.map +1 -0
- package/dist/cli.d.ts +15 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +1119 -0
- package/dist/cli.js.map +1 -0
- package/dist/fit.d.ts +93 -0
- package/dist/fit.d.ts.map +1 -0
- package/dist/fit.js +182 -0
- package/dist/fit.js.map +1 -0
- package/dist/host-audit-route.d.ts +52 -0
- package/dist/host-audit-route.d.ts.map +1 -0
- package/dist/host-audit-route.js +78 -0
- package/dist/host-audit-route.js.map +1 -0
- package/dist/host-tool.d.ts +116 -0
- package/dist/host-tool.d.ts.map +1 -0
- package/dist/host-tool.js +178 -0
- package/dist/host-tool.js.map +1 -0
- package/dist/host.d.ts +95 -0
- package/dist/host.d.ts.map +1 -0
- package/dist/host.js +187 -0
- package/dist/host.js.map +1 -0
- package/dist/index-source.d.ts +109 -0
- package/dist/index-source.d.ts.map +1 -0
- package/dist/index-source.js +136 -0
- package/dist/index-source.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +15 -0
- package/dist/index.js.map +1 -0
- package/dist/load.d.ts +112 -0
- package/dist/load.d.ts.map +1 -0
- package/dist/load.js +420 -0
- package/dist/load.js.map +1 -0
- package/dist/probe-run.d.ts +76 -0
- package/dist/probe-run.d.ts.map +1 -0
- package/dist/probe-run.js +259 -0
- package/dist/probe-run.js.map +1 -0
- package/dist/serve.d.ts +91 -0
- package/dist/serve.d.ts.map +1 -0
- package/dist/serve.js +432 -0
- package/dist/serve.js.map +1 -0
- package/package.json +67 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 DSH-Addition contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,53 @@
|
|
|
1
|
-
#
|
|
1
|
+
# dsh-triage
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The judgment layer for DeepSeek Harness plugins — **find out why a plugin silently disappeared, and whether a candidate will survive your environment.**
|
|
4
|
+
|
|
5
|
+
DSH 0.2.x already tells you whether a plugin *installs*. It does not tell you whether it will *work* with your dsh version, your OS, and the other 12 plugins you already have.
|
|
6
|
+
|
|
7
|
+
## Use
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
# attribute the damage: which row was denied, and what to run next
|
|
11
|
+
dsh-triage why
|
|
12
|
+
|
|
13
|
+
# judge a candidate before installing
|
|
14
|
+
dsh-triage check dsh-cost-meter
|
|
15
|
+
dsh-triage check dsh-web-search-pro@1.4.2 --json
|
|
16
|
+
|
|
17
|
+
# capability ledger: who owns which loader entry / namespace
|
|
18
|
+
dsh-triage audit
|
|
19
|
+
|
|
20
|
+
# isolated probe plan (dry-run; execution lands in M3)
|
|
21
|
+
dsh-triage probe dsh-cost-meter
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Exit codes: `0` ok · `1` findings (only with `--strict`) · `2` usage · `3` unavailable.
|
|
25
|
+
|
|
26
|
+
## Flags
|
|
27
|
+
|
|
28
|
+
| Flag | Meaning |
|
|
29
|
+
|---|---|
|
|
30
|
+
| `--json` | machine-readable output |
|
|
31
|
+
| `--all` | include non-blocking findings |
|
|
32
|
+
| `--strict` | exit 1 when a conclusion is not `go` |
|
|
33
|
+
| `--profile <name>` | profile name (default `web`) |
|
|
34
|
+
| `--dsh-home <path>` | override `$DSH_HOME` |
|
|
35
|
+
| `--locale en\|zh` | output language (default `zh`, or `$DSH_TRIAGE_LOCALE`) |
|
|
36
|
+
| `--stamp <iso>` | fixed timestamp for reproducible output |
|
|
37
|
+
| `--execute` | (probe) really run the plan — not implemented before M3 |
|
|
38
|
+
|
|
39
|
+
## What it will never do
|
|
40
|
+
|
|
41
|
+
- Provide security assurances (use `dsh-vet` / dsh.so's security tier).
|
|
42
|
+
- Replace the official plugin manager, or re-implement snapshots/rollback.
|
|
43
|
+
- Invent a score. Every conclusion is `go` / `risky` / `blocked` / `unknown`, with evidence tiers (`declared`, `scanned`, `measured-registry`, `measured-local`, `inferred`).
|
|
44
|
+
|
|
45
|
+
## DSH profile bundle
|
|
46
|
+
|
|
47
|
+
```sh
|
|
48
|
+
dsh plugin --profile web add dsh-triage
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
The bundle mounts a single namespaced row (`compat-verdict`). The Web panel and the `compat_verdict` agent tool land in M4; until then the row registers nothing, on purpose.
|
|
52
|
+
|
|
53
|
+
MIT. Data attribution: dsh.so registry facts are CC BY 4.0.
|
package/client.js
ADDED
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* dsh-triage · browser half (DSH Settings → Plugins tab).
|
|
3
|
+
*
|
|
4
|
+
* WHY THIS FILE IS HAND-WRITTEN AND LOADED AS A CLASSIC SCRIPT: the Host serves it at
|
|
5
|
+
* `/plugins/<pkg>/client.js` and the browser executes it as a plain script that must call
|
|
6
|
+
* `window.__ModuleLoader__.load({ id, factory })` itself (documented contract C1). A bundler
|
|
7
|
+
* would only add a build step that can drift from the contract, so the file is plain JS that
|
|
8
|
+
* also happens to be runnable under `node:vm` in a unit test (see tests/unit/client-tab.test.ts).
|
|
9
|
+
*
|
|
10
|
+
* CONTRACT (verified against DSH 0.2.1-rc.4, see docs/specs/M4-surface.md §3.1):
|
|
11
|
+
* C1 loader wrapper + factory(require)
|
|
12
|
+
* C2 the plugins slot is `settings.plugins.tab`; register via ctx.slots.inject(...)
|
|
13
|
+
* C3 a tab gets its data from the `inject` callback, never from importing host modules
|
|
14
|
+
* C4 services: slots, locale, remote, remote.pluginInventory, modules
|
|
15
|
+
* C5 copy goes through ctx.locale.register + bind, side effects through ctx.effect
|
|
16
|
+
* C6 a READ-ONLY tab is an accepted shape upstream, so we do not compete for a slot
|
|
17
|
+
*
|
|
18
|
+
* WHAT THIS TAB DELIBERATELY DOES NOT DO: it renders no verdicts. Judgement ("go / blocked /
|
|
19
|
+
* unknown") is computed by the CLI and by the local `serve` panel from recorded evidence; a
|
|
20
|
+
* settings tab cannot read `data/results` and must not invent a conclusion from what little the
|
|
21
|
+
* browser can see (铁律 1: no evidence → no claim). So the tab shows (a) how to get the answer,
|
|
22
|
+
* and (b) one honest fact it *can* verify: how many rows the Host reports (row count only,
|
|
23
|
+
* labelled as a fact, never as a verdict).
|
|
24
|
+
*
|
|
25
|
+
* DEGRADATION IS THE DEFAULT: every registration is wrapped, and the tab is only registered
|
|
26
|
+
* when the whole contract is present (slots.inject, slots.register, locale.register, a renderer).
|
|
27
|
+
* A missing piece means ZERO registrations — no half-rendered tab, no error page.
|
|
28
|
+
*/
|
|
29
|
+
window.__ModuleLoader__.load({
|
|
30
|
+
id: 'dsh-triage',
|
|
31
|
+
factory: (require) => {
|
|
32
|
+
/** Owned dictionary + registration namespace. Row id is also the settings namespace (C3/S3). */
|
|
33
|
+
const NS = 'compat-triage'
|
|
34
|
+
/** Services this tab needs; the loader only exposes these to `require`/ctx (C4). */
|
|
35
|
+
const inject = ['slots', 'locale', 'modules']
|
|
36
|
+
|
|
37
|
+
const zh = {
|
|
38
|
+
tab: '分诊台',
|
|
39
|
+
title: '分诊台 · 装之前判断,坏之后定位',
|
|
40
|
+
hint: '结论由命令行的同一个引擎给出(同一份证据、同一条 messageId)。这里只显示宿主事实与入口。',
|
|
41
|
+
command: 'dsh-triage audit',
|
|
42
|
+
commandHint: '在本机终端运行;加 --json 可拿到逐行结论。',
|
|
43
|
+
rows: '宿主报告 {count} 行插件',
|
|
44
|
+
rowsUnknown: '没拿到宿主插件清单(只读路由不可用)',
|
|
45
|
+
rowsFact: '行数是事实,不是结论。',
|
|
46
|
+
verdicts: 'CLI 同一引擎的结论:{go} go · {blocked} blocked · {unknown} unknown',
|
|
47
|
+
verdictsUnknown: '没拿到结论(只读路由不回答)',
|
|
48
|
+
source: '数据来自宿主只读路由 /compat-triage/audit,与 dsh-triage audit --json 同源。',
|
|
49
|
+
reload: '刷新',
|
|
50
|
+
failed: '读取失败',
|
|
51
|
+
panel: '也可以开本地面板:dsh-triage serve',
|
|
52
|
+
}
|
|
53
|
+
const en = {
|
|
54
|
+
tab: 'Triage',
|
|
55
|
+
title: 'Triage · judge before install, attribute after breakage',
|
|
56
|
+
hint: 'Verdicts come from the same engine as the CLI (same evidence, same messageId). This tab shows host facts and entry points only.',
|
|
57
|
+
command: 'dsh-triage audit',
|
|
58
|
+
commandHint: 'Run it in a local terminal; add --json for per-row verdicts.',
|
|
59
|
+
rows: 'The host reports {count} plugin rows',
|
|
60
|
+
rowsUnknown: 'Host plugin inventory unavailable (read-only route not answering)',
|
|
61
|
+
rowsFact: 'A row count is a fact, not a verdict.',
|
|
62
|
+
verdicts: 'Conclusions from the CLI engine: {go} go · {blocked} blocked · {unknown} unknown',
|
|
63
|
+
verdictsUnknown: 'No conclusions (the read-only route did not answer)',
|
|
64
|
+
source: 'Read from the host route /compat-triage/audit, the same payload as dsh-triage audit --json.',
|
|
65
|
+
reload: 'Refresh',
|
|
66
|
+
failed: 'Read failed',
|
|
67
|
+
panel: 'Local panel: dsh-triage serve',
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Build the tab component. Returns null when the renderer is unavailable — a component we
|
|
72
|
+
* cannot render must not be registered at all.
|
|
73
|
+
*/
|
|
74
|
+
function makeTab(react, jsxRuntime) {
|
|
75
|
+
if (react === null || jsxRuntime === null) return null
|
|
76
|
+
const { useState, useEffect, useCallback } = react
|
|
77
|
+
const jsx = jsxRuntime.jsx
|
|
78
|
+
const jsxs = jsxRuntime.jsxs
|
|
79
|
+
return function CompatTriageTab(props) {
|
|
80
|
+
const copy = props.copy
|
|
81
|
+
const [state, setState] = useState({ status: 'idle', count: null, verdicts: null, detail: null })
|
|
82
|
+
const load = useCallback(() => {
|
|
83
|
+
let cancelled = false
|
|
84
|
+
setState((previous) => ({ ...previous, status: 'loading' }))
|
|
85
|
+
Promise.resolve()
|
|
86
|
+
.then(() => props.load())
|
|
87
|
+
.then((result) => {
|
|
88
|
+
if (cancelled) return
|
|
89
|
+
setState({
|
|
90
|
+
status: result.ok ? 'ready' : 'failed',
|
|
91
|
+
count: result.count ?? null,
|
|
92
|
+
verdicts: result.verdicts ?? null,
|
|
93
|
+
detail: result.detail ?? null,
|
|
94
|
+
})
|
|
95
|
+
})
|
|
96
|
+
.catch((error) => {
|
|
97
|
+
if (cancelled) return
|
|
98
|
+
setState({ status: 'failed', count: null, verdicts: null, detail: String((error && error.message) || error) })
|
|
99
|
+
})
|
|
100
|
+
return () => {
|
|
101
|
+
cancelled = true
|
|
102
|
+
}
|
|
103
|
+
}, [props])
|
|
104
|
+
useEffect(() => load(), [load])
|
|
105
|
+
const rowsText =
|
|
106
|
+
state.count === null
|
|
107
|
+
? copy.rowsUnknown
|
|
108
|
+
: copy.rows.replace('{count}', String(state.count))
|
|
109
|
+
const verdictsText =
|
|
110
|
+
state.verdicts === null
|
|
111
|
+
? copy.verdictsUnknown
|
|
112
|
+
: copy.verdicts
|
|
113
|
+
.replace('{go}', String(state.verdicts.go))
|
|
114
|
+
.replace('{blocked}', String(state.verdicts.blocked))
|
|
115
|
+
.replace('{unknown}', String(state.verdicts.unknown))
|
|
116
|
+
return jsxs('div', {
|
|
117
|
+
children: [
|
|
118
|
+
jsx('h3', { children: copy.title }),
|
|
119
|
+
jsx('p', { children: copy.hint }),
|
|
120
|
+
jsx('p', { children: rowsText }),
|
|
121
|
+
jsx('p', { children: verdictsText }),
|
|
122
|
+
jsx('p', { children: copy.source }),
|
|
123
|
+
jsx('p', { children: copy.rowsFact }),
|
|
124
|
+
jsx('p', {
|
|
125
|
+
children: [
|
|
126
|
+
jsx('code', { children: copy.command }),
|
|
127
|
+
jsx('span', { children: ` — ${copy.commandHint}` }),
|
|
128
|
+
],
|
|
129
|
+
}),
|
|
130
|
+
jsx('p', { children: copy.panel }),
|
|
131
|
+
state.status === 'failed' && state.detail !== null
|
|
132
|
+
? jsx('p', { children: `${copy.failed}: ${state.detail}` })
|
|
133
|
+
: null,
|
|
134
|
+
jsx('button', { type: 'button', onClick: load, children: copy.reload }),
|
|
135
|
+
],
|
|
136
|
+
})
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Publish a tiny, read-only marker for diagnostics (R31).
|
|
142
|
+
*
|
|
143
|
+
* WHY: "the Host serves the bundle" and "the tab actually registered in the page" are two
|
|
144
|
+
* different claims. Without a marker the second one is unobservable from outside, and the
|
|
145
|
+
* honest answer would stay "served, unknown whether mounted". The marker carries no user data
|
|
146
|
+
* and no behaviour: `{registered, slot, id}` (plus a reason when registration was refused).
|
|
147
|
+
*/
|
|
148
|
+
function publishMarker(marker) {
|
|
149
|
+
try {
|
|
150
|
+
if (typeof window === 'object' && window !== null) window.__dshTriage = marker
|
|
151
|
+
} catch {
|
|
152
|
+
// A frozen/blocked window is not our problem: the tab itself was already decided.
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Register the tab. Returns `true` when the tab was handed to the slot, `false` when the
|
|
158
|
+
* contract was not satisfied — never a thrown error, and never a half registration.
|
|
159
|
+
*
|
|
160
|
+
* NOTE ON THE RETURN VALUE: `ctx.slots.inject(slot, cb)` is LAZY — the Host calls `cb` when it
|
|
161
|
+
* mounts the page. So `true` means "this Host accepted our registration request", which is the
|
|
162
|
+
* most a plugin can observe at apply time.
|
|
163
|
+
*/
|
|
164
|
+
function register(ctx, require) {
|
|
165
|
+
if (ctx === null || typeof ctx !== 'object') return false
|
|
166
|
+
const slots = ctx.slots
|
|
167
|
+
const locale = ctx.locale
|
|
168
|
+
if (slots === null || typeof slots !== 'object') return false
|
|
169
|
+
if (typeof slots.inject !== 'function' || typeof slots.register !== 'function') return false
|
|
170
|
+
if (locale === null || typeof locale !== 'object' || typeof locale.register !== 'function') return false
|
|
171
|
+
let react = null
|
|
172
|
+
let jsxRuntime = null
|
|
173
|
+
try {
|
|
174
|
+
react = require('react')
|
|
175
|
+
jsxRuntime = require('react/jsx-runtime')
|
|
176
|
+
} catch {
|
|
177
|
+
// The module registry of this Host does not expose React: nothing to render, so nothing
|
|
178
|
+
// is registered. This is the shape a future rc that renames the module would produce.
|
|
179
|
+
return false
|
|
180
|
+
}
|
|
181
|
+
const Tab = makeTab(react, jsxRuntime)
|
|
182
|
+
if (Tab === null) return false
|
|
183
|
+
const effect = typeof ctx.effect === 'function' ? ctx.effect : null
|
|
184
|
+
const registerDictionaries = () => locale.register(NS, { zh, en })
|
|
185
|
+
if (effect !== null) effect(registerDictionaries, 'compat-triage:dictionaries')
|
|
186
|
+
else registerDictionaries()
|
|
187
|
+
const t = locale.bind(NS)
|
|
188
|
+
const injected = () => ({
|
|
189
|
+
copy: {
|
|
190
|
+
tab: t('tab'),
|
|
191
|
+
title: t('title'),
|
|
192
|
+
hint: t('hint'),
|
|
193
|
+
command: t('command'),
|
|
194
|
+
commandHint: t('commandHint'),
|
|
195
|
+
rows: t('rows'),
|
|
196
|
+
rowsUnknown: t('rowsUnknown'),
|
|
197
|
+
rowsFact: t('rowsFact'),
|
|
198
|
+
verdicts: t('verdicts'),
|
|
199
|
+
verdictsUnknown: t('verdictsUnknown'),
|
|
200
|
+
source: t('source'),
|
|
201
|
+
reload: t('reload'),
|
|
202
|
+
failed: t('failed'),
|
|
203
|
+
panel: t('panel'),
|
|
204
|
+
},
|
|
205
|
+
/*
|
|
206
|
+
* FACTS FROM THE HOST, NOT JUDGEMENTS MADE HERE (铁律 1). Since R33 the tab reads the Host's
|
|
207
|
+
* read-only route, which answers with the exact payload `dsh-triage audit --json` prints —
|
|
208
|
+
* built by the same `loadAuditData()`/`auditJsonPayload()` the CLI uses. The tab only counts
|
|
209
|
+
* what the payload says; it never decides a conclusion and never guesses a missing field.
|
|
210
|
+
*/
|
|
211
|
+
load: async () => {
|
|
212
|
+
/** Publish what the tab just showed, so a real page can be asked for it (R33 same-source). */
|
|
213
|
+
const publishData = (result) => {
|
|
214
|
+
try {
|
|
215
|
+
if (typeof window === 'object' && window !== null) {
|
|
216
|
+
window.__dshTriage = { ...(window.__dshTriage || {}), data: { ok: result.ok, rows: result.count, verdicts: result.verdicts, detail: result.detail ?? null } }
|
|
217
|
+
}
|
|
218
|
+
} catch {
|
|
219
|
+
// A frozen window only costs the diagnostic marker, never the tab.
|
|
220
|
+
}
|
|
221
|
+
return result
|
|
222
|
+
}
|
|
223
|
+
let response
|
|
224
|
+
try {
|
|
225
|
+
response = await fetch('/compat-triage/audit', {
|
|
226
|
+
credentials: 'include',
|
|
227
|
+
headers: { accept: 'application/json' },
|
|
228
|
+
})
|
|
229
|
+
} catch (error) {
|
|
230
|
+
// A dead route is a fact to report, not an exception to render: `load` never throws.
|
|
231
|
+
return publishData({ ok: false, count: null, verdicts: null, detail: String((error && error.message) || error) })
|
|
232
|
+
}
|
|
233
|
+
if (!response.ok) {
|
|
234
|
+
let detail = `HTTP ${response.status}`
|
|
235
|
+
try {
|
|
236
|
+
const body = await response.json()
|
|
237
|
+
if (body && typeof body.error === 'string') detail = `${response.status}: ${body.error}`
|
|
238
|
+
} catch {
|
|
239
|
+
// A non-JSON error body is still an error; the status is the fact we have.
|
|
240
|
+
}
|
|
241
|
+
return publishData({ ok: false, count: null, verdicts: null, detail })
|
|
242
|
+
}
|
|
243
|
+
const payload = await response.json()
|
|
244
|
+
const rows = Array.isArray(payload?.rows) ? payload.rows.length : null
|
|
245
|
+
const verdicts = Array.isArray(payload?.row_verdicts) ? payload.row_verdicts : null
|
|
246
|
+
const tally = verdicts === null ? null : { go: 0, blocked: 0, unknown: 0 }
|
|
247
|
+
if (verdicts !== null) {
|
|
248
|
+
for (const verdict of verdicts) {
|
|
249
|
+
const conclusion = verdict && verdict.conclusion
|
|
250
|
+
if (conclusion === 'go') tally.go += 1
|
|
251
|
+
else if (conclusion === 'blocked') tally.blocked += 1
|
|
252
|
+
else tally.unknown += 1
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
return publishData({ ok: true, count: rows, verdicts: tally, detail: null })
|
|
256
|
+
},
|
|
257
|
+
})
|
|
258
|
+
slots.inject('settings.plugins.tab', () =>
|
|
259
|
+
slots.register(
|
|
260
|
+
{
|
|
261
|
+
name: 'settings.plugins.tab',
|
|
262
|
+
id: NS,
|
|
263
|
+
order: 90,
|
|
264
|
+
label: () => t('tab'),
|
|
265
|
+
locale: NS,
|
|
266
|
+
inject: injected,
|
|
267
|
+
},
|
|
268
|
+
Tab,
|
|
269
|
+
),
|
|
270
|
+
)
|
|
271
|
+
return true
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
function apply(ctx) {
|
|
275
|
+
try {
|
|
276
|
+
const registered = register(ctx, require)
|
|
277
|
+
publishMarker(
|
|
278
|
+
registered
|
|
279
|
+
? { registered: true, slot: 'settings.plugins.tab', id: NS }
|
|
280
|
+
: { registered: false, reason: 'contract-missing', id: NS },
|
|
281
|
+
)
|
|
282
|
+
return registered
|
|
283
|
+
} catch (error) {
|
|
284
|
+
publishMarker({ registered: false, reason: 'contract-mismatch', id: NS })
|
|
285
|
+
// Never let a tab break the settings page: an unexpected contract shape means the user
|
|
286
|
+
// simply does not see triage in DSH (the CLI is still there).
|
|
287
|
+
return false
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
return { NS, inject, apply, register }
|
|
292
|
+
},
|
|
293
|
+
})
|
package/cordis.patch.yml
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# dsh-triage profile patch layer.
|
|
2
|
+
#
|
|
3
|
+
# Rules (enforced by scripts/gate_namespace.mjs):
|
|
4
|
+
# - every row id MUST be prefixed `compat-` (never reuse an upstream row id:
|
|
5
|
+
# `plugin-manager`, `tools`, `session`, `llm`, `web`, `permission`, `plugin-market`);
|
|
6
|
+
# - the module specifier must resolve from this package only;
|
|
7
|
+
# - no `config` keys that shadow upstream services;
|
|
8
|
+
# - every row MUST be added through `insert:` — a bare `- id: …` is a *patch of an
|
|
9
|
+
# existing entry*, and upstream skips unknown patch targets with nothing but a stderr
|
|
10
|
+
# warning (measured in R14). Shipping that shape would make this bundle mount nothing
|
|
11
|
+
# while looking installed — the exact failure class this project attributes.
|
|
12
|
+
- insert:
|
|
13
|
+
- id: compat-verdict
|
|
14
|
+
# The row name MUST be the bare package name, not a subpath (`dsh-triage/host`).
|
|
15
|
+
# Measured in R31 against a real Host: `dsh-client-modules` only maps a loader entry to a
|
|
16
|
+
# client bundle when `exactPackageSpecifier(entry.options.name)` is a bare package
|
|
17
|
+
# specifier, so a subpath silently drops the browser half — the Host serves no
|
|
18
|
+
# `/plugins/dsh-triage/...` asset and the settings tab never appears. `dist/index.js`
|
|
19
|
+
# therefore re-exports the host plugin, which keeps the programmatic barrel working.
|
|
20
|
+
name: dsh-triage
|
|
21
|
+
config:
|
|
22
|
+
# Reserved for M4: which localized catalogue the Web panel renders.
|
|
23
|
+
locale: auto
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `audit` as data, not as a command (T-406).
|
|
3
|
+
*
|
|
4
|
+
* WHY THIS FILE EXISTS: `serve` needs the same conclusions the CLI prints, and the only
|
|
5
|
+
* acceptable way to get them is to reuse the engine that produced them. A panel that
|
|
6
|
+
* re-derived verdicts would be a second engine, and two engines drift.
|
|
7
|
+
*
|
|
8
|
+
* CONTRACT (unchanged by the extraction): the JSON payload this module builds is byte-for-
|
|
9
|
+
* byte the payload `dsh-triage audit --json` printed before the refactor. The rename was
|
|
10
|
+
* verified by hashing `audit --json` before and after on two profiles (see
|
|
11
|
+
* `audit/AUDIT_2026-10-28_R19.md`); nothing here may grow a new conclusion or a new field
|
|
12
|
+
* without a spec change.
|
|
13
|
+
*/
|
|
14
|
+
import { findEntryIdCollisions, type DuplicateCopy, type EntryClaim, type EnvFingerprint, type InventorySnapshot, type PresetDeclaration, type Verdict } from '@dsh-triage/core';
|
|
15
|
+
import { type LocalArtifact } from '@dsh-triage/signals';
|
|
16
|
+
import { resolveRows } from './load.js';
|
|
17
|
+
/** The declared/runtime diff, kept as three separate lists so a reader never has to infer. */
|
|
18
|
+
export interface AuditDiff {
|
|
19
|
+
readonly missing: readonly {
|
|
20
|
+
entryId: string;
|
|
21
|
+
module: string | null;
|
|
22
|
+
}[];
|
|
23
|
+
readonly undeclared: readonly InventorySnapshot['entries'][number][];
|
|
24
|
+
readonly ambiguous: readonly {
|
|
25
|
+
readonly entryId: string;
|
|
26
|
+
readonly candidates: readonly string[];
|
|
27
|
+
}[];
|
|
28
|
+
}
|
|
29
|
+
export interface AuditData {
|
|
30
|
+
readonly env: EnvFingerprint;
|
|
31
|
+
readonly claims: readonly EntryClaim[];
|
|
32
|
+
readonly grouped: ReadonlyMap<string, readonly EntryClaim[]>;
|
|
33
|
+
readonly collisions: ReturnType<typeof findEntryIdCollisions>;
|
|
34
|
+
readonly artifacts: readonly LocalArtifact[];
|
|
35
|
+
readonly duplicates: readonly DuplicateCopy[];
|
|
36
|
+
readonly duplicateFindings: readonly DuplicateCopy[];
|
|
37
|
+
readonly rows: Awaited<ReturnType<typeof resolveRows>>;
|
|
38
|
+
readonly rowVerdicts: readonly Verdict[];
|
|
39
|
+
readonly presetDeclarations: readonly PresetDeclaration[];
|
|
40
|
+
readonly snapshot: InventorySnapshot | null;
|
|
41
|
+
readonly inventoryVerdicts: readonly Verdict[];
|
|
42
|
+
readonly diff: AuditDiff;
|
|
43
|
+
readonly declared: readonly {
|
|
44
|
+
entryId: string;
|
|
45
|
+
module: string | null;
|
|
46
|
+
}[];
|
|
47
|
+
readonly errors: readonly string[];
|
|
48
|
+
}
|
|
49
|
+
export interface AuditLoadInput {
|
|
50
|
+
readonly env: EnvFingerprint;
|
|
51
|
+
readonly dshHome: string;
|
|
52
|
+
/** Fixed ISO timestamp; never `Date.now()` inside this module. */
|
|
53
|
+
readonly stamp: string;
|
|
54
|
+
/** `audit --snapshot <file>`: judge runtime phases from a `pluginInventory/list` export. */
|
|
55
|
+
readonly snapshotPath: string | null;
|
|
56
|
+
readonly noRedact: boolean;
|
|
57
|
+
}
|
|
58
|
+
export type AuditLoad = {
|
|
59
|
+
readonly ok: true;
|
|
60
|
+
readonly data: AuditData;
|
|
61
|
+
} | {
|
|
62
|
+
readonly ok: false;
|
|
63
|
+
readonly message: string;
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* Everything `audit` reads, in one pass.
|
|
67
|
+
*
|
|
68
|
+
* Failure is data (`ok: false`) rather than an exception: the CLI turns it into exit 3, and
|
|
69
|
+
* the panel turns it into a 409 with the same sentence — neither may print a half-read ledger.
|
|
70
|
+
*/
|
|
71
|
+
export declare function loadAuditData(input: AuditLoadInput): Promise<AuditLoad>;
|
|
72
|
+
/** Redaction roots: the two homes a profile path can start with. */
|
|
73
|
+
export declare function auditRedactRoots(dshHome: string): readonly string[];
|
|
74
|
+
export declare function redactedEnv(env: EnvFingerprint, options: {
|
|
75
|
+
noRedact: boolean;
|
|
76
|
+
roots: readonly string[];
|
|
77
|
+
}): EnvFingerprint;
|
|
78
|
+
export declare function redactedVerdicts(verdicts: readonly Verdict[], options: {
|
|
79
|
+
noRedact: boolean;
|
|
80
|
+
roots: readonly string[];
|
|
81
|
+
}): readonly Verdict[];
|
|
82
|
+
/**
|
|
83
|
+
* The `audit --json` payload.
|
|
84
|
+
*
|
|
85
|
+
* Every field here existed before T-406; the panel renders this object verbatim, which is
|
|
86
|
+
* what "same engine as the CLI" means in practice.
|
|
87
|
+
*/
|
|
88
|
+
export declare function auditJsonPayload(data: AuditData, options: {
|
|
89
|
+
noRedact: boolean;
|
|
90
|
+
roots: readonly string[];
|
|
91
|
+
}): Record<string, unknown>;
|
|
92
|
+
/** `audit`'s exit code: findings in collisions, duplicate copies, or any non-go verdict. */
|
|
93
|
+
export declare function auditExitOutcome(data: AuditData): 'ok' | 'findings';
|
|
94
|
+
//# sourceMappingURL=audit-data.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"audit-data.d.ts","sourceRoot":"","sources":["../src/audit-data.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH,OAAO,EAIL,qBAAqB,EAUrB,KAAK,aAAa,EAClB,KAAK,UAAU,EACf,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACtB,KAAK,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