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
package/dist/lib/redact.js
CHANGED
|
@@ -1,50 +1,184 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Recursive Provider credential redaction (DESIGN.md §16).
|
|
3
|
+
*
|
|
4
|
+
* This Module is the single source of truth for stripping Provider
|
|
5
|
+
* credentials before any value leaves Scoutline's outward boundaries:
|
|
6
|
+
* formatted errors, cached metadata, quota failures, diagnostics output,
|
|
7
|
+
* and fatal shell errors.
|
|
8
|
+
*
|
|
9
|
+
* Redaction properties (Phase 4 P4-01):
|
|
10
|
+
* - Case-insensitive for the canonical credential-shaped keys.
|
|
11
|
+
* - Recursive through nested arrays and plain objects.
|
|
12
|
+
* - Non-mutating — the original input is never modified.
|
|
13
|
+
* - Secret-aware — every configured secret value is replaced inside
|
|
14
|
+
* any string the value tree reaches, not just the configured key.
|
|
15
|
+
* - Empty-safe — empty strings are never treated as a replacement token.
|
|
16
|
+
*
|
|
17
|
+
* The Module retains the legacy `redactSecrets(value, apiKey?)` and
|
|
18
|
+
* `redactTool(tool)` exports so existing call sites keep compiling.
|
|
19
|
+
* New code should pass an explicit array of secrets so every Provider's
|
|
20
|
+
* credential is covered in one pass.
|
|
3
21
|
*/
|
|
4
|
-
|
|
22
|
+
/**
|
|
23
|
+
* Canonical credential-shaped key names. Lowercased so case-insensitive
|
|
24
|
+
* matching is a one-step compare. Covers every name DESIGN.md §16
|
|
25
|
+
* enumerates plus the common HTTP header aliases.
|
|
26
|
+
*/
|
|
27
|
+
const CREDENTIAL_KEYS = new Set([
|
|
5
28
|
"authorization",
|
|
6
|
-
"
|
|
29
|
+
"x-api-key",
|
|
7
30
|
"api_key",
|
|
8
|
-
"
|
|
31
|
+
"apikey",
|
|
9
32
|
"access_token",
|
|
10
33
|
"token",
|
|
11
|
-
"
|
|
12
|
-
"
|
|
34
|
+
"z_ai_api_key",
|
|
35
|
+
"zai_api_key",
|
|
36
|
+
"minimax_api_key",
|
|
13
37
|
]);
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
38
|
+
const REDACTED = "[REDACTED]";
|
|
39
|
+
/**
|
|
40
|
+
* Replace credential-shaped substrings inside a single string. Useful
|
|
41
|
+
* for error messages and load-failure texts where the value is a flat
|
|
42
|
+
* string rather than a structured object.
|
|
43
|
+
*
|
|
44
|
+
* Replaces:
|
|
45
|
+
* - Bearer authorization values (any case).
|
|
46
|
+
* - x-api-key assignments (any case; `=`, `:`, or whitespace as the
|
|
47
|
+
* key/value separator — covers both `x-api-key=value` and
|
|
48
|
+
* `x-api-key value`).
|
|
49
|
+
* - Z_AI_API_KEY, ZAI_API_KEY, MINIMAX_API_KEY assignments.
|
|
50
|
+
* - The literal credentials passed in `extraSecrets` (each value is
|
|
51
|
+
* replaced wherever it appears; empty strings are skipped).
|
|
52
|
+
*/
|
|
53
|
+
export function redactCredentialString(input, extraSecrets) {
|
|
54
|
+
if (typeof input !== "string")
|
|
55
|
+
return input;
|
|
56
|
+
let result = input;
|
|
57
|
+
result = result.replace(/Bearer\s+\S+/gi, REDACTED);
|
|
58
|
+
// Fixup C — W3: the class accepts either `=`, `:`, or any whitespace
|
|
59
|
+
// as the key/value separator. The trailing `\S+` consumes the secret
|
|
60
|
+
// value; the entire `key + separator + value` span is replaced with
|
|
61
|
+
// the redaction marker.
|
|
62
|
+
result = result.replace(/x-api-key[\s=:]+[^\s,;"'`]+/gi, REDACTED);
|
|
63
|
+
result = result.replace(/Z_AI_API_KEY\s*=\s*\S+/gi, REDACTED);
|
|
64
|
+
result = result.replace(/ZAI_API_KEY\s*=\s*\S+/gi, REDACTED);
|
|
65
|
+
result = result.replace(/MINIMAX_API_KEY\s*=\s*\S+/gi, REDACTED);
|
|
66
|
+
// Embedded credential substrings inside URLs, e.g.
|
|
67
|
+
// `https://user:secret@host/path`. Catches both `https://` and
|
|
68
|
+
// `http://` schemes and replaces the entire URL with the marker so
|
|
69
|
+
// the user info does not leak.
|
|
70
|
+
result = result.replace(/https?:\/\/[^\s/:]+:[^\s@\/]+@[^\s/]+/gi, REDACTED);
|
|
71
|
+
const secrets = normalizeSecrets(extraSecrets);
|
|
72
|
+
for (const secret of secrets) {
|
|
73
|
+
if (secret.length === 0)
|
|
74
|
+
continue;
|
|
75
|
+
// Escape regex meta characters so a secret containing characters
|
|
76
|
+
// like `.` or `+` does not accidentally broaden the replacement.
|
|
77
|
+
const escaped = secret.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
78
|
+
result = result.replace(new RegExp(escaped, "g"), REDACTED);
|
|
21
79
|
}
|
|
22
80
|
return result;
|
|
23
81
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
82
|
+
/**
|
|
83
|
+
* Normalise the `secrets` argument to a deduplicated array of
|
|
84
|
+
* non-empty strings. A `undefined` argument yields an empty list;
|
|
85
|
+
* a single string yields `[string]`; an array yields the filtered
|
|
86
|
+
* list.
|
|
87
|
+
*/
|
|
88
|
+
function normalizeSecrets(secrets) {
|
|
89
|
+
if (secrets === undefined)
|
|
90
|
+
return [];
|
|
91
|
+
const list = Array.isArray(secrets) ? secrets : [secrets];
|
|
92
|
+
const out = [];
|
|
93
|
+
const seen = new Set();
|
|
94
|
+
for (const item of list) {
|
|
95
|
+
if (typeof item !== "string")
|
|
96
|
+
continue;
|
|
97
|
+
if (item.length === 0)
|
|
98
|
+
continue;
|
|
99
|
+
if (seen.has(item))
|
|
100
|
+
continue;
|
|
101
|
+
seen.add(item);
|
|
102
|
+
out.push(item);
|
|
103
|
+
}
|
|
104
|
+
return out;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Resolve the configured Provider credential values from the current
|
|
108
|
+
* process environment. Returned values are deduplicated and empty
|
|
109
|
+
* entries skipped, so callers can pass the result directly to
|
|
110
|
+
* {@link redactSecrets}.
|
|
111
|
+
*/
|
|
112
|
+
export function configuredSecrets(env = process.env) {
|
|
113
|
+
const candidates = [
|
|
114
|
+
env.Z_AI_API_KEY,
|
|
115
|
+
env.ZAI_API_KEY,
|
|
116
|
+
env.MINIMAX_API_KEY,
|
|
117
|
+
];
|
|
118
|
+
return normalizeSecrets(candidates.filter((c) => typeof c === "string"));
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Recursively redact credential values from an arbitrary tree.
|
|
122
|
+
*
|
|
123
|
+
* Accepts either a single string (back-compat overload) or an array of
|
|
124
|
+
* secret values. Returns a NEW value tree; the input is never mutated.
|
|
125
|
+
*
|
|
126
|
+
* Key matching is case-insensitive over {@link CREDENTIAL_KEYS}. Plain
|
|
127
|
+
* objects and arrays are descended into. Other object kinds (Date,
|
|
128
|
+
* typed arrays, class instances) are returned as-is so their internal
|
|
129
|
+
* state is not reflected.
|
|
130
|
+
*/
|
|
131
|
+
export function redactSecrets(value, secrets) {
|
|
132
|
+
const normalized = normalizeSecrets(secrets);
|
|
133
|
+
// Fast path: primitive value or null/undefined.
|
|
134
|
+
if (value === null || value === undefined)
|
|
135
|
+
return value;
|
|
136
|
+
const t = typeof value;
|
|
137
|
+
if (t === "string") {
|
|
138
|
+
return redactCredentialString(value, normalized);
|
|
27
139
|
}
|
|
140
|
+
if (t !== "object")
|
|
141
|
+
return value;
|
|
142
|
+
// Recurse through arrays.
|
|
28
143
|
if (Array.isArray(value)) {
|
|
29
|
-
return value.map((item) => redactSecrets(item,
|
|
144
|
+
return value.map((item) => redactSecrets(item, normalized));
|
|
30
145
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
146
|
+
// Skip exotic non-plain objects: Date, TypedArrays, Map, Set,
|
|
147
|
+
// class instances. Plain objects descend; everything else is left
|
|
148
|
+
// untouched to avoid reflecting internal state.
|
|
149
|
+
if (!isPlainObject(value)) {
|
|
150
|
+
return value;
|
|
151
|
+
}
|
|
152
|
+
const input = value;
|
|
153
|
+
const output = {};
|
|
154
|
+
for (const key of Object.keys(input)) {
|
|
155
|
+
if (CREDENTIAL_KEYS.has(key.toLowerCase())) {
|
|
156
|
+
output[key] = REDACTED;
|
|
157
|
+
continue;
|
|
40
158
|
}
|
|
41
|
-
|
|
159
|
+
output[key] = redactSecrets(input[key], normalized);
|
|
42
160
|
}
|
|
43
|
-
return
|
|
161
|
+
return output;
|
|
162
|
+
}
|
|
163
|
+
function isPlainObject(value) {
|
|
164
|
+
if (value === null || typeof value !== "object")
|
|
165
|
+
return false;
|
|
166
|
+
const proto = Object.getPrototypeOf(value);
|
|
167
|
+
return proto === Object.prototype || proto === null;
|
|
44
168
|
}
|
|
45
|
-
|
|
46
|
-
|
|
169
|
+
/**
|
|
170
|
+
* Redact credential-shaped fields from a Tool's metadata tree.
|
|
171
|
+
*
|
|
172
|
+
* Back-compat: when called with a single argument the function reads
|
|
173
|
+
* the configured Provider credentials from the current process
|
|
174
|
+
* environment. When called with an explicit secrets argument, the
|
|
175
|
+
* caller's value is used instead.
|
|
176
|
+
*/
|
|
177
|
+
export function redactTool(tool, secrets) {
|
|
178
|
+
const resolved = secrets === undefined
|
|
179
|
+
? configuredSecrets()
|
|
180
|
+
: normalizeSecrets(secrets);
|
|
47
181
|
const clone = JSON.parse(JSON.stringify(tool));
|
|
48
|
-
return redactSecrets(clone,
|
|
182
|
+
return redactSecrets(clone, resolved);
|
|
49
183
|
}
|
|
50
184
|
//# sourceMappingURL=redact.js.map
|
package/dist/lib/redact.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"redact.js","sourceRoot":"","sources":["../../src/lib/redact.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"redact.js","sourceRoot":"","sources":["../../src/lib/redact.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAIH;;;;GAIG;AACH,MAAM,eAAe,GAAwB,IAAI,GAAG,CAAC;IACnD,eAAe;IACf,WAAW;IACX,SAAS;IACT,QAAQ;IACR,cAAc;IACd,OAAO;IACP,cAAc;IACd,aAAa;IACb,iBAAiB;CACl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AACtD,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,UAAU,CAAC,IAAU,EAAE,OAA2B;IAChE,MAAM,QAAQ,GAAG,OAAO,KAAK,SAAS;QACpC,CAAC,CAAC,iBAAiB,EAAE;QACrB,CAAC,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;IAC9B,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAS,CAAC;IACvD,OAAO,aAAa,CAAC,KAAK,EAAE,QAAQ,CAAS,CAAC;AAChD,CAAC"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool-discovery cache — extracted from {@link ZaiMcpClient} (Ticket 02).
|
|
3
|
+
*
|
|
4
|
+
* Owns its filesystem I/O directly against the `tools/` subdirectory
|
|
5
|
+
* under the unified cache root (D1 revised — does NOT reuse
|
|
6
|
+
* `ResponseCache` for storage). Stores {@link redactTool}-scrubbed tools
|
|
7
|
+
* (B2 fix) under a single TTL check (H2 fix).
|
|
8
|
+
*
|
|
9
|
+
* # Enable check (preserves v0.4.0 granularity — D3 deviation)
|
|
10
|
+
*
|
|
11
|
+
* ```text
|
|
12
|
+
* isToolCacheEnabled = isCacheEnabled() && ZAI_MCP_TOOL_CACHE != "0"/"false"
|
|
13
|
+
* ```
|
|
14
|
+
*
|
|
15
|
+
* - `SCOUTLINE_CACHE=0` (or legacy `ZAI_CACHE=0`) disables BOTH caches
|
|
16
|
+
* because `isCacheEnabled()` returns false.
|
|
17
|
+
* - `ZAI_MCP_TOOL_CACHE=0` disables ONLY the tool cache; the response
|
|
18
|
+
* cache stays enabled because `isCacheEnabled()` does NOT consult
|
|
19
|
+
* this var. This preserves the four `mcp-client.test.js` suites that
|
|
20
|
+
* set `ZAI_MCP_TOOL_CACHE=0` per-suite while relying on
|
|
21
|
+
* response-cache hits.
|
|
22
|
+
*
|
|
23
|
+
* # Versioning
|
|
24
|
+
*
|
|
25
|
+
* {@link TOOL_CACHE_VERSION} is stamped into every cache envelope. A
|
|
26
|
+
* mismatch (e.g. an old `tools-*.json` written by a future or past
|
|
27
|
+
* release) yields a clean miss — never a throw — so an upgrade cannot
|
|
28
|
+
* break tool discovery.
|
|
29
|
+
*/
|
|
30
|
+
import type { Tool } from "@utcp/sdk";
|
|
31
|
+
/**
|
|
32
|
+
* Cache envelope version. Bumped when the on-disk shape of
|
|
33
|
+
* {@link ToolCachePayload} changes; old envelopes are ignored.
|
|
34
|
+
*/
|
|
35
|
+
export declare const TOOL_CACHE_VERSION = 1;
|
|
36
|
+
/**
|
|
37
|
+
* Inputs to the tool-cache key. Captures every dimension that affects
|
|
38
|
+
* WHICH tools the MCP servers return: mode + baseUrl (ZAI vs ZHIPU),
|
|
39
|
+
* the three HTTP endpoints, and whether the stdio vision server is
|
|
40
|
+
* registered. The ZaiMcpClient adapter builds this from {@link loadConfig}
|
|
41
|
+
* + {@link getMcpEndpoints} + its private `resolveEnableVision()`.
|
|
42
|
+
*/
|
|
43
|
+
export interface ToolCacheConfig {
|
|
44
|
+
mode: string;
|
|
45
|
+
baseUrl: string;
|
|
46
|
+
endpoints: Record<string, string>;
|
|
47
|
+
enableVision: boolean;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Tool-cache enable check (preserves v0.4.0 granularity — D3
|
|
51
|
+
* deviation). The tool cache is enabled only when BOTH:
|
|
52
|
+
* - the response cache is enabled (`isCacheEnabled()` honours
|
|
53
|
+
* `SCOUTLINE_CACHE` / `ZAI_CACHE`); AND
|
|
54
|
+
* - the tool-specific `ZAI_MCP_TOOL_CACHE` env var is not "0"/"false".
|
|
55
|
+
*
|
|
56
|
+
* Read at call time (H1 fix) so per-suite env mutations in tests remain
|
|
57
|
+
* observable.
|
|
58
|
+
*/
|
|
59
|
+
export declare function isToolCacheEnabled(): boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Build the 16-char cache key for a config. Mirrors the v0.4.0 algorithm
|
|
62
|
+
* in the extracted `ZaiMcpClient.getToolCacheKey`: SHA-256 of the
|
|
63
|
+
* JSON-stringified config, first 16 hex chars. Two configs that produce
|
|
64
|
+
* the same JSON yield the same key; distinct configs yield distinct keys.
|
|
65
|
+
*/
|
|
66
|
+
export declare function buildToolCacheKey(config: ToolCacheConfig): string;
|
|
67
|
+
/**
|
|
68
|
+
* Build the absolute on-disk path for a config's tool-cache envelope.
|
|
69
|
+
* Always lands under the `tools/` subdirectory (sibling of `cache/`).
|
|
70
|
+
*/
|
|
71
|
+
export declare function buildToolCachePath(config: ToolCacheConfig): string;
|
|
72
|
+
/**
|
|
73
|
+
* Read the tool cache for a config. Returns `null` on miss, version
|
|
74
|
+
* mismatch, TTL expiry, corruption (invalid JSON, missing file), or when
|
|
75
|
+
* the tool cache is disabled. NEVER throws — a miss degrades cleanly to
|
|
76
|
+
* discovery.
|
|
77
|
+
*/
|
|
78
|
+
export declare function readToolCache(config: ToolCacheConfig): Promise<Tool[] | null>;
|
|
79
|
+
/**
|
|
80
|
+
* Write the tool cache for a config. Applies {@link redactTool} to every
|
|
81
|
+
* tool before serialization (B2 fix) so the on-disk envelope never
|
|
82
|
+
* contains raw Provider credentials. Best-effort: I/O failures are
|
|
83
|
+
* swallowed (cache is disposable).
|
|
84
|
+
*/
|
|
85
|
+
export declare function writeToolCache(config: ToolCacheConfig, tools: Tool[]): Promise<void>;
|
|
86
|
+
//# sourceMappingURL=tool-cache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-cache.d.ts","sourceRoot":"","sources":["../../src/lib/tool-cache.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAKH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAItC;;;GAGG;AACH,eAAO,MAAM,kBAAkB,IAAI,CAAC;AAEpC;;;;;;GAMG;AACH,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClC,YAAY,EAAE,OAAO,CAAC;CACvB;AAQD;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,IAAI,OAAO,CAI5C;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,eAAe,GAAG,MAAM,CAEjE;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,eAAe,GAAG,MAAM,CAElE;AAED;;;;;GAKG;AACH,wBAAsB,aAAa,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,CAenF;AAED;;;;;GAKG;AACH,wBAAsB,cAAc,CAAC,MAAM,EAAE,eAAe,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAe1F"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool-discovery cache — extracted from {@link ZaiMcpClient} (Ticket 02).
|
|
3
|
+
*
|
|
4
|
+
* Owns its filesystem I/O directly against the `tools/` subdirectory
|
|
5
|
+
* under the unified cache root (D1 revised — does NOT reuse
|
|
6
|
+
* `ResponseCache` for storage). Stores {@link redactTool}-scrubbed tools
|
|
7
|
+
* (B2 fix) under a single TTL check (H2 fix).
|
|
8
|
+
*
|
|
9
|
+
* # Enable check (preserves v0.4.0 granularity — D3 deviation)
|
|
10
|
+
*
|
|
11
|
+
* ```text
|
|
12
|
+
* isToolCacheEnabled = isCacheEnabled() && ZAI_MCP_TOOL_CACHE != "0"/"false"
|
|
13
|
+
* ```
|
|
14
|
+
*
|
|
15
|
+
* - `SCOUTLINE_CACHE=0` (or legacy `ZAI_CACHE=0`) disables BOTH caches
|
|
16
|
+
* because `isCacheEnabled()` returns false.
|
|
17
|
+
* - `ZAI_MCP_TOOL_CACHE=0` disables ONLY the tool cache; the response
|
|
18
|
+
* cache stays enabled because `isCacheEnabled()` does NOT consult
|
|
19
|
+
* this var. This preserves the four `mcp-client.test.js` suites that
|
|
20
|
+
* set `ZAI_MCP_TOOL_CACHE=0` per-suite while relying on
|
|
21
|
+
* response-cache hits.
|
|
22
|
+
*
|
|
23
|
+
* # Versioning
|
|
24
|
+
*
|
|
25
|
+
* {@link TOOL_CACHE_VERSION} is stamped into every cache envelope. A
|
|
26
|
+
* mismatch (e.g. an old `tools-*.json` written by a future or past
|
|
27
|
+
* release) yields a clean miss — never a throw — so an upgrade cannot
|
|
28
|
+
* break tool discovery.
|
|
29
|
+
*/
|
|
30
|
+
import crypto from "node:crypto";
|
|
31
|
+
import * as fs from "node:fs/promises";
|
|
32
|
+
import path from "node:path";
|
|
33
|
+
import { toolCacheDir, isCacheEnabled, getCacheTtlMs } from "./cache.js";
|
|
34
|
+
import { redactTool } from "./redact.js";
|
|
35
|
+
/**
|
|
36
|
+
* Cache envelope version. Bumped when the on-disk shape of
|
|
37
|
+
* {@link ToolCachePayload} changes; old envelopes are ignored.
|
|
38
|
+
*/
|
|
39
|
+
export const TOOL_CACHE_VERSION = 1;
|
|
40
|
+
/**
|
|
41
|
+
* Tool-cache enable check (preserves v0.4.0 granularity — D3
|
|
42
|
+
* deviation). The tool cache is enabled only when BOTH:
|
|
43
|
+
* - the response cache is enabled (`isCacheEnabled()` honours
|
|
44
|
+
* `SCOUTLINE_CACHE` / `ZAI_CACHE`); AND
|
|
45
|
+
* - the tool-specific `ZAI_MCP_TOOL_CACHE` env var is not "0"/"false".
|
|
46
|
+
*
|
|
47
|
+
* Read at call time (H1 fix) so per-suite env mutations in tests remain
|
|
48
|
+
* observable.
|
|
49
|
+
*/
|
|
50
|
+
export function isToolCacheEnabled() {
|
|
51
|
+
if (!isCacheEnabled())
|
|
52
|
+
return false;
|
|
53
|
+
const v = (process.env.ZAI_MCP_TOOL_CACHE ?? "1").toLowerCase();
|
|
54
|
+
return !["0", "false"].includes(v);
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Build the 16-char cache key for a config. Mirrors the v0.4.0 algorithm
|
|
58
|
+
* in the extracted `ZaiMcpClient.getToolCacheKey`: SHA-256 of the
|
|
59
|
+
* JSON-stringified config, first 16 hex chars. Two configs that produce
|
|
60
|
+
* the same JSON yield the same key; distinct configs yield distinct keys.
|
|
61
|
+
*/
|
|
62
|
+
export function buildToolCacheKey(config) {
|
|
63
|
+
return crypto.createHash("sha256").update(JSON.stringify(config)).digest("hex").slice(0, 16);
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Build the absolute on-disk path for a config's tool-cache envelope.
|
|
67
|
+
* Always lands under the `tools/` subdirectory (sibling of `cache/`).
|
|
68
|
+
*/
|
|
69
|
+
export function buildToolCachePath(config) {
|
|
70
|
+
return path.join(toolCacheDir(), `tools-${buildToolCacheKey(config)}.json`);
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Read the tool cache for a config. Returns `null` on miss, version
|
|
74
|
+
* mismatch, TTL expiry, corruption (invalid JSON, missing file), or when
|
|
75
|
+
* the tool cache is disabled. NEVER throws — a miss degrades cleanly to
|
|
76
|
+
* discovery.
|
|
77
|
+
*/
|
|
78
|
+
export async function readToolCache(config) {
|
|
79
|
+
if (!isToolCacheEnabled())
|
|
80
|
+
return null;
|
|
81
|
+
const ttlMs = getCacheTtlMs();
|
|
82
|
+
if (ttlMs <= 0)
|
|
83
|
+
return null;
|
|
84
|
+
try {
|
|
85
|
+
const raw = await fs.readFile(buildToolCachePath(config), "utf8");
|
|
86
|
+
const entry = JSON.parse(raw);
|
|
87
|
+
if (!entry || entry.version !== TOOL_CACHE_VERSION || !Array.isArray(entry.tools)) {
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
if (Date.now() - (entry.timestamp ?? 0) > ttlMs)
|
|
91
|
+
return null;
|
|
92
|
+
return entry.tools;
|
|
93
|
+
}
|
|
94
|
+
catch {
|
|
95
|
+
return null;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Write the tool cache for a config. Applies {@link redactTool} to every
|
|
100
|
+
* tool before serialization (B2 fix) so the on-disk envelope never
|
|
101
|
+
* contains raw Provider credentials. Best-effort: I/O failures are
|
|
102
|
+
* swallowed (cache is disposable).
|
|
103
|
+
*/
|
|
104
|
+
export async function writeToolCache(config, tools) {
|
|
105
|
+
if (!isToolCacheEnabled())
|
|
106
|
+
return;
|
|
107
|
+
if (getCacheTtlMs() <= 0)
|
|
108
|
+
return;
|
|
109
|
+
try {
|
|
110
|
+
const filePath = buildToolCachePath(config);
|
|
111
|
+
await fs.mkdir(path.dirname(filePath), { recursive: true });
|
|
112
|
+
const payload = {
|
|
113
|
+
version: TOOL_CACHE_VERSION,
|
|
114
|
+
timestamp: Date.now(),
|
|
115
|
+
tools: tools.map((tool) => redactTool(tool)),
|
|
116
|
+
};
|
|
117
|
+
await fs.writeFile(filePath, JSON.stringify(payload));
|
|
118
|
+
}
|
|
119
|
+
catch {
|
|
120
|
+
// Best-effort cache only.
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
//# sourceMappingURL=tool-cache.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-cache.js","sourceRoot":"","sources":["../../src/lib/tool-cache.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AACzE,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC;AAsBpC;;;;;;;;;GASG;AACH,MAAM,UAAU,kBAA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ClF,OAAO,IAAI,CAAC;QACd,CAAC;QACD,IAAI,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,KAAK,CAAC,SAAS,IAAI,CAAC,CAAC,GAAG,KAAK;YAAE,OAAO,IAAI,CAAC;QAC7D,OAAO,KAAK,CAAC,KAAK,CAAC;IACrB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,MAAuB,EAAE,KAAa;IACzE,IAAI,CAAC,kBAAkB,EAAE;QAAE,OAAO;IAClC,IAAI,aAAa,EAAE,IAAI,CAAC;QAAE,OAAO;IACjC,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,kBAAkB,CAAC,MAAM,CAAC,CAAC;QAC5C,MAAM,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAC5D,MAAM,OAAO,GAAqB;YAChC,OAAO,EAAE,kBAAkB;YAC3B,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;YACrB,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;SAC7C,CAAC;QACF,MAAM,EAAE,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC;IACxD,CAAC;IAAC,MAAM,CAAC;QACP,0BAA0B;IAC5B,CAAC;AACH,CAAC"}
|
package/dist/lib/tty.d.ts
CHANGED
|
@@ -36,25 +36,12 @@ interface SearchResultLike {
|
|
|
36
36
|
occurrences?: number;
|
|
37
37
|
}
|
|
38
38
|
export declare function formatSearchResultsPretty(results: SearchResultLike[]): string;
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
windowHours?: number;
|
|
47
|
-
resetsIn?: string | null;
|
|
48
|
-
byTool?: Array<{
|
|
49
|
-
modelCode?: string;
|
|
50
|
-
usage?: number;
|
|
51
|
-
}>;
|
|
52
|
-
} | null;
|
|
53
|
-
tokens?: {
|
|
54
|
-
percentage?: number;
|
|
55
|
-
resetsIn?: string | null;
|
|
56
|
-
} | null;
|
|
57
|
-
}
|
|
58
|
-
export declare function formatQuotaPretty(q: QuotaLike): string;
|
|
39
|
+
import type { QuotaDashboard } from "../capabilities/quota.js";
|
|
40
|
+
/**
|
|
41
|
+
* Provider-neutral TTY rendering of a {@link QuotaDashboard}. Each
|
|
42
|
+
* Provider entry is labelled with its Provider id and each category by
|
|
43
|
+
* its normalized name; progress bars represent the REMAINING percentage.
|
|
44
|
+
*/
|
|
45
|
+
export declare function formatQuotaDashboard(dashboard: QuotaDashboard): string;
|
|
59
46
|
export {};
|
|
60
47
|
//# sourceMappingURL=tty.d.ts.map
|
package/dist/lib/tty.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tty.d.ts","sourceRoot":"","sources":["../../src/lib/tty.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,KAAK,OAAO,GAAG,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;AAUrC,eAAO,MAAM,KAAK;IAChB,IAAI;IACJ,GAAG;IACH,IAAI;IACJ,KAAK;IACL,MAAM;IACN,GAAG;IACH,OAAO;IACP,IAAI;CACL,CAAC;AAEF,wBAAgB,KAAK,IAAI,OAAO,CAE/B;AAED,uFAAuF;AACvF,wBAAgB,cAAc,CAC5B,cAAc,EAAE,MAAM,GAAG,SAAS,EAClC,IAAI,EAAE;IAAE,WAAW,CAAC,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,GAClD,KAAK,GAAG,SAAS,CAKnB;AAED,UAAU,gBAAgB;IACxB,IAAI,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AAE,MAAM,0BAA0B,CAAC;AAsE/D;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,cAAc,GAAG,MAAM,CAkBtE"}
|
package/dist/lib/tty.js
CHANGED
|
@@ -60,42 +60,63 @@ export function formatSearchResultsPretty(results) {
|
|
|
60
60
|
}
|
|
61
61
|
return lines.join("\n");
|
|
62
62
|
}
|
|
63
|
-
/**
|
|
64
|
-
|
|
63
|
+
/**
|
|
64
|
+
* Remaining-percentage progress bar: 20 chars wide. Low remaining is
|
|
65
|
+
* red (tight quota), high remaining is green. The bar represents the
|
|
66
|
+
* REMAINING share, not the used share.
|
|
67
|
+
*/
|
|
68
|
+
function remainingBar(pct) {
|
|
65
69
|
const filled = Math.round((pct / 100) * 20);
|
|
66
70
|
const bar = "█".repeat(filled) + "░".repeat(20 - filled);
|
|
67
|
-
const colorFn = pct
|
|
71
|
+
const colorFn = pct < 30 ? color.red : pct < 70 ? color.yellow : color.green;
|
|
68
72
|
return colorFn(bar);
|
|
69
73
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
74
|
+
function formatResetLabel(resetsAt) {
|
|
75
|
+
if (!resetsAt)
|
|
76
|
+
return "";
|
|
77
|
+
return `resets ${color.gray(resetsAt)}`;
|
|
78
|
+
}
|
|
79
|
+
function renderCategory(category, lines) {
|
|
80
|
+
const current = category.current;
|
|
81
|
+
const pct = current.remainingPercent;
|
|
82
|
+
const resetTxt = formatResetLabel(current.resetsAt);
|
|
83
|
+
lines.push(` ${color.bold(category.name)} ${remainingBar(pct)} ${pct}% remaining`);
|
|
84
|
+
const counts = [];
|
|
85
|
+
if (typeof current.used === "number" && typeof current.limit === "number") {
|
|
86
|
+
counts.push(`${current.used}/${current.limit}`);
|
|
87
|
+
}
|
|
88
|
+
if (typeof current.remaining === "number") {
|
|
89
|
+
counts.push(`${color.green(`${current.remaining} left`)}`);
|
|
90
|
+
}
|
|
91
|
+
if (counts.length > 0 || resetTxt) {
|
|
92
|
+
lines.push(` ${[...counts, resetTxt].filter(Boolean).join(" · ")}`);
|
|
93
|
+
}
|
|
94
|
+
if (category.weekly) {
|
|
95
|
+
const w = category.weekly;
|
|
96
|
+
lines.push(` ${color.gray("weekly")} ${remainingBar(w.remainingPercent)} ${w.remainingPercent}%`);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Provider-neutral TTY rendering of a {@link QuotaDashboard}. Each
|
|
101
|
+
* Provider entry is labelled with its Provider id and each category by
|
|
102
|
+
* its normalized name; progress bars represent the REMAINING percentage.
|
|
103
|
+
*/
|
|
104
|
+
export function formatQuotaDashboard(dashboard) {
|
|
105
|
+
const lines = [""];
|
|
106
|
+
for (const entry of dashboard.providers) {
|
|
107
|
+
if (entry.status === "ok") {
|
|
108
|
+
const success = entry;
|
|
109
|
+
const planTxt = success.plan ? ` ${color.gray(`(${success.plan})`)}` : "";
|
|
110
|
+
lines.push(` ${color.bold(success.provider)}${planTxt}`);
|
|
111
|
+
for (const category of success.categories) {
|
|
112
|
+
renderCategory(category, lines);
|
|
90
113
|
}
|
|
91
114
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
lines.push(` ${color.bold("Token budget")} ${resetTxt}`);
|
|
98
|
-
lines.push(` ${progressBar(pct)} ${pct}% used`);
|
|
115
|
+
else {
|
|
116
|
+
const failure = entry;
|
|
117
|
+
lines.push(` ${color.bold(failure.provider)} ${color.red("error")}`);
|
|
118
|
+
lines.push(` ${color.dim(failure.error.message)}`);
|
|
119
|
+
}
|
|
99
120
|
lines.push("");
|
|
100
121
|
}
|
|
101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