scoutline 0.1.0 → 0.6.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/README.md +394 -7
- package/bin/scoutline.js +36 -15
- package/dist/capabilities/diagnostics.d.ts +135 -0
- package/dist/capabilities/diagnostics.d.ts.map +1 -0
- package/dist/capabilities/diagnostics.js +139 -0
- package/dist/capabilities/diagnostics.js.map +1 -0
- package/dist/capabilities/quota.d.ts +99 -0
- package/dist/capabilities/quota.d.ts.map +1 -0
- package/dist/capabilities/quota.js +129 -0
- package/dist/capabilities/quota.js.map +1 -0
- package/dist/capabilities/reader.d.ts +227 -0
- package/dist/capabilities/reader.d.ts.map +1 -0
- package/dist/capabilities/reader.js +100 -0
- package/dist/capabilities/reader.js.map +1 -0
- package/dist/capabilities/repository.d.ts +221 -0
- package/dist/capabilities/repository.d.ts.map +1 -0
- package/dist/capabilities/repository.js +172 -0
- package/dist/capabilities/repository.js.map +1 -0
- package/dist/capabilities/search.d.ts +110 -0
- package/dist/capabilities/search.d.ts.map +1 -0
- package/dist/capabilities/search.js +21 -0
- package/dist/capabilities/search.js.map +1 -0
- package/dist/capabilities/vision.d.ts +156 -0
- package/dist/capabilities/vision.d.ts.map +1 -0
- package/dist/capabilities/vision.js +111 -0
- package/dist/capabilities/vision.js.map +1 -0
- package/dist/command-invocation.d.ts +58 -0
- package/dist/command-invocation.d.ts.map +1 -0
- package/dist/command-invocation.js +95 -0
- package/dist/command-invocation.js.map +1 -0
- package/dist/commands/cache.d.ts +106 -0
- package/dist/commands/cache.d.ts.map +1 -0
- package/dist/commands/cache.js +203 -0
- package/dist/commands/cache.js.map +1 -0
- package/dist/commands/code.d.ts +11 -4
- package/dist/commands/code.d.ts.map +1 -1
- package/dist/commands/code.js +16 -42
- package/dist/commands/code.js.map +1 -1
- package/dist/commands/doctor.d.ts +69 -3
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +179 -52
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/quota.d.ts +45 -3
- package/dist/commands/quota.d.ts.map +1 -1
- package/dist/commands/quota.js +116 -60
- package/dist/commands/quota.js.map +1 -1
- package/dist/commands/read.d.ts +76 -2
- package/dist/commands/read.d.ts.map +1 -1
- package/dist/commands/read.js +260 -121
- package/dist/commands/read.js.map +1 -1
- package/dist/commands/repo.d.ts +55 -4
- package/dist/commands/repo.d.ts.map +1 -1
- package/dist/commands/repo.js +115 -172
- package/dist/commands/repo.js.map +1 -1
- package/dist/commands/repository-explorer.d.ts +147 -0
- package/dist/commands/repository-explorer.d.ts.map +1 -0
- package/dist/commands/repository-explorer.js +550 -0
- package/dist/commands/repository-explorer.js.map +1 -0
- package/dist/commands/search.d.ts +27 -2
- package/dist/commands/search.d.ts.map +1 -1
- package/dist/commands/search.js +95 -103
- package/dist/commands/search.js.map +1 -1
- package/dist/commands/tools.d.ts +9 -3
- package/dist/commands/tools.d.ts.map +1 -1
- package/dist/commands/tools.js +29 -59
- package/dist/commands/tools.js.map +1 -1
- package/dist/commands/vision.d.ts +35 -9
- package/dist/commands/vision.d.ts.map +1 -1
- package/dist/commands/vision.js +184 -131
- package/dist/commands/vision.js.map +1 -1
- package/dist/index.d.ts +62 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +580 -223
- package/dist/index.js.map +1 -1
- package/dist/lib/cache.d.ts +178 -12
- package/dist/lib/cache.d.ts.map +1 -1
- package/dist/lib/cache.js +377 -39
- package/dist/lib/cache.js.map +1 -1
- package/dist/lib/code-mode.d.ts +13 -0
- package/dist/lib/code-mode.d.ts.map +1 -1
- package/dist/lib/code-mode.js +26 -6
- package/dist/lib/code-mode.js.map +1 -1
- package/dist/lib/config.d.ts.map +1 -1
- package/dist/lib/config.js +15 -18
- package/dist/lib/config.js.map +1 -1
- package/dist/lib/errors.d.ts +89 -11
- package/dist/lib/errors.d.ts.map +1 -1
- package/dist/lib/errors.js +168 -21
- package/dist/lib/errors.js.map +1 -1
- package/dist/lib/execution.d.ts +190 -0
- package/dist/lib/execution.d.ts.map +1 -0
- package/dist/lib/execution.js +383 -0
- package/dist/lib/execution.js.map +1 -0
- package/dist/lib/index.d.ts +10 -2
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/index.js +10 -2
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/mcp-client.d.ts +75 -16
- package/dist/lib/mcp-client.d.ts.map +1 -1
- package/dist/lib/mcp-client.js +173 -108
- package/dist/lib/mcp-client.js.map +1 -1
- package/dist/lib/mcp-config.d.ts +17 -0
- package/dist/lib/mcp-config.d.ts.map +1 -1
- package/dist/lib/mcp-config.js +29 -0
- package/dist/lib/mcp-config.js.map +1 -1
- package/dist/lib/monitor-client.d.ts +17 -3
- package/dist/lib/monitor-client.d.ts.map +1 -1
- package/dist/lib/monitor-client.js +23 -69
- package/dist/lib/monitor-client.js.map +1 -1
- package/dist/lib/output.d.ts +53 -7
- package/dist/lib/output.d.ts.map +1 -1
- package/dist/lib/output.js +126 -39
- package/dist/lib/output.js.map +1 -1
- package/dist/lib/redact.d.ts +62 -3
- package/dist/lib/redact.d.ts.map +1 -1
- package/dist/lib/redact.js +165 -31
- package/dist/lib/redact.js.map +1 -1
- package/dist/lib/tool-cache.d.ts +86 -0
- package/dist/lib/tool-cache.d.ts.map +1 -0
- package/dist/lib/tool-cache.js +123 -0
- package/dist/lib/tool-cache.js.map +1 -0
- package/dist/lib/tty.d.ts +7 -20
- package/dist/lib/tty.d.ts.map +1 -1
- package/dist/lib/tty.js +51 -30
- package/dist/lib/tty.js.map +1 -1
- package/dist/node-command-invocation-adapter.d.ts +28 -0
- package/dist/node-command-invocation-adapter.d.ts.map +1 -0
- package/dist/node-command-invocation-adapter.js +88 -0
- package/dist/node-command-invocation-adapter.js.map +1 -0
- package/dist/providers/minimax/adapter.d.ts +49 -0
- package/dist/providers/minimax/adapter.d.ts.map +1 -0
- package/dist/providers/minimax/adapter.js +450 -0
- package/dist/providers/minimax/adapter.js.map +1 -0
- package/dist/providers/minimax/coding-plan-client.d.ts +60 -0
- package/dist/providers/minimax/coding-plan-client.d.ts.map +1 -0
- package/dist/providers/minimax/coding-plan-client.js +204 -0
- package/dist/providers/minimax/coding-plan-client.js.map +1 -0
- package/dist/providers/minimax/config.d.ts +32 -0
- package/dist/providers/minimax/config.d.ts.map +1 -0
- package/dist/providers/minimax/config.js +84 -0
- package/dist/providers/minimax/config.js.map +1 -0
- package/dist/providers/minimax/media.d.ts +88 -0
- package/dist/providers/minimax/media.d.ts.map +1 -0
- package/dist/providers/minimax/media.js +232 -0
- package/dist/providers/minimax/media.js.map +1 -0
- package/dist/providers/minimax/quota-client.d.ts +44 -0
- package/dist/providers/minimax/quota-client.d.ts.map +1 -0
- package/dist/providers/minimax/quota-client.js +83 -0
- package/dist/providers/minimax/quota-client.js.map +1 -0
- package/dist/providers/minimax/quota.d.ts +48 -0
- package/dist/providers/minimax/quota.d.ts.map +1 -0
- package/dist/providers/minimax/quota.js +120 -0
- package/dist/providers/minimax/quota.js.map +1 -0
- package/dist/providers/minimax/sdk-client.d.ts +29 -0
- package/dist/providers/minimax/sdk-client.d.ts.map +1 -0
- package/dist/providers/minimax/sdk-client.js +50 -0
- package/dist/providers/minimax/sdk-client.js.map +1 -0
- package/dist/providers/minimax/vision-attestations.d.ts +52 -0
- package/dist/providers/minimax/vision-attestations.d.ts.map +1 -0
- package/dist/providers/minimax/vision-attestations.js +79 -0
- package/dist/providers/minimax/vision-attestations.js.map +1 -0
- package/dist/providers/minimax/vision-conformance.d.ts +186 -0
- package/dist/providers/minimax/vision-conformance.d.ts.map +1 -0
- package/dist/providers/minimax/vision-conformance.js +371 -0
- package/dist/providers/minimax/vision-conformance.js.map +1 -0
- package/dist/providers/minimax/vision-mappings/chart.d.ts +35 -0
- package/dist/providers/minimax/vision-mappings/chart.d.ts.map +1 -0
- package/dist/providers/minimax/vision-mappings/chart.js +55 -0
- package/dist/providers/minimax/vision-mappings/chart.js.map +1 -0
- package/dist/providers/minimax/vision-mappings/common.d.ts +60 -0
- package/dist/providers/minimax/vision-mappings/common.d.ts.map +1 -0
- package/dist/providers/minimax/vision-mappings/common.js +75 -0
- package/dist/providers/minimax/vision-mappings/common.js.map +1 -0
- package/dist/providers/minimax/vision-mappings/diagnose-error.d.ts +35 -0
- package/dist/providers/minimax/vision-mappings/diagnose-error.d.ts.map +1 -0
- package/dist/providers/minimax/vision-mappings/diagnose-error.js +55 -0
- package/dist/providers/minimax/vision-mappings/diagnose-error.js.map +1 -0
- package/dist/providers/minimax/vision-mappings/diagram.d.ts +35 -0
- package/dist/providers/minimax/vision-mappings/diagram.d.ts.map +1 -0
- package/dist/providers/minimax/vision-mappings/diagram.js +55 -0
- package/dist/providers/minimax/vision-mappings/diagram.js.map +1 -0
- package/dist/providers/minimax/vision-mappings/extract-text.d.ts +35 -0
- package/dist/providers/minimax/vision-mappings/extract-text.d.ts.map +1 -0
- package/dist/providers/minimax/vision-mappings/extract-text.js +55 -0
- package/dist/providers/minimax/vision-mappings/extract-text.js.map +1 -0
- package/dist/providers/minimax/vision-mappings/ui-artifact.d.ts +35 -0
- package/dist/providers/minimax/vision-mappings/ui-artifact.d.ts.map +1 -0
- package/dist/providers/minimax/vision-mappings/ui-artifact.js +69 -0
- package/dist/providers/minimax/vision-mappings/ui-artifact.js.map +1 -0
- package/dist/providers/minimax/vision-mappings.generated.d.ts +29 -0
- package/dist/providers/minimax/vision-mappings.generated.d.ts.map +1 -0
- package/dist/providers/minimax/vision-mappings.generated.js +29 -0
- package/dist/providers/minimax/vision-mappings.generated.js.map +1 -0
- package/dist/providers/minimax/vision-revisions.d.ts +29 -0
- package/dist/providers/minimax/vision-revisions.d.ts.map +1 -0
- package/dist/providers/minimax/vision-revisions.js +34 -0
- package/dist/providers/minimax/vision-revisions.js.map +1 -0
- package/dist/providers/registry.d.ts +36 -0
- package/dist/providers/registry.d.ts.map +1 -0
- package/dist/providers/registry.js +45 -0
- package/dist/providers/registry.js.map +1 -0
- package/dist/providers/selection.d.ts +44 -0
- package/dist/providers/selection.d.ts.map +1 -0
- package/dist/providers/selection.js +85 -0
- package/dist/providers/selection.js.map +1 -0
- package/dist/providers/types.d.ts +281 -0
- package/dist/providers/types.d.ts.map +1 -0
- package/dist/providers/types.js +127 -0
- package/dist/providers/types.js.map +1 -0
- package/dist/providers/zai/adapter.d.ts +35 -0
- package/dist/providers/zai/adapter.d.ts.map +1 -0
- package/dist/providers/zai/adapter.js +685 -0
- package/dist/providers/zai/adapter.js.map +1 -0
- package/dist/providers/zai/credentials.d.ts +38 -0
- package/dist/providers/zai/credentials.d.ts.map +1 -0
- package/dist/providers/zai/credentials.js +60 -0
- package/dist/providers/zai/credentials.js.map +1 -0
- package/dist/providers/zai/encoded-error.d.ts +90 -0
- package/dist/providers/zai/encoded-error.d.ts.map +1 -0
- package/dist/providers/zai/encoded-error.js +169 -0
- package/dist/providers/zai/encoded-error.js.map +1 -0
- package/dist/providers/zai/media.d.ts +38 -0
- package/dist/providers/zai/media.d.ts.map +1 -0
- package/dist/providers/zai/media.js +107 -0
- package/dist/providers/zai/media.js.map +1 -0
- package/dist/providers/zai/monitor-client.d.ts +53 -0
- package/dist/providers/zai/monitor-client.d.ts.map +1 -0
- package/dist/providers/zai/monitor-client.js +117 -0
- package/dist/providers/zai/monitor-client.js.map +1 -0
- package/dist/providers/zai/quota.d.ts +47 -0
- package/dist/providers/zai/quota.d.ts.map +1 -0
- package/dist/providers/zai/quota.js +127 -0
- package/dist/providers/zai/quota.js.map +1 -0
- package/dist/providers/zai/reader.d.ts +82 -0
- package/dist/providers/zai/reader.d.ts.map +1 -0
- package/dist/providers/zai/reader.js +490 -0
- package/dist/providers/zai/reader.js.map +1 -0
- package/dist/providers/zai/repository.d.ts +76 -0
- package/dist/providers/zai/repository.d.ts.map +1 -0
- package/dist/providers/zai/repository.js +715 -0
- package/dist/providers/zai/repository.js.map +1 -0
- package/package.json +11 -6
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cache command — local cache inspection and clearing
|
|
3
|
+
* (Cache Module Unification Ticket 03).
|
|
4
|
+
*
|
|
5
|
+
* The command is presentation-only: it receives already-resolved stats
|
|
6
|
+
* or clear results through injected dependencies and wraps them with a
|
|
7
|
+
* TTY presentation override. Directory resolution, env-var policy, and
|
|
8
|
+
* on-disk I/O live in `src/lib/cache.ts` (Ticket 01). The dispatcher
|
|
9
|
+
* (`src/index.ts`) wires production to the real `cacheStats()` and
|
|
10
|
+
* `clearAllCaches()` and threads them through these dependencies; tests
|
|
11
|
+
* inject doubles.
|
|
12
|
+
*
|
|
13
|
+
* Output format (core-flows artifact):
|
|
14
|
+
*
|
|
15
|
+
* ```text
|
|
16
|
+
* Cache directory: ~/.scoutline/
|
|
17
|
+
* Status: enabled (TTL 24h, cap 100MB)
|
|
18
|
+
*
|
|
19
|
+
* Response cache:
|
|
20
|
+
* Entries: 47
|
|
21
|
+
* Size: 12.3 MB
|
|
22
|
+
*
|
|
23
|
+
* Tool cache:
|
|
24
|
+
* Entries: 1
|
|
25
|
+
* Size: 8.2 KB
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* L1 fix: Doctor's one-line cache summary is computed from the same
|
|
29
|
+
* `cacheStats()` shape but formatted by the dispatcher, not by this
|
|
30
|
+
* module. See `formatDoctorCacheSummary`.
|
|
31
|
+
*/
|
|
32
|
+
// ---------------------------------------------------------------------------
|
|
33
|
+
// Pure formatting helpers
|
|
34
|
+
// ---------------------------------------------------------------------------
|
|
35
|
+
/**
|
|
36
|
+
* Format a byte count as e.g. `"12.3 MB"`, `"8.2 KB"`, `"510 B"`. Used
|
|
37
|
+
* by `cache stats` presentation and by Doctor's one-line summary. Pure:
|
|
38
|
+
* no I/O, no env reads.
|
|
39
|
+
*/
|
|
40
|
+
export function formatBytes(bytes) {
|
|
41
|
+
if (!Number.isFinite(bytes) || bytes < 0)
|
|
42
|
+
return "0 B";
|
|
43
|
+
if (bytes < 1024)
|
|
44
|
+
return `${bytes} B`;
|
|
45
|
+
const units = ["KB", "MB", "GB", "TB"];
|
|
46
|
+
let value = bytes / 1024;
|
|
47
|
+
let unitIndex = 0;
|
|
48
|
+
while (value >= 1024 && unitIndex < units.length - 1) {
|
|
49
|
+
value /= 1024;
|
|
50
|
+
unitIndex += 1;
|
|
51
|
+
}
|
|
52
|
+
return `${value.toFixed(1)} ${units[unitIndex]}`;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Format a TTL in ms as `"24h"`, `"30m"`, or `"60s"`. Chooses the
|
|
56
|
+
* largest whole-unit that divides the input evenly so the default
|
|
57
|
+
* 24h renders as `24h` rather than `86400000ms`.
|
|
58
|
+
*/
|
|
59
|
+
export function formatTtl(ms) {
|
|
60
|
+
if (!Number.isFinite(ms) || ms <= 0)
|
|
61
|
+
return "0s";
|
|
62
|
+
if (ms % 3_600_000 === 0)
|
|
63
|
+
return `${ms / 3_600_000}h`;
|
|
64
|
+
if (ms % 60_000 === 0)
|
|
65
|
+
return `${ms / 60_000}m`;
|
|
66
|
+
return `${Math.round(ms / 1000)}s`;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Format the size cap (bytes) as e.g. `"100MB"`. Mirrors the
|
|
70
|
+
* `SCOUTLINE_CACHE_SIZE_MB` env-var spelling so the operator surface
|
|
71
|
+
* matches the documentation.
|
|
72
|
+
*/
|
|
73
|
+
function formatSizeCap(bytes) {
|
|
74
|
+
return `${Math.round(bytes / (1024 * 1024))}MB`;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Pluralize "entry"/"entries" for a count.
|
|
78
|
+
*/
|
|
79
|
+
function pluralEntry(count) {
|
|
80
|
+
return count === 1 ? "entry" : "entries";
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Format the inventory of both caches as a multi-line TTY block per
|
|
84
|
+
* the core-flows artifact. Used as the TTY/compact/markdown/refs
|
|
85
|
+
* presentation for `cache stats`. Pure.
|
|
86
|
+
*/
|
|
87
|
+
export function formatCacheStats(stats) {
|
|
88
|
+
const lines = [];
|
|
89
|
+
lines.push(`Cache directory: ${stats.dir}`);
|
|
90
|
+
if (stats.enabled) {
|
|
91
|
+
lines.push(`Status: enabled (TTL ${formatTtl(stats.ttlMs)}, cap ${formatSizeCap(stats.sizeCapBytes)})`);
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
lines.push(`Status: disabled`);
|
|
95
|
+
}
|
|
96
|
+
lines.push("");
|
|
97
|
+
lines.push("Response cache:");
|
|
98
|
+
lines.push(` Entries: ${stats.responseCache.entries}`);
|
|
99
|
+
lines.push(` Size: ${formatBytes(stats.responseCache.totalBytes)}`);
|
|
100
|
+
lines.push("");
|
|
101
|
+
lines.push("Tool cache:");
|
|
102
|
+
lines.push(` Entries: ${stats.toolCache.entries}`);
|
|
103
|
+
lines.push(` Size: ${formatBytes(stats.toolCache.totalBytes)}`);
|
|
104
|
+
return lines.join("\n");
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Format a clear result as a one-line TTY notice.
|
|
108
|
+
*/
|
|
109
|
+
export function formatCacheClear(result) {
|
|
110
|
+
return (`Cleared ${result.responsesCleared} response ${pluralEntry(result.responsesCleared)} ` +
|
|
111
|
+
`and ${result.toolsCleared} tool ${pluralEntry(result.toolsCleared)} ` +
|
|
112
|
+
`(${formatBytes(result.bytesFreed)} freed)`);
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Format the one-line Doctor cache summary from a `cacheStats()` value.
|
|
116
|
+
* The dispatcher calls this before invoking `buildDiagnosticsReport`;
|
|
117
|
+
* the report builder embeds the result verbatim. Examples:
|
|
118
|
+
*
|
|
119
|
+
* ```text
|
|
120
|
+
* Cache: enabled, 47 response entries (12.3 MB), 1 tool entry (8.2 KB), ~/.scoutline/
|
|
121
|
+
* Cache: disabled
|
|
122
|
+
* ```
|
|
123
|
+
*
|
|
124
|
+
* Pure: never reads env or touches the filesystem.
|
|
125
|
+
*/
|
|
126
|
+
export function formatDoctorCacheSummary(stats) {
|
|
127
|
+
if (!stats.enabled)
|
|
128
|
+
return "Cache: disabled";
|
|
129
|
+
return (`Cache: enabled, ${stats.responseCache.entries} response ${pluralEntry(stats.responseCache.entries)} ` +
|
|
130
|
+
`(${formatBytes(stats.responseCache.totalBytes)}), ${stats.toolCache.entries} tool ${pluralEntry(stats.toolCache.entries)} ` +
|
|
131
|
+
`(${formatBytes(stats.toolCache.totalBytes)}), ${stats.dir}`);
|
|
132
|
+
}
|
|
133
|
+
// ---------------------------------------------------------------------------
|
|
134
|
+
// Commands
|
|
135
|
+
// ---------------------------------------------------------------------------
|
|
136
|
+
/** All text modes share the same multi-line inventory rendering. */
|
|
137
|
+
function statsPresentations(stats) {
|
|
138
|
+
const text = formatCacheStats(stats);
|
|
139
|
+
return { compact: text, markdown: text, refs: text, tty: text };
|
|
140
|
+
}
|
|
141
|
+
/** All text modes share the same one-line clear notice. */
|
|
142
|
+
function clearPresentations(result) {
|
|
143
|
+
const text = formatCacheClear(result);
|
|
144
|
+
return { compact: text, markdown: text, refs: text, tty: text };
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Run the `cache stats` subcommand. Returns the inventory as base data
|
|
148
|
+
* with a TTY presentation override. Exit code is always 0 on success;
|
|
149
|
+
* I/O failures propagate as ordinary errors through the dispatcher.
|
|
150
|
+
*/
|
|
151
|
+
export async function cacheStatsCommand(deps) {
|
|
152
|
+
const stats = await deps.getStats();
|
|
153
|
+
return {
|
|
154
|
+
kind: "data",
|
|
155
|
+
data: stats,
|
|
156
|
+
presentations: statsPresentations(stats),
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Run the `cache clear` subcommand. Returns the count of cleared
|
|
161
|
+
* entries and bytes freed as base data with a TTY presentation
|
|
162
|
+
* override.
|
|
163
|
+
*/
|
|
164
|
+
export async function cacheClearCommand(deps) {
|
|
165
|
+
const result = await deps.clear();
|
|
166
|
+
return {
|
|
167
|
+
kind: "data",
|
|
168
|
+
data: result,
|
|
169
|
+
presentations: clearPresentations(result),
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
export const CACHE_HELP = `
|
|
173
|
+
Cache - Inspect and clear the local cache
|
|
174
|
+
|
|
175
|
+
Usage:
|
|
176
|
+
scoutline cache stats # show inventory of both cache subdirectories
|
|
177
|
+
scoutline cache clear # delete every file in both cache subdirectories
|
|
178
|
+
|
|
179
|
+
Subcommands:
|
|
180
|
+
stats Print the cache directory, status (enabled/disabled, TTL, size
|
|
181
|
+
cap), and per-subdirectory entry count and total size for both
|
|
182
|
+
the response cache (~/.scoutline/cache/) and the tool cache
|
|
183
|
+
(~/.scoutline/tools/).
|
|
184
|
+
clear Delete every file under <root>/cache/ and <root>/tools/. The
|
|
185
|
+
directories themselves are preserved so the next invocation
|
|
186
|
+
recreates entries without a directory-creation race. The
|
|
187
|
+
orphaned legacy ~/.cache/zai-cli/ directory is never touched.
|
|
188
|
+
|
|
189
|
+
The cache root defaults to ~/.scoutline/ on every platform; override it
|
|
190
|
+
with SCOUTLINE_CACHE_DIR (ZAI_MCP_CACHE_DIR and ZAI_CACHE_DIR are
|
|
191
|
+
accepted as lower-precedence legacy aliases). Disable both caches with
|
|
192
|
+
SCOUTLINE_CACHE=0 (legacy alias: ZAI_CACHE=0).
|
|
193
|
+
|
|
194
|
+
Exit codes:
|
|
195
|
+
0 Success.
|
|
196
|
+
1 I/O error (reported as a sanitized JSON error envelope).
|
|
197
|
+
|
|
198
|
+
Examples:
|
|
199
|
+
scoutline cache stats
|
|
200
|
+
scoutline cache clear
|
|
201
|
+
scoutline cache --help
|
|
202
|
+
`.trim();
|
|
203
|
+
//# sourceMappingURL=cache.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cache.js","sourceRoot":"","sources":["../../src/commands/cache.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AA0BH,8EAA8E;AAC9E,0BAA0B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AAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC;AAClE,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,IAA4B;IAE5B,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAC;IACpC,OAAO;QACL,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,KAAK;QACX,aAAa,EAAE,kBAAkB,CAAC,KAAK,CAAC;KACzC,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,IAA4B;IAE5B,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,KAAK,EAAE,CAAC;IAClC,OAAO;QACL,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,MAAM;QACZ,aAAa,EAAE,kBAAkB,CAAC,MAAM,CAAC;KAC1C,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,UAAU,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8BzB,CAAC,IAAI,EAAE,CAAC"}
|
package/dist/commands/code.d.ts
CHANGED
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Code Mode commands for tool chaining
|
|
3
|
+
*
|
|
4
|
+
* P1-07: each command returns a CommandResult instead of writing
|
|
5
|
+
* directly to stdout/stderr. stdin is read through CommandContext rather
|
|
6
|
+
* than the process stream. No Provider selection is added; Phase 0
|
|
7
|
+
* Code Mode semantics (run, eval, logs, timeout, interfaces, prompt
|
|
8
|
+
* template) are preserved.
|
|
3
9
|
*/
|
|
10
|
+
import type { CommandContext, CommandResult } from "../command-invocation.js";
|
|
4
11
|
export interface CodeRunOptions {
|
|
5
12
|
timeout?: number;
|
|
6
13
|
includeLogs?: boolean;
|
|
7
14
|
}
|
|
8
|
-
export declare function runCodeFile(filePath: string, options?: CodeRunOptions): Promise<
|
|
9
|
-
export declare function evalCode(code: string, options?: CodeRunOptions): Promise<
|
|
10
|
-
export declare function printInterfaces(): Promise<
|
|
11
|
-
export declare function printPromptTemplate():
|
|
15
|
+
export declare function runCodeFile(filePath: string, options?: CodeRunOptions, context?: CommandContext): Promise<CommandResult>;
|
|
16
|
+
export declare function evalCode(code: string, options?: CodeRunOptions, context?: CommandContext): Promise<CommandResult>;
|
|
17
|
+
export declare function printInterfaces(context?: CommandContext): Promise<CommandResult>;
|
|
18
|
+
export declare function printPromptTemplate(context?: CommandContext): CommandResult;
|
|
12
19
|
export declare const CODE_HELP: string;
|
|
13
20
|
//# sourceMappingURL=code.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code.d.ts","sourceRoot":"","sources":["../../src/commands/code.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"code.d.ts","sourceRoot":"","sources":["../../src/commands/code.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAE9E,MAAM,WAAW,cAAc;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,wBAAsB,WAAW,CAC/B,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE,cAAmB,EAC5B,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,aAAa,CAAC,CAWxB;AAED,wBAAsB,QAAQ,CAC5B,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,cAAmB,EAC5B,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,aAAa,CAAC,CASxB;AAED,wBAAsB,eAAe,CACnC,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,aAAa,CAAC,CAQxB;AAED,wBAAgB,mBAAmB,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,aAAa,CAE3E;AAGD,eAAO,MAAM,SAAS,QAkBd,CAAC"}
|
package/dist/commands/code.js
CHANGED
|
@@ -1,75 +1,49 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Code Mode commands for tool chaining
|
|
3
|
+
*
|
|
4
|
+
* P1-07: each command returns a CommandResult instead of writing
|
|
5
|
+
* directly to stdout/stderr. stdin is read through CommandContext rather
|
|
6
|
+
* than the process stream. No Provider selection is added; Phase 0
|
|
7
|
+
* Code Mode semantics (run, eval, logs, timeout, interfaces, prompt
|
|
8
|
+
* template) are preserved.
|
|
3
9
|
*/
|
|
4
10
|
import * as fs from "node:fs/promises";
|
|
5
11
|
import { ZaiCodeModeClient } from "../lib/code-mode.js";
|
|
6
|
-
|
|
7
|
-
import { formatErrorOutput } from "../lib/errors.js";
|
|
8
|
-
import { silenceConsole, restoreConsole } from "../lib/silence.js";
|
|
9
|
-
export async function runCodeFile(filePath, options = {}) {
|
|
12
|
+
export async function runCodeFile(filePath, options = {}, context) {
|
|
10
13
|
const code = await fs.readFile(filePath, "utf8");
|
|
11
|
-
silenceConsole();
|
|
12
14
|
const codeClient = new ZaiCodeModeClient();
|
|
13
15
|
try {
|
|
14
16
|
const result = await codeClient.callToolChain(code, options.timeout);
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
else {
|
|
19
|
-
outputSuccess(result.result);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
catch (error) {
|
|
23
|
-
restoreConsole();
|
|
24
|
-
console.error(formatErrorOutput(error));
|
|
25
|
-
process.exit(1);
|
|
17
|
+
const data = options.includeLogs ? result : result.result;
|
|
18
|
+
return { kind: "data", data };
|
|
26
19
|
}
|
|
27
20
|
finally {
|
|
28
21
|
await codeClient.close().catch(() => { });
|
|
29
|
-
restoreConsole();
|
|
30
22
|
}
|
|
31
23
|
}
|
|
32
|
-
export async function evalCode(code, options = {}) {
|
|
33
|
-
silenceConsole();
|
|
24
|
+
export async function evalCode(code, options = {}, context) {
|
|
34
25
|
const codeClient = new ZaiCodeModeClient();
|
|
35
26
|
try {
|
|
36
27
|
const result = await codeClient.callToolChain(code, options.timeout);
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
40
|
-
else {
|
|
41
|
-
outputSuccess(result.result);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
catch (error) {
|
|
45
|
-
restoreConsole();
|
|
46
|
-
console.error(formatErrorOutput(error));
|
|
47
|
-
process.exit(1);
|
|
28
|
+
const data = options.includeLogs ? result : result.result;
|
|
29
|
+
return { kind: "data", data };
|
|
48
30
|
}
|
|
49
31
|
finally {
|
|
50
32
|
await codeClient.close().catch(() => { });
|
|
51
|
-
restoreConsole();
|
|
52
33
|
}
|
|
53
34
|
}
|
|
54
|
-
export async function printInterfaces() {
|
|
55
|
-
silenceConsole();
|
|
35
|
+
export async function printInterfaces(context) {
|
|
56
36
|
const codeClient = new ZaiCodeModeClient();
|
|
57
37
|
try {
|
|
58
38
|
const interfaces = await codeClient.getAllInterfaces();
|
|
59
|
-
|
|
60
|
-
}
|
|
61
|
-
catch (error) {
|
|
62
|
-
restoreConsole();
|
|
63
|
-
console.error(formatErrorOutput(error));
|
|
64
|
-
process.exit(1);
|
|
39
|
+
return { kind: "data", data: interfaces };
|
|
65
40
|
}
|
|
66
41
|
finally {
|
|
67
42
|
await codeClient.close().catch(() => { });
|
|
68
|
-
restoreConsole();
|
|
69
43
|
}
|
|
70
44
|
}
|
|
71
|
-
export function printPromptTemplate() {
|
|
72
|
-
|
|
45
|
+
export function printPromptTemplate(context) {
|
|
46
|
+
return { kind: "data", data: ZaiCodeModeClient.getPromptTemplate() };
|
|
73
47
|
}
|
|
74
48
|
// Help text
|
|
75
49
|
export const CODE_HELP = `
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code.js","sourceRoot":"","sources":["../../src/commands/code.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"code.js","sourceRoot":"","sources":["../../src/commands/code.ts"],"names":[],"mappings":"AA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AAC,KAAK,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;IAC3C,CAAC;AACH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,OAAwB;IAExB,MAAM,UAAU,GAAG,IAAI,iBAAiB,EAAE,CAAC;IAC3C,IAAI,CAAC;QACH,MAAM,UAAU,GAAG,MAAM,UAAU,CAAC,gBAAgB,EAAE,CAAC;QACvD,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC;IAC5C,CAAC;YAAS,CAAC;QACT,MAAM,UAAU,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;IAC3C,CAAC;AACH,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,OAAwB;IAC1D,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,iBAAiB,CAAC,iBAAiB,EAAE,EAAE,CAAC;AACvE,CAAC;AAED,YAAY;AACZ,MAAM,CAAC,MAAM,SAAS,GAAG;;;;;;;;;;;;;;;;;;CAkBxB,CAAC,IAAI,EAAE,CAAC"}
|
|
@@ -1,10 +1,76 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Doctor command
|
|
2
|
+
* Doctor command — Provider-aware diagnostics (P4-04, DESIGN.md §14).
|
|
3
|
+
*
|
|
4
|
+
* The command is presentation-only: it receives a report builder through
|
|
5
|
+
* injected dependencies and wraps the resulting {@link DiagnosticsReport}
|
|
6
|
+
* as base data with a computed exit code. Provider resolution, capability
|
|
7
|
+
* probing, settled collection, and failure redaction live in
|
|
8
|
+
* {@link buildDiagnosticsReport} so the command never imports a Provider
|
|
9
|
+
* transport (ZaiMcpClient, monitor client, or environment credential
|
|
10
|
+
* reads) directly.
|
|
11
|
+
*
|
|
12
|
+
* Exit semantics (DESIGN.md §14):
|
|
13
|
+
* - Missing effective Provider credentials -> exit 1.
|
|
14
|
+
* - Any configured probe error -> exit 1 (successful entries preserved).
|
|
15
|
+
* - All configured probes succeed, or only tools-disabled skips -> exit 0.
|
|
16
|
+
*
|
|
17
|
+
* Under `--no-tools` the command returns after metadata + configured-state
|
|
18
|
+
* evaluation and constructs no Adapter and no transport (FR-034).
|
|
3
19
|
*/
|
|
20
|
+
import type { CommandResult } from "../command-invocation.js";
|
|
21
|
+
import type { DiagnosticsReport } from "../capabilities/diagnostics.js";
|
|
22
|
+
import type { ProviderDescriptor, ProviderId } from "../providers/types.js";
|
|
23
|
+
export interface DoctorDiagnosticsDependencies {
|
|
24
|
+
readonly noTools: boolean;
|
|
25
|
+
readonly effectiveProvider: ProviderId;
|
|
26
|
+
readonly descriptors: readonly ProviderDescriptor[];
|
|
27
|
+
readonly env: NodeJS.ProcessEnv;
|
|
28
|
+
readonly sleep: (ms: number) => Promise<void>;
|
|
29
|
+
readonly random: () => number;
|
|
30
|
+
/**
|
|
31
|
+
* Pre-formatted one-line cache summary (Cache Module Unification
|
|
32
|
+
* Ticket 03). The dispatcher formats this from `cacheStats()` output
|
|
33
|
+
* before invoking the report builder; the report builder only embeds
|
|
34
|
+
* it. Optional for backward compatibility with existing tests that
|
|
35
|
+
* don't cover the cache surface. When omitted, the returned report
|
|
36
|
+
* simply leaves out the `cache` field.
|
|
37
|
+
*/
|
|
38
|
+
readonly cacheSummary?: string;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Build a schema-version-1 {@link DiagnosticsReport}. Inventory
|
|
42
|
+
* (`sharedCapabilities`, `zaiOnlyCapabilities`) is derived purely from
|
|
43
|
+
* `deps.descriptors` — no descriptor.create(), no transport, no
|
|
44
|
+
* production registry import. Under `--no-tools` the command returns
|
|
45
|
+
* after metadata + configured-state evaluation. Otherwise each
|
|
46
|
+
* configured Provider is probed through shared execution with settled
|
|
47
|
+
* collection, preserving registry order and normalized redacted
|
|
48
|
+
* failures.
|
|
49
|
+
*/
|
|
50
|
+
export declare function buildDiagnosticsReport(deps: DoctorDiagnosticsDependencies): Promise<DiagnosticsReport>;
|
|
51
|
+
/**
|
|
52
|
+
* Compute the doctor exit code from a finalized report. Exit 1 when the
|
|
53
|
+
* effective Provider is unconfigured or any configured probe errored;
|
|
54
|
+
* otherwise exit 0. A tools-disabled or not-configured skip on a
|
|
55
|
+
* non-effective Provider never fails the report.
|
|
56
|
+
*/
|
|
57
|
+
export declare function doctorExitCode(report: DiagnosticsReport): number;
|
|
4
58
|
export interface DoctorOptions {
|
|
5
59
|
noTools?: boolean;
|
|
6
|
-
enableVision?: boolean;
|
|
7
60
|
}
|
|
8
|
-
|
|
61
|
+
/**
|
|
62
|
+
* Injectable dependencies for the doctor command. `buildReport` resolves
|
|
63
|
+
* the diagnostics report; the command only wraps it for presentation and
|
|
64
|
+
* exit-code selection.
|
|
65
|
+
*/
|
|
66
|
+
export interface DoctorCommandDependencies {
|
|
67
|
+
readonly buildReport: () => Promise<DiagnosticsReport>;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Run the doctor command. Returns the diagnostics report as base data
|
|
71
|
+
* with a computed exit code (1 when the effective Provider is
|
|
72
|
+
* unconfigured or any configured probe failed; otherwise 0).
|
|
73
|
+
*/
|
|
74
|
+
export declare function doctor(deps: DoctorCommandDependencies): Promise<CommandResult<DiagnosticsReport>>;
|
|
9
75
|
export declare const DOCTOR_HELP: string;
|
|
10
76
|
//# sourceMappingURL=doctor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../src/commands/doctor.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../src/commands/doctor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,KAAK,EAEV,iBAAiB,EAElB,MAAM,gCAAgC,CAAC;AASxC,OAAO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