dsh-better-display 0.3.8 → 0.3.9
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 +11 -0
- package/DESIGN.md +43 -3
- package/README.en.md +9 -1
- package/README.md +9 -1
- package/docs/dependency-update-policy.md +9 -0
- package/docs/extension-points.md +172 -0
- package/docs/official-rendering-bridge.md +48 -19
- package/docs/openapi.yaml +147 -0
- package/docs/runbooks/blank-reader.md +39 -0
- package/lib/client.js +1417 -490
- package/lib/client.js.map +1 -1
- package/lib/dsh-better-display.js +378 -144
- package/lib/types/client/AssistantNode.d.ts +20 -0
- package/lib/types/client/AssistantNode.d.ts.map +1 -0
- package/lib/types/client/AssistantNode.js +46 -0
- package/lib/types/client/AssistantNode.js.map +1 -0
- package/lib/types/client/Blocks.d.ts.map +1 -1
- package/lib/types/client/Blocks.js +33 -10
- package/lib/types/client/Blocks.js.map +1 -1
- package/lib/types/client/ChoreographedFlow.d.ts.map +1 -1
- package/lib/types/client/ChoreographedFlow.js +2 -0
- package/lib/types/client/ChoreographedFlow.js.map +1 -1
- package/lib/types/client/ClosedProcessSummary.d.ts.map +1 -1
- package/lib/types/client/ClosedProcessSummary.js +3 -1
- package/lib/types/client/ClosedProcessSummary.js.map +1 -1
- package/lib/types/client/McpAppFrame.d.ts.map +1 -1
- package/lib/types/client/McpAppFrame.js +5 -11
- package/lib/types/client/McpAppFrame.js.map +1 -1
- package/lib/types/client/OfficialContent.d.ts +17 -3
- package/lib/types/client/OfficialContent.d.ts.map +1 -1
- package/lib/types/client/OfficialContent.js +33 -7
- package/lib/types/client/OfficialContent.js.map +1 -1
- package/lib/types/client/Reader.d.ts.map +1 -1
- package/lib/types/client/Reader.js +43 -71
- package/lib/types/client/Reader.js.map +1 -1
- package/lib/types/client/SettingsSection.d.ts.map +1 -1
- package/lib/types/client/SettingsSection.js +0 -5
- package/lib/types/client/SettingsSection.js.map +1 -1
- package/lib/types/client/StickyLane.d.ts +12 -0
- package/lib/types/client/StickyLane.d.ts.map +1 -1
- package/lib/types/client/StickyLane.js +78 -2
- package/lib/types/client/StickyLane.js.map +1 -1
- package/lib/types/client/ToolActivity.js.map +1 -1
- package/lib/types/client/index.d.ts +3 -1
- package/lib/types/client/index.d.ts.map +1 -1
- package/lib/types/client/index.js +6 -0
- package/lib/types/client/index.js.map +1 -1
- package/lib/types/client/live-turn.d.ts +17 -5
- package/lib/types/client/live-turn.d.ts.map +1 -1
- package/lib/types/client/live-turn.js +106 -76
- package/lib/types/client/live-turn.js.map +1 -1
- package/lib/types/client/motion.d.ts +26 -2
- package/lib/types/client/motion.d.ts.map +1 -1
- package/lib/types/client/motion.js +136 -10
- package/lib/types/client/motion.js.map +1 -1
- package/lib/types/client/official-slots.d.ts +9 -0
- package/lib/types/client/official-slots.d.ts.map +1 -1
- package/lib/types/client/official-slots.js +22 -7
- package/lib/types/client/official-slots.js.map +1 -1
- package/lib/types/client/projection.d.ts +15 -2
- package/lib/types/client/projection.d.ts.map +1 -1
- package/lib/types/client/projection.js +16 -4
- package/lib/types/client/projection.js.map +1 -1
- package/lib/types/client/rewind-cut.d.ts +131 -0
- package/lib/types/client/rewind-cut.d.ts.map +1 -0
- package/lib/types/client/rewind-cut.js +321 -0
- package/lib/types/client/rewind-cut.js.map +1 -0
- package/lib/types/client/text-transform.d.ts +93 -0
- package/lib/types/client/text-transform.d.ts.map +1 -0
- package/lib/types/client/text-transform.js +183 -0
- package/lib/types/client/text-transform.js.map +1 -0
- package/lib/types/client/timeline.d.ts.map +1 -1
- package/lib/types/client/timeline.js.map +1 -1
- package/lib/types/client/tool-activity.d.ts +9 -2
- package/lib/types/client/tool-activity.d.ts.map +1 -1
- package/lib/types/client/tool-activity.js +42 -2
- package/lib/types/client/tool-activity.js.map +1 -1
- package/lib/types/client/turn-slots.d.ts +29 -0
- package/lib/types/client/turn-slots.d.ts.map +1 -0
- package/lib/types/client/turn-slots.js +62 -0
- package/lib/types/client/turn-slots.js.map +1 -0
- package/lib/types/client/types.d.ts +18 -0
- package/lib/types/client/types.d.ts.map +1 -1
- package/lib/types/dsh-better-display.d.ts +4 -1
- package/lib/types/dsh-better-display.d.ts.map +1 -1
- package/lib/types/dsh-better-display.js +56 -7
- package/lib/types/dsh-better-display.js.map +1 -1
- package/lib/types/flags.d.ts +7 -0
- package/lib/types/flags.d.ts.map +1 -0
- package/lib/types/flags.js +37 -0
- package/lib/types/flags.js.map +1 -0
- package/lib/types/log.d.ts +17 -0
- package/lib/types/log.d.ts.map +1 -0
- package/lib/types/log.js +122 -0
- package/lib/types/log.js.map +1 -0
- package/lib/types/metrics.d.ts +18 -0
- package/lib/types/metrics.d.ts.map +1 -0
- package/lib/types/metrics.js +35 -0
- package/lib/types/metrics.js.map +1 -0
- package/package.json +36 -5
- package/scripts/changelog.mjs +20 -0
- package/scripts/check-agents-md.mjs +67 -0
- package/scripts/check-bundle-size.mjs +38 -0
- package/scripts/check-dead-flags.mjs +55 -0
- package/scripts/check-todo-debt.mjs +69 -0
- package/scripts/security-audit-report.mjs +92 -0
- package/scripts/verify-commentary-visible.mjs +627 -0
- package/src/client/AssistantNode.tsx +72 -0
- package/src/client/Blocks.tsx +49 -10
- package/src/client/ChoreographedFlow.tsx +3 -1
- package/src/client/ClosedProcessSummary.tsx +3 -1
- package/src/client/McpAppFrame.tsx +5 -13
- package/src/client/OfficialContent.tsx +47 -9
- package/src/client/Reader.module.css +68 -18
- package/src/client/Reader.tsx +36 -76
- package/src/client/SettingsSection.tsx +1 -7
- package/src/client/StickyLane.tsx +81 -2
- package/src/client/ToolActivity.tsx +1 -1
- package/src/client/index.tsx +8 -1
- package/src/client/live-turn.ts +100 -69
- package/src/client/motion.tsx +135 -7
- package/src/client/official-slots.tsx +23 -7
- package/src/client/projection.ts +16 -4
- package/src/client/rewind-cut.ts +340 -0
- package/src/client/text-transform.ts +265 -0
- package/src/client/timeline.ts +0 -2
- package/src/client/tool-activity.ts +49 -2
- package/src/client/turn-slots.ts +80 -0
- package/src/client/types.ts +19 -0
- package/src/dsh-better-display.ts +58 -7
- package/src/flags.ts +40 -0
- package/src/log.ts +137 -0
- package/src/metrics.ts +50 -0
- package/tests/browser-commentary.tsx +191 -0
- package/tests/chat-flow-hook.test.ts +1 -1
- package/tests/cloud-gate.test.ts +1 -1
- package/tests/context-tool-update.test.ts +1 -1
- package/tests/conversation-scroll.test.ts +1 -1
- package/tests/deliverables.test.ts +1 -1
- package/tests/entry.test.ts +1 -1
- package/tests/fixtures/reader-lane-owners.tsx +46 -0
- package/tests/fixtures/reader-official-users.tsx +64 -0
- package/tests/fixtures/reader-theme-overlap.html +80 -0
- package/tests/fixtures/reader-user-bubble.tsx +222 -0
- package/tests/flags.test.ts +66 -0
- package/tests/fold-choreography.test.ts +32 -8
- package/tests/fold-intensity.test.ts +11 -6
- package/tests/footer-precedence.test.ts +1 -1
- package/tests/history-word-regression.test.ts +1 -1
- package/tests/live-turn.test.ts +125 -54
- package/tests/log.test.ts +99 -0
- package/tests/mcp-apps.test.ts +1 -1
- package/tests/message-chrome.test.ts +1 -1
- package/tests/metrics.test.ts +52 -0
- package/tests/official-slots.test.ts +41 -2
- package/tests/open-file.test.ts +1 -1
- package/tests/pending-submission.test.ts +12 -1
- package/tests/pinned-selection.test.ts +16 -0
- package/tests/platform-media.test.ts +1 -1
- package/tests/projection.test.ts +66 -3
- package/tests/reader-glass-css.test.ts +1 -1
- package/tests/reader-official-users.test.ts +11 -1
- package/tests/reader-sticky-surface.test.ts +377 -0
- package/tests/reader-theme-lanes.test.ts +54 -0
- package/tests/reader-theme-overlap.test.ts +151 -0
- package/tests/reader-user-bubble.test.ts +137 -0
- package/tests/reasoning-follow.test.ts +1 -1
- package/tests/retiring-content.test.ts +98 -6
- package/tests/reveal.test.ts +3 -3
- package/tests/rewind-cut.test.ts +1090 -0
- package/tests/settings-copy.test.ts +1 -1
- package/tests/skill-status.test.ts +1 -1
- package/tests/stock-install.test.ts +1 -1
- package/tests/stream-buffer.test.ts +1 -1
- package/tests/styles.test.ts +30 -3
- package/tests/terminal-input-preview.test.ts +1 -1
- package/tests/text-transform.test.ts +272 -0
- package/tests/timeline.test.ts +1 -1
- package/tests/tool-clock.test.ts +1 -1
- package/tests/tool-diff.test.ts +1 -1
- package/tests/waiting-clock.test.ts +1 -1
- package/tests/word-timeline.test.ts +1 -1
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { readdir, readFile } from 'node:fs/promises';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
|
|
4
|
+
const root = path.resolve(process.argv[2] ?? process.cwd());
|
|
5
|
+
const skipDirs = new Set([
|
|
6
|
+
'node_modules',
|
|
7
|
+
'lib',
|
|
8
|
+
'.git',
|
|
9
|
+
'artifacts',
|
|
10
|
+
'.evidence',
|
|
11
|
+
'.delivery',
|
|
12
|
+
'coverage',
|
|
13
|
+
'report',
|
|
14
|
+
'dist'
|
|
15
|
+
]);
|
|
16
|
+
const extensions = new Set([
|
|
17
|
+
'.ts',
|
|
18
|
+
'.tsx',
|
|
19
|
+
'.mts',
|
|
20
|
+
'.cts',
|
|
21
|
+
'.mjs',
|
|
22
|
+
'.cjs',
|
|
23
|
+
'.js',
|
|
24
|
+
'.jsx',
|
|
25
|
+
'.md',
|
|
26
|
+
'.yml',
|
|
27
|
+
'.yaml',
|
|
28
|
+
'.css',
|
|
29
|
+
'.json',
|
|
30
|
+
'.html'
|
|
31
|
+
]);
|
|
32
|
+
|
|
33
|
+
const marker = new RegExp(String.raw`\b(?:${'TO' + 'DO'}|${'FIX' + 'ME'})\b`);
|
|
34
|
+
const issueId = /#\d+/;
|
|
35
|
+
|
|
36
|
+
async function walk(directory, hits) {
|
|
37
|
+
const entries = await readdir(directory, { withFileTypes: true });
|
|
38
|
+
for (const entry of entries) {
|
|
39
|
+
if (entry.isDirectory()) {
|
|
40
|
+
if (skipDirs.has(entry.name)) continue;
|
|
41
|
+
if (entry.name.startsWith('.') && entry.name !== '.github') continue;
|
|
42
|
+
await walk(path.join(directory, entry.name), hits);
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
if (!entry.isFile() || !extensions.has(path.extname(entry.name))) continue;
|
|
46
|
+
const file = path.join(directory, entry.name);
|
|
47
|
+
let text;
|
|
48
|
+
try {
|
|
49
|
+
text = await readFile(file, 'utf8');
|
|
50
|
+
} catch {
|
|
51
|
+
continue;
|
|
52
|
+
}
|
|
53
|
+
const lines = text.split(/\r?\n/);
|
|
54
|
+
for (let index = 0; index < lines.length; index += 1) {
|
|
55
|
+
const line = lines[index];
|
|
56
|
+
if (!marker.test(line) || issueId.test(line)) continue;
|
|
57
|
+
hits.push(`${path.relative(root, file)}:${index + 1}: ${line.trim()}`);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const hits = [];
|
|
63
|
+
await walk(root, hits);
|
|
64
|
+
if (hits.length > 0) {
|
|
65
|
+
console.error(`TODO/FIXME without an issue id (#123): ${hits.length}`);
|
|
66
|
+
for (const hit of hits) console.error(hit);
|
|
67
|
+
process.exit(1);
|
|
68
|
+
}
|
|
69
|
+
console.log('todo debt: ok');
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { spawnSync } from 'node:child_process';
|
|
2
|
+
import { appendFileSync } from 'node:fs';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
|
|
5
|
+
export function isAuditReport(report) {
|
|
6
|
+
return Boolean(report && !report.error && report.metadata?.vulnerabilities);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function formatAuditError(report, stderr) {
|
|
10
|
+
const summary = report?.error?.summary || report?.error?.detail || stderr || 'npm audit failed';
|
|
11
|
+
return [
|
|
12
|
+
'## npm audit',
|
|
13
|
+
'',
|
|
14
|
+
'npm audit did not return a vulnerability report. Nothing was filled in as a clean result.',
|
|
15
|
+
'',
|
|
16
|
+
'```',
|
|
17
|
+
String(summary).slice(0, 8000),
|
|
18
|
+
'```',
|
|
19
|
+
].join('\n');
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export function formatAudit(report) {
|
|
23
|
+
const counts = report?.metadata?.vulnerabilities ?? {};
|
|
24
|
+
const vulns = report?.vulnerabilities ?? {};
|
|
25
|
+
const lines = [
|
|
26
|
+
'## npm audit',
|
|
27
|
+
'',
|
|
28
|
+
`Total ${counts.total ?? 'unknown'}: critical ${counts.critical ?? 0}, high ${counts.high ?? 0}, moderate ${counts.moderate ?? 0}, low ${counts.low ?? 0}, info ${counts.info ?? 0}.`,
|
|
29
|
+
'',
|
|
30
|
+
'| Package | Severity | Fix |',
|
|
31
|
+
'| --- | --- | --- |',
|
|
32
|
+
];
|
|
33
|
+
for (const [name, info] of Object.entries(vulns)) {
|
|
34
|
+
const fix = info?.fixAvailable === true ? 'yes' : info?.fixAvailable ? 'yes' : 'no';
|
|
35
|
+
lines.push(`| ${name} | ${info?.severity ?? 'unknown'} | ${fix} |`);
|
|
36
|
+
}
|
|
37
|
+
if (Object.keys(vulns).length === 0) lines.push('| (none) | | |');
|
|
38
|
+
lines.push('', '<details>', '<summary>npm audit JSON</summary>', '', '```json');
|
|
39
|
+
const json = JSON.stringify(report, null, 2);
|
|
40
|
+
lines.push(json.length > 100000 ? `${json.slice(0, 100000)}\n… truncated` : json);
|
|
41
|
+
lines.push('```', '', '</details>');
|
|
42
|
+
return lines.join('\n');
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function writeSummary(text) {
|
|
46
|
+
const summary = process.env.GITHUB_STEP_SUMMARY;
|
|
47
|
+
if (!summary) {
|
|
48
|
+
console.log('GITHUB_STEP_SUMMARY is unset; the report was printed here only.');
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
appendFileSync(summary, `${text}\n`);
|
|
52
|
+
console.log(`Wrote the npm audit report to ${summary}`);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function selfTest() {
|
|
56
|
+
const text = formatAudit({
|
|
57
|
+
metadata: { vulnerabilities: { info: 0, low: 1, moderate: 0, high: 0, critical: 0, total: 1 } },
|
|
58
|
+
vulnerabilities: { example: { severity: 'low', fixAvailable: false } },
|
|
59
|
+
});
|
|
60
|
+
const enolock = { error: { code: 'ENOLOCK', summary: 'This command requires an existing lockfile.' } };
|
|
61
|
+
if (!text.includes('| example | low | no |') || !text.includes('```json') || isAuditReport(enolock) || !isAuditReport({ metadata: { vulnerabilities: { total: 0 } } })) {
|
|
62
|
+
console.error('security-audit-report self-test failed');
|
|
63
|
+
process.exit(1);
|
|
64
|
+
}
|
|
65
|
+
console.log('security-audit-report self-test passed');
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if (process.argv.includes('--self-test')) selfTest();
|
|
69
|
+
|
|
70
|
+
const root = fileURLToPath(new URL('..', import.meta.url));
|
|
71
|
+
const result = spawnSync('npm', ['audit', '--json'], {
|
|
72
|
+
cwd: root,
|
|
73
|
+
encoding: 'utf8',
|
|
74
|
+
maxBuffer: 32 * 1024 * 1024,
|
|
75
|
+
});
|
|
76
|
+
const stdout = result.stdout ?? '';
|
|
77
|
+
let report;
|
|
78
|
+
try {
|
|
79
|
+
report = JSON.parse(stdout);
|
|
80
|
+
} catch {
|
|
81
|
+
report = undefined;
|
|
82
|
+
}
|
|
83
|
+
if (!isAuditReport(report)) {
|
|
84
|
+
const failure = formatAuditError(report, result.stderr || stdout || result.error?.message || 'npm audit produced no output');
|
|
85
|
+
console.log(failure);
|
|
86
|
+
writeSummary(failure);
|
|
87
|
+
process.exit(1);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const text = formatAudit(report);
|
|
91
|
+
console.log(text);
|
|
92
|
+
writeSummary(text);
|