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/README.md
CHANGED
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
- **Repo** - Search and read GitHub repository code via ZRead
|
|
22
22
|
- **Tools** - MCP tool discovery, schemas, and raw calls
|
|
23
23
|
- **Code Mode** - TypeScript tool chaining for agent automation
|
|
24
|
+
- **Provider selection** - Run shared capabilities through Z.AI or MiniMax Token Plan
|
|
24
25
|
|
|
25
26
|
## Quick Start
|
|
26
27
|
|
|
@@ -32,7 +33,14 @@ npx scoutline vision analyze ./screenshot.png "What errors do you see?"
|
|
|
32
33
|
npx scoutline search "React 19 new features" --count 5
|
|
33
34
|
```
|
|
34
35
|
|
|
35
|
-
Get your API key at: https://z.ai/manage-apikey/apikey-list
|
|
36
|
+
Get your Z.AI API key at: https://z.ai/manage-apikey/apikey-list
|
|
37
|
+
|
|
38
|
+
To use MiniMax instead:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
export MINIMAX_API_KEY="your-minimax-key"
|
|
42
|
+
npx scoutline --provider minimax search "latest LLM benchmarks"
|
|
43
|
+
```
|
|
36
44
|
|
|
37
45
|
## Installation
|
|
38
46
|
|
|
@@ -63,6 +71,134 @@ Or use directly with npx:
|
|
|
63
71
|
npx scoutline --help
|
|
64
72
|
```
|
|
65
73
|
|
|
74
|
+
## Provider Selection
|
|
75
|
+
|
|
76
|
+
Shared commands (`search`, `vision`, `quota`, `doctor`, `repo`) accept a global
|
|
77
|
+
`--provider <zai|minimax>` flag. Resolution precedence:
|
|
78
|
+
|
|
79
|
+
1. Explicit `--provider <zai|minimax>` on the command line
|
|
80
|
+
2. `SCOUTLINE_PROVIDER` environment variable
|
|
81
|
+
3. Compatibility default `zai`
|
|
82
|
+
|
|
83
|
+
Examples:
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
# 1. Flag wins over everything
|
|
87
|
+
scoutline --provider minimax search "React 19 features"
|
|
88
|
+
|
|
89
|
+
# 2. Environment variable when no flag is supplied
|
|
90
|
+
export SCOUTLINE_PROVIDER=minimax
|
|
91
|
+
scoutline quota
|
|
92
|
+
|
|
93
|
+
# 3. Default Z.AI when nothing is supplied
|
|
94
|
+
scoutline search "TypeScript best practices"
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Provider selection is **never** inferred from which credentials are present;
|
|
98
|
+
empty credentials leave the Provider unconfigured and shared capabilities will
|
|
99
|
+
fail with `AUTH_ERROR` or `CONFIGURATION_ERROR`. Unknown Provider IDs fail
|
|
100
|
+
fast with `VALIDATION_ERROR`.
|
|
101
|
+
|
|
102
|
+
`scoutline search`, `scoutline vision`, `scoutline quota`, `scoutline doctor`,
|
|
103
|
+
**`scoutline repo`**, and **`scoutline read`** participate in Provider
|
|
104
|
+
selection. `scoutline tools`, `scoutline tool`, `scoutline call`, and
|
|
105
|
+
`scoutline code` accept the flag but ignore it; they remain Z.AI-only.
|
|
106
|
+
MiniMax does not currently advertise the `repository-exploration` or `reader`
|
|
107
|
+
Capabilities — selecting MiniMax (explicitly or via `SCOUTLINE_PROVIDER`) for
|
|
108
|
+
any `repo` subcommand or for `read` returns `UNSUPPORTED_CAPABILITY` before
|
|
109
|
+
descriptor configuration, Adapter creation, cache identity, or transport
|
|
110
|
+
construction, with no Z.AI fallback.
|
|
111
|
+
|
|
112
|
+
## Capability Matrix
|
|
113
|
+
|
|
114
|
+
| Capability | Z.AI | MiniMax | Notes |
|
|
115
|
+
| --- | --- | --- | --- |
|
|
116
|
+
| `search` | Yes | Yes | MiniMax rejects domain/recency/content-size/location controls |
|
|
117
|
+
| `vision.interpret-image` (analyze) | Yes | Yes | Provider-specific media limits; uncached |
|
|
118
|
+
| `vision.ui-artifact` (ui-to-code) | Yes | Available | Live-attested; conformance-gated |
|
|
119
|
+
| `vision.extract-text` | Yes | Pending | Implemented, pending live conformance |
|
|
120
|
+
| `vision.diagnose-error` | Yes | Available | Live-attested; conformance-gated |
|
|
121
|
+
| `vision.diagram` | Yes | Pending | Implemented, pending live conformance |
|
|
122
|
+
| `vision.chart` | Yes | Pending | Implemented, pending live conformance |
|
|
123
|
+
| `vision.diff` (image diff) | Yes | No | Z.AI-only (never MiniMax-claimable) |
|
|
124
|
+
| `vision.video` | Yes | No | Z.AI-only (never MiniMax-claimable) |
|
|
125
|
+
| `quota` | Yes | Yes | Normalized `QuotaDashboard` (ADR-0001) |
|
|
126
|
+
| `diagnostics` (`doctor`) | Yes | Yes | Lists both Providers; probes configured |
|
|
127
|
+
| `read` (Reader) | Yes | **No** (UNSUPPORTED_CAPABILITY) | Participates in selection; only Z.AI supplies `reader` |
|
|
128
|
+
| `repo search` / `repo read` / `repo tree` | Yes | **No** (UNSUPPORTED_CAPABILITY) | Participates in selection; only Z.AI supplies `repository-exploration` |
|
|
129
|
+
| `tools`, `tool`, `call` (Raw tools) | Yes | No | Z.AI-only; accepts but ignores `--provider` |
|
|
130
|
+
| `code` (Code Mode) | Yes | No | Z.AI-only; accepts but ignores `--provider` |
|
|
131
|
+
|
|
132
|
+
Media limits for general single-image interpretation:
|
|
133
|
+
|
|
134
|
+
| Provider | Formats | Maximum |
|
|
135
|
+
| --- | --- | --- |
|
|
136
|
+
| Z.AI | JPG, JPEG, PNG | 5 MiB |
|
|
137
|
+
| MiniMax | JPG, JPEG, PNG, WebP | 50 MiB |
|
|
138
|
+
|
|
139
|
+
Vision results are never written to the local response cache.
|
|
140
|
+
|
|
141
|
+
### Specialized MiniMax Vision Mappings
|
|
142
|
+
|
|
143
|
+
The five specialized MiniMax Vision operations (`ui-artifact`,
|
|
144
|
+
`extract-text`, `diagnose-error`, `diagram`, `chart`) are **implemented**
|
|
145
|
+
in this release. Each operation has a dedicated prompt-composition Module
|
|
146
|
+
under `packages/scoutline/src/providers/minimax/vision-mappings/` and a
|
|
147
|
+
generated mapping revision committed to source.
|
|
148
|
+
|
|
149
|
+
Runtime support for these operations is gated by the compiled conformance
|
|
150
|
+
registry (`src/providers/minimax/vision-conformance.ts`). A specialized
|
|
151
|
+
operation is only routable through MiniMax when **every** condition holds:
|
|
152
|
+
|
|
153
|
+
- offline conformance state is `pass`,
|
|
154
|
+
- live conformance state is `pass`,
|
|
155
|
+
- a sanitized compiled attestation matches the operation, fixture version,
|
|
156
|
+
Implementation identity, and generated mapping revision.
|
|
157
|
+
|
|
158
|
+
In the current release, `ui-artifact` and `diagnose-error` have offline
|
|
159
|
+
`pass`, live `pass`, and compiled attestations — they are **supported at
|
|
160
|
+
runtime** through MiniMax. The remaining three operations (`extract-text`,
|
|
161
|
+
`diagram`, `chart`) have offline `pass` and live `pending`; they are
|
|
162
|
+
**unsupported at runtime** through MiniMax. Selecting MiniMax explicitly
|
|
163
|
+
for one of these operations fails closed with `UNSUPPORTED_CAPABILITY`
|
|
164
|
+
before credentials, media, transport, cache, or any other Provider is
|
|
165
|
+
touched (FR-023, FR-024). There is **no automatic Z.AI fallback** for an
|
|
166
|
+
explicit MiniMax selection — call without `--provider minimax` (or unset
|
|
167
|
+
`SCOUTLINE_PROVIDER`) to route through Z.AI instead.
|
|
168
|
+
|
|
169
|
+
No environment variable, flag, or configuration value can promote a
|
|
170
|
+
mapping to supported. Support is driven exclusively by the compiled
|
|
171
|
+
registry state.
|
|
172
|
+
|
|
173
|
+
#### Enabling live support
|
|
174
|
+
|
|
175
|
+
Live support is gated on a per-operation live attestation. The
|
|
176
|
+
attestation script requires explicit opt-in and `MINIMAX_API_KEY`:
|
|
177
|
+
|
|
178
|
+
```bash
|
|
179
|
+
SCOUTLINE_LIVE_TESTS=1 node scripts/attest-minimax-vision.mjs --operation chart
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
Replace `chart` with `ui-artifact`, `extract-text`, `diagnose-error`,
|
|
183
|
+
or `diagram`. The script runs one fixture against the live Provider,
|
|
184
|
+
evaluates the semantic assertions in memory, and either:
|
|
185
|
+
|
|
186
|
+
- writes a sanitized attestation entry to
|
|
187
|
+
`src/providers/minimax/vision-attestations.ts`, flips the registry's
|
|
188
|
+
`live` state to `pass`, and verifies runtime support becomes `true`;
|
|
189
|
+
OR
|
|
190
|
+
- sets the registry's `live` state to `fail` if the semantics do not
|
|
191
|
+
hold. No success attestation is written and the mapping remains
|
|
192
|
+
unsupported.
|
|
193
|
+
|
|
194
|
+
The next `npm run build` recompiles the registry with the new
|
|
195
|
+
attestation and the operation becomes routable through MiniMax.
|
|
196
|
+
|
|
197
|
+
Help text, `doctor`, and the Adapter's descriptor metadata all derive
|
|
198
|
+
from the same registry, so once a mapping is promoted it appears on
|
|
199
|
+
every runtime surface automatically — there is no second support list
|
|
200
|
+
to update.
|
|
201
|
+
|
|
66
202
|
## Usage
|
|
67
203
|
|
|
68
204
|
The CLI is self-documenting. Use `--help` at any level:
|
|
@@ -72,11 +208,18 @@ scoutline --help # All commands
|
|
|
72
208
|
scoutline vision --help # Vision commands
|
|
73
209
|
scoutline search --help # Search options
|
|
74
210
|
scoutline repo --help # GitHub repo commands
|
|
211
|
+
scoutline doctor --help # Provider diagnostics
|
|
212
|
+
scoutline quota --help # Plan usage
|
|
213
|
+
scoutline cache --help # Local cache inspection and clearing
|
|
75
214
|
```
|
|
76
215
|
|
|
77
216
|
### Examples
|
|
78
217
|
|
|
79
218
|
```bash
|
|
219
|
+
# Provider selection
|
|
220
|
+
scoutline --provider minimax search "AI policy news"
|
|
221
|
+
scoutline --provider zai search "internal docs"
|
|
222
|
+
|
|
80
223
|
# Vision - analyze images
|
|
81
224
|
scoutline vision analyze ./image.png "Describe this"
|
|
82
225
|
scoutline vision ui-to-code ./design.png --output code
|
|
@@ -98,9 +241,18 @@ scoutline repo read anthropics/anthropic-sdk-python README.md
|
|
|
98
241
|
scoutline repo search openai/codex "config" --language en
|
|
99
242
|
scoutline repo tree openai/codex --path codex-rs --depth 2
|
|
100
243
|
|
|
244
|
+
# Quota - effective or all providers
|
|
245
|
+
scoutline quota # effective Provider
|
|
246
|
+
scoutline quota --all-providers # every configured Provider
|
|
247
|
+
|
|
101
248
|
# Doctor - check setup
|
|
102
|
-
scoutline doctor
|
|
103
|
-
scoutline doctor --no-
|
|
249
|
+
scoutline doctor # full diagnostics
|
|
250
|
+
scoutline doctor --no-tools # metadata only, no transport
|
|
251
|
+
scoutline doctor --provider minimax # MiniMax connectivity
|
|
252
|
+
|
|
253
|
+
# Cache - inspect or clear the local cache
|
|
254
|
+
scoutline cache stats # show inventory of both subdirectories
|
|
255
|
+
scoutline cache clear # delete every file under cache/ and tools/
|
|
104
256
|
```
|
|
105
257
|
|
|
106
258
|
## Output Format
|
|
@@ -115,14 +267,249 @@ Default output is **data-only** for token efficiency. Use `--output-format json`
|
|
|
115
267
|
}
|
|
116
268
|
```
|
|
117
269
|
|
|
270
|
+
Quota output is a schema-version-1 `QuotaDashboard`:
|
|
271
|
+
|
|
272
|
+
```json
|
|
273
|
+
{
|
|
274
|
+
"schemaVersion": 1,
|
|
275
|
+
"effectiveProvider": "zai",
|
|
276
|
+
"providers": [
|
|
277
|
+
{
|
|
278
|
+
"provider": "zai",
|
|
279
|
+
"status": "ok",
|
|
280
|
+
"categories": [
|
|
281
|
+
{ "name": "requests", "unit": "requests", "current": { "remainingPercent": 87.5 } },
|
|
282
|
+
{ "name": "tokens", "unit": "tokens", "current": { "remainingPercent": 64.2 } }
|
|
283
|
+
]
|
|
284
|
+
}
|
|
285
|
+
]
|
|
286
|
+
}
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
Doctor output is a schema-version-1 `DiagnosticsReport` listing every built-in
|
|
290
|
+
Provider with its configured state, declared capabilities, probe status, and a
|
|
291
|
+
one-line cache summary under the `cache` field.
|
|
292
|
+
|
|
118
293
|
## Notes
|
|
119
294
|
|
|
120
295
|
- `repo search` defaults to English results. Use `--language zh` for Chinese.
|
|
121
296
|
- `repo tree` supports `--path` (directory scope) and `--depth` (expand subtrees).
|
|
122
|
-
- `
|
|
123
|
-
|
|
297
|
+
- `quota --all-providers` exits 1 if any configured Provider fails; successful
|
|
298
|
+
entries are still reported.
|
|
299
|
+
- `doctor` exits 1 when the effective Provider is unconfigured or any
|
|
300
|
+
configured probe fails; successful entries are still reported.
|
|
301
|
+
- `read` returns a schema-version-1 envelope (content read or extract read) in every output mode. `--with-images-summary`, `--no-gfm`, and `--keep-img-data-url` are passed through to the Provider request. `--max-chars` is ignored on extract reads; `--full-envelope` is silently deprecated.
|
|
124
302
|
- Vision tool calls automatically retry transient 5xx/network errors (default: 2 retries). Configure with `ZAI_MCP_VISION_RETRY_COUNT` (or `ZAI_MCP_RETRY_COUNT` for all tools).
|
|
125
|
-
- Tool discovery can be cached to speed `tools`/`tool`/`doctor` (default: on, 24h TTL).
|
|
303
|
+
- Tool discovery can be cached to speed `tools`/`tool`/`doctor` (default: on, 24h TTL). The cache shares the unified root with the response cache; configure both via `SCOUTLINE_CACHE`, `SCOUTLINE_CACHE_TTL_MS`, `SCOUTLINE_CACHE_SIZE_MB`, and `SCOUTLINE_CACHE_DIR` (legacy aliases `ZAI_MCP_TOOL_CACHE*`, `ZAI_MCP_CACHE_DIR`, and `ZAI_CACHE*` are accepted silently).
|
|
304
|
+
- The local cache lives at `~/.scoutline/` (`cache/` for responses, `tools/` for tool discovery) on every platform. Inspect or clear it with `scoutline cache stats` and `scoutline cache clear`.
|
|
305
|
+
|
|
306
|
+
## Repository Exploration (P6)
|
|
307
|
+
|
|
308
|
+
`scoutline repo search`, `scoutline repo read`, and `scoutline repo tree`
|
|
309
|
+
participate in `--provider` selection. Z.AI advertises the
|
|
310
|
+
`repository-exploration` Capability and supplies it through the Z.AI
|
|
311
|
+
Repository Adapter. MiniMax does not advertise it; selecting MiniMax returns
|
|
312
|
+
`UNSUPPORTED_CAPABILITY` before descriptor configuration, Adapter creation,
|
|
313
|
+
credential resolution for use, cache identity, or transport construction
|
|
314
|
+
with no fallback to Z.AI.
|
|
315
|
+
|
|
316
|
+
### Breaking data-mode migration (v0.2 → v1)
|
|
317
|
+
|
|
318
|
+
The three `repo` successes return **schema-version-1 structured values** in
|
|
319
|
+
every output mode. This is an intentional breaking change from the v0.2 raw
|
|
320
|
+
Search/File strings and the depth-dependent raw Tree shape:
|
|
321
|
+
|
|
322
|
+
| Command | v0.2 (legacy, now obsolete) | v1 (current) |
|
|
323
|
+
| --- | --- | --- |
|
|
324
|
+
| `repo search` | Raw ZRead text with `<excerpt>` blocks | `{schemaVersion, repository, query, language, excerpts:[{text}], truncated, originalTextLength}` |
|
|
325
|
+
| `repo read` | Raw `<file_content>…</file_content>` body | `{schemaVersion, repository, path, content, truncated, originalContentLength}` |
|
|
326
|
+
| `repo tree` | `<structure>` block (depth 1 returned split/deep routes) | `{schemaVersion, repository, path, depth, snapshots:[{repository, path, entries:[{name, path, kind}]}]}` (structured at every depth, including depth 1) |
|
|
327
|
+
|
|
328
|
+
`data` mode emits the exact object above. `json` and `pretty` wrap it through
|
|
329
|
+
the standard success envelope. Text-oriented modes (`compact`, `markdown`,
|
|
330
|
+
`refs`, `tty`) fall back to the JSON value because the command supplies no
|
|
331
|
+
prose presentation override.
|
|
332
|
+
|
|
333
|
+
**Scripting impact:** any consumer parsing v0.2 raw ZRead text or the v0.2
|
|
334
|
+
split/deep `tree` shape must switch to the v1 structured fields. The raw
|
|
335
|
+
`scoutline.zai.*` namespace remains available for callers that need the
|
|
336
|
+
legacy grammar; it is not wrapped in the v1 envelope.
|
|
337
|
+
|
|
338
|
+
### Canonical repository paths
|
|
339
|
+
|
|
340
|
+
- Tree aliases omitted, empty, `/`, or `.` normalize to the root path `""`.
|
|
341
|
+
- File paths must be non-root; the root is invalid for `repo read`.
|
|
342
|
+
- Leading `./` and leading `/` are accepted on File; leading and trailing `/`
|
|
343
|
+
are stripped and repeated `/` collapses on both.
|
|
344
|
+
- Actual `.`/`..` segments, backslashes, and ASCII control characters are
|
|
345
|
+
rejected. Percent escapes (`%XX`) are never decoded — they remain literal.
|
|
346
|
+
|
|
347
|
+
### `--max-chars` (deterministic, local)
|
|
348
|
+
|
|
349
|
+
`--max-chars` is **never** a summarization model call. It is presentation
|
|
350
|
+
projection applied to the normalized result after caching.
|
|
351
|
+
|
|
352
|
+
- Absent, zero, or negative → no truncation.
|
|
353
|
+
- `repo read` → truncates `content` with the existing ellipsis rule; preserves
|
|
354
|
+
the original length in `originalContentLength` and sets `truncated: true`.
|
|
355
|
+
- `repo search` → applies **one total budget** across `excerpts[].text` in
|
|
356
|
+
Provider order; the final retained excerpt is truncated and later excerpts
|
|
357
|
+
are omitted.
|
|
358
|
+
- `repo tree` → never character-limited.
|
|
359
|
+
- Metadata, JSON envelopes, and Tree snapshots are not part of the budget.
|
|
360
|
+
|
|
361
|
+
### Empty results
|
|
362
|
+
|
|
363
|
+
A future Provider Adapter may explicitly return an empty `excerpts`/`entries`
|
|
364
|
+
array when its own contract distinguishes a valid empty state. The Z.AI
|
|
365
|
+
Adapter requires at least one well-formed `<excerpt>` block per Search;
|
|
366
|
+
unwrapped text is malformed and surfaces as a normalized `API_ERROR 502`, not
|
|
367
|
+
as an empty success. An empty ZRead structure without `entries` is malformed
|
|
368
|
+
the same way.
|
|
369
|
+
|
|
370
|
+
### Cache continuity
|
|
371
|
+
|
|
372
|
+
Repository results use a new key shape
|
|
373
|
+
`v2.repository-exploration-<op>.<provider>.<credential-hash>.<request-hash>.json`.
|
|
374
|
+
The credential hash is supplied by the Adapter (full lowercase SHA-256 hex
|
|
375
|
+
digest of the active credential) and is never re-hashed by cache code.
|
|
376
|
+
|
|
377
|
+
Legacy v0.2 Z.AI cache entries remain readable **read-only**: their key is
|
|
378
|
+
reconstructed from the same Adapter-resolved credential using the exact v0.2
|
|
379
|
+
algorithm, and a valid hit is written through to the new key. Old files are
|
|
380
|
+
never rewritten, migrated, or deleted. `--no-cache` performs no reads or
|
|
381
|
+
writes. Injected credentials drive the fingerprint and legacy-key
|
|
382
|
+
construction; ambient `process.env` is never reread.
|
|
383
|
+
|
|
384
|
+
### Errors and lifecycle
|
|
385
|
+
|
|
386
|
+
Encoded MCP error envelopes are recognized before success parsing:
|
|
387
|
+
`QUOTA_ERROR` 429 (exhausted ZRead quota, code `1310`) is terminal; transient
|
|
388
|
+
429/5xx and a malformed envelope retry once; auth 401/403 and other 4xx are
|
|
389
|
+
terminal. Raw Provider response bodies, reset metadata, and error texts are
|
|
390
|
+
discarded.
|
|
391
|
+
|
|
392
|
+
Transport close is best-effort and called once per constructed attempt. A
|
|
393
|
+
successful operation does not become a failure when close rejects or times
|
|
394
|
+
out, and a primary failure remains the outward failure when close also fails.
|
|
395
|
+
Cache hits construct and close no transport.
|
|
396
|
+
|
|
397
|
+
### Diagnostics inventory
|
|
398
|
+
|
|
399
|
+
`sharedCapabilities` and `zaiOnlyCapabilities` are derived from descriptor
|
|
400
|
+
metadata (intersection across built-in Providers; Z.AI minus the union of
|
|
401
|
+
the others). `repository-exploration` is therefore `zaiOnlyCapabilities`
|
|
402
|
+
while still participating in Provider selection. Doctor help names MiniMax
|
|
403
|
+
as unsupported for `repo`.
|
|
404
|
+
|
|
405
|
+
### Non-goals
|
|
406
|
+
|
|
407
|
+
This release does not add MiniMax repository exploration, a Reader
|
|
408
|
+
migration, automatic summarization, dynamic Provider loading, or an implicit
|
|
409
|
+
Z.AI fallback for unsupported Providers. The P5 specialized Vision mappings
|
|
410
|
+
remain independent and are not claimed complete here.
|
|
411
|
+
|
|
412
|
+
## Reader (P7)
|
|
413
|
+
|
|
414
|
+
`scoutline read` participates in `--provider` selection. Z.AI advertises the
|
|
415
|
+
`reader` Capability and supplies it through the Z.AI Reader Adapter. MiniMax
|
|
416
|
+
does not advertise it; selecting MiniMax returns `UNSUPPORTED_CAPABILITY`
|
|
417
|
+
before descriptor configuration, Adapter creation, credential resolution for
|
|
418
|
+
use, cache identity, or transport construction, with no fallback to Z.AI.
|
|
419
|
+
|
|
420
|
+
### Breaking data-mode migration (v0.2 → v1)
|
|
421
|
+
|
|
422
|
+
`scoutline read` returns **schema-version-1 structured values** in every
|
|
423
|
+
output mode. This is an intentional breaking change from the v0.2 raw content
|
|
424
|
+
string and the bare extract array:
|
|
425
|
+
|
|
426
|
+
| Read shape | v0.2 (legacy, now obsolete) | v1 (current) |
|
|
427
|
+
| --- | --- | --- |
|
|
428
|
+
| Content read (default) | Raw content string | `{schemaVersion, url, finalUrl, title, content, contentFormat, truncated, originalContentLength}` |
|
|
429
|
+
| Extract read (`--extract <mode>`) | Bare JSON array of items | `{schemaVersion, url, finalUrl, mode, items, truncated, originalItemCount}` |
|
|
430
|
+
|
|
431
|
+
`url` is exactly what the caller passed; `finalUrl` is the URL the operation
|
|
432
|
+
actually fetched, which differs only when a Provider-side rewrite occurred
|
|
433
|
+
(e.g. `gist.github.com/<id>` → `gist.github.com/<id>/raw`). The v0.2 stderr
|
|
434
|
+
rewrite notice is gone — the signal now lives in `finalUrl`.
|
|
435
|
+
|
|
436
|
+
The four `--extract` modes (`code`, `links`, `tables`, `headings`) and the
|
|
437
|
+
shape of each item are unchanged from v0.2. Only the outer envelope changed
|
|
438
|
+
(bare array → schema-versioned object with `items`).
|
|
439
|
+
|
|
440
|
+
#### Output-mode behavior
|
|
441
|
+
|
|
442
|
+
| Mode | Content read | Extract read |
|
|
443
|
+
| --- | --- | --- |
|
|
444
|
+
| `data` | The content-read envelope object | The extract-read envelope object |
|
|
445
|
+
| `json` | `{success: true, data: <envelope>, timestamp}` (indent 0) | same |
|
|
446
|
+
| `pretty` | `{success: true, data: <envelope>, timestamp}` (indent 2) | same |
|
|
447
|
+
| `compact` | The `content` string directly | JSON fallback (the envelope object) |
|
|
448
|
+
| `markdown` | The `content` string directly | JSON fallback |
|
|
449
|
+
| `refs` | The `content` string directly | JSON fallback |
|
|
450
|
+
| `tty` | The `content` string directly | JSON fallback |
|
|
451
|
+
|
|
452
|
+
`compact`, `markdown`, `refs`, and `tty` exist to give operators a prose form
|
|
453
|
+
for human reading. A content read supplies one (the page body). An extract
|
|
454
|
+
read does not — extracted items are data, not prose — so those modes fall
|
|
455
|
+
back to JSON. This is the deliberate asymmetry from `repo`, whose results are
|
|
456
|
+
always structured data.
|
|
457
|
+
|
|
458
|
+
**Scripting impact:** any consumer that did `scoutline read URL > file.md`,
|
|
459
|
+
`scoutline read URL | jq -r .content`, or `scoutline read URL --extract code |
|
|
460
|
+
jq -c .[]` against v0.2 output must switch to the v1 envelope. `--max-chars`
|
|
461
|
+
still truncates the content-read `content`; it is **ignored on extract reads**
|
|
462
|
+
(extract reports `originalItemCount` instead). The deprecated
|
|
463
|
+
`--full-envelope` flag is silently accepted and ignored — the envelope is
|
|
464
|
+
always returned at v1.
|
|
465
|
+
|
|
466
|
+
### URL rewrite as `finalUrl`
|
|
467
|
+
|
|
468
|
+
A Provider-side URL rewrite (today: gist URLs to their raw form) is recorded
|
|
469
|
+
as `finalUrl` in the v1 result. The rewrite is idempotent on URLs already
|
|
470
|
+
ending in `/raw` and preserves fragments. The v0.2 stderr notice is removed.
|
|
471
|
+
|
|
472
|
+
### Cache namespace
|
|
473
|
+
|
|
474
|
+
Reader results share the partitioned cache namespace and use the
|
|
475
|
+
`reader-fetch` operation suffix:
|
|
476
|
+
|
|
477
|
+
```text
|
|
478
|
+
v2.reader-reader-fetch.<provider>.<credential-hash>.<request-hash>.json
|
|
479
|
+
```
|
|
480
|
+
|
|
481
|
+
The Adapter resolves its credential once. The canonical request URL is the
|
|
482
|
+
**rewritten** URL so two requests that normalize to the same fetched URL share
|
|
483
|
+
one cache entry. Legacy v0.2 Z.AI entries are reconstructed from the same
|
|
484
|
+
Adapter-resolved credential using the exact v0.2 args-order algorithm and
|
|
485
|
+
remain read-only; a valid hit is written through to the new key; legacy files
|
|
486
|
+
are never migrated, rewritten, or deleted. `--no-cache` performs no reads or
|
|
487
|
+
writes. Injected credentials drive the fingerprint and legacy-key
|
|
488
|
+
construction; ambient `process.env` is never reread.
|
|
489
|
+
|
|
490
|
+
### Errors and lifecycle
|
|
491
|
+
|
|
492
|
+
Encoded MCP error envelopes are recognized before success parsing. The same
|
|
493
|
+
taxonomy that governs `repo` applies: exhausted WebReader quota (code `1310`
|
|
494
|
+
or explicit exhausted-limit meaning) surfaces as a normalized `QUOTA_ERROR`
|
|
495
|
+
429 and is terminal; transient 429/5xx and a malformed envelope retry once;
|
|
496
|
+
auth 401/403 and other 4xx are terminal. Raw Provider body, reset metadata,
|
|
497
|
+
and error-text strings are discarded. Transport close is best-effort and
|
|
498
|
+
called once per constructed attempt; a close failure never masks a primary
|
|
499
|
+
result. Cache hits construct and close no transport.
|
|
500
|
+
|
|
501
|
+
### Diagnostics inventory
|
|
502
|
+
|
|
503
|
+
`sharedCapabilities` and `zaiOnlyCapabilities` are derived from descriptor
|
|
504
|
+
metadata. `reader` is therefore `zaiOnlyCapabilities` while still
|
|
505
|
+
participating in Provider selection, and Doctor help names MiniMax as
|
|
506
|
+
unsupported for `read`.
|
|
507
|
+
|
|
508
|
+
### Non-goals
|
|
509
|
+
|
|
510
|
+
This release does not add a MiniMax Reader Adapter, automatic summarization,
|
|
511
|
+
removal of the deprecated `--full-envelope` flag, or a future `--max-items`
|
|
512
|
+
truncation policy for extract reads.
|
|
126
513
|
|
|
127
514
|
## Contributing
|
|
128
515
|
|
|
@@ -143,4 +530,4 @@ MIT - see [LICENSE](https://github.com/vikasagarwal101/scoutline/blob/main/LICEN
|
|
|
143
530
|
## Links
|
|
144
531
|
|
|
145
532
|
- [GitHub Repository](https://github.com/vikasagarwal101/scoutline)
|
|
146
|
-
- [Documentation](https://github.com/vikasagarwal101/scoutline/tree/main/docs)
|
|
533
|
+
- [Documentation](https://github.com/vikasagarwal101/scoutline/tree/main/docs)
|
package/bin/scoutline.js
CHANGED
|
@@ -1,17 +1,38 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import("../dist/index.js")
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
3
|
+
import("../dist/index.js")
|
|
4
|
+
.then(async ({ main }) => {
|
|
5
|
+
const { createNodeCommandInvocationAdapter } =
|
|
6
|
+
await import("../dist/node-command-invocation-adapter.js");
|
|
7
|
+
const adapter = createNodeCommandInvocationAdapter();
|
|
8
|
+
const status = await main(process.argv.slice(2), {
|
|
9
|
+
invocation: adapter,
|
|
10
|
+
env: process.env,
|
|
11
|
+
});
|
|
12
|
+
adapter.setExitCode(status);
|
|
13
|
+
})
|
|
14
|
+
.catch(async (err) => {
|
|
15
|
+
try {
|
|
16
|
+
const { formatLoadFailure } = await import(
|
|
17
|
+
"../dist/node-command-invocation-adapter.js"
|
|
18
|
+
);
|
|
19
|
+
console.error(formatLoadFailure(err));
|
|
20
|
+
} catch {
|
|
21
|
+
// If the dist module is unavailable for any reason, fall back to a
|
|
22
|
+
// best-effort envelope. We do not let a missing helper hide the
|
|
23
|
+
// original load error from the user.
|
|
24
|
+
console.error(
|
|
25
|
+
JSON.stringify(
|
|
26
|
+
{
|
|
27
|
+
success: false,
|
|
28
|
+
error: err && err.message ? err.message : String(err),
|
|
29
|
+
code: "LOAD_ERROR",
|
|
30
|
+
help: 'Make sure to run "npm run build" before running scoutline',
|
|
31
|
+
},
|
|
32
|
+
null,
|
|
33
|
+
2,
|
|
34
|
+
),
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
process.exit(1);
|
|
38
|
+
});
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Diagnostics Capability Contract (DESIGN.md §14, P4-04, P6-06).
|
|
3
|
+
*
|
|
4
|
+
* Defines the schema-version-1 diagnostics report every `doctor`
|
|
5
|
+
* invocation returns, plus the capability contract each Provider
|
|
6
|
+
* Adapter implements so its connectivity can be probed without a
|
|
7
|
+
* generative request.
|
|
8
|
+
*
|
|
9
|
+
* The report is built by the doctor command from descriptor-derived
|
|
10
|
+
* inventory plus the success/failure of each configured Provider
|
|
11
|
+
* probe. Each Adapter performs exactly ONE connectivity attempt;
|
|
12
|
+
* shared execution owns the retry policy.
|
|
13
|
+
*
|
|
14
|
+
* Boundary rules (ARCHITECTURE.md §2):
|
|
15
|
+
* - Imports Provider identity and metadata types (`ProviderCapability`,
|
|
16
|
+
* `ProviderDescriptor`, `ProviderId`) and shared errors. P6-06 keeps
|
|
17
|
+
* the inventory descriptor-derived; no concrete Adapter, no
|
|
18
|
+
* Provider transport, no production registry import lives here.
|
|
19
|
+
* - Imports no Provider transport, no Provider Adapter, no Vision
|
|
20
|
+
* operation→capability mapping, no MiniMax specialized-vision
|
|
21
|
+
* conformance registry, no command presentation. The previous
|
|
22
|
+
* hand-maintained inventory required those imports; the
|
|
23
|
+
* descriptor-derived inventory does not.
|
|
24
|
+
*
|
|
25
|
+
* Inventory derivation (P6-06):
|
|
26
|
+
* - `sharedCapabilities` is the intersection across every descriptor
|
|
27
|
+
* passed to `buildDiagnosticsReport`, preserving deterministic
|
|
28
|
+
* canonical order from the FIRST descriptor.
|
|
29
|
+
* - `zaiOnlyCapabilities` is the Z.AI descriptor's capabilities
|
|
30
|
+
* minus the union of every OTHER built-in descriptor's
|
|
31
|
+
* capabilities, preserving Z.AI descriptor order. Values are
|
|
32
|
+
* descriptor capability IDs only — no hand-maintained aliases.
|
|
33
|
+
* - `repository-exploration` is excluded from shared while any
|
|
34
|
+
* built-in lacks it, and included in Z.AI-only the moment Z.AI
|
|
35
|
+
* advertises it and another built-in does not.
|
|
36
|
+
*/
|
|
37
|
+
import type { ProviderCapability, ProviderDescriptor, ProviderId } from "../providers/types.js";
|
|
38
|
+
import { type ScoutlineErrorCode } from "../lib/errors.js";
|
|
39
|
+
export interface DiagnosticOptions {
|
|
40
|
+
readonly probe: boolean;
|
|
41
|
+
}
|
|
42
|
+
export interface ProviderDiagnostic {
|
|
43
|
+
readonly provider: ProviderId;
|
|
44
|
+
readonly configured: boolean;
|
|
45
|
+
readonly capabilities: readonly ProviderCapability[];
|
|
46
|
+
readonly status: "ok" | "error" | "skipped";
|
|
47
|
+
readonly reason?: "not-configured" | "tools-disabled";
|
|
48
|
+
readonly error?: {
|
|
49
|
+
code: ScoutlineErrorCode;
|
|
50
|
+
message: string;
|
|
51
|
+
help?: string;
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
export interface DiagnosticsReport {
|
|
55
|
+
readonly schemaVersion: 1;
|
|
56
|
+
readonly effectiveProvider: ProviderId;
|
|
57
|
+
readonly sharedCapabilities: readonly ProviderCapability[];
|
|
58
|
+
readonly zaiOnlyCapabilities: readonly string[];
|
|
59
|
+
readonly node: {
|
|
60
|
+
readonly version: string;
|
|
61
|
+
readonly visionMcpCompatible: boolean;
|
|
62
|
+
};
|
|
63
|
+
readonly providers: readonly ProviderDiagnostic[];
|
|
64
|
+
/**
|
|
65
|
+
* One-line cache summary embedded by the CLI handler
|
|
66
|
+
* (`Cache: enabled, 47 response entries (12.3 MB), 1 tool entry
|
|
67
|
+
* (8.2 KB), ~/.scoutline/`). Optional: present when the dispatcher
|
|
68
|
+
* passes a pre-formatted `cacheSummary` through
|
|
69
|
+
* `DoctorDiagnosticsDependencies`. The Doctor report builder NEVER
|
|
70
|
+
* formats this itself (L1 fix); it only embeds what the caller
|
|
71
|
+
* supplied. Older callers that omit the dependency produce a report
|
|
72
|
+
* without this field.
|
|
73
|
+
*/
|
|
74
|
+
readonly cache?: {
|
|
75
|
+
readonly summary: string;
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Capability each Provider Adapter implements for connectivity
|
|
80
|
+
* diagnostics. `invoke` resolves on a successful single connectivity
|
|
81
|
+
* attempt and throws a normalized {@link ScoutlineError} on failure;
|
|
82
|
+
* the doctor command catches the throw and records a redacted error
|
|
83
|
+
* entry. Returning `void` keeps the report builder the single owner of
|
|
84
|
+
* report shape.
|
|
85
|
+
*/
|
|
86
|
+
export interface DiagnosticsCapability {
|
|
87
|
+
invoke(options: DiagnosticOptions): Promise<void>;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Derive the shared Capabilities inventory: the intersection of every
|
|
91
|
+
* descriptor's `capabilities()` set, preserving deterministic
|
|
92
|
+
* canonical order from the FIRST descriptor in the list.
|
|
93
|
+
*
|
|
94
|
+
* Edge cases:
|
|
95
|
+
* - Empty descriptor list: returns an empty array.
|
|
96
|
+
* - Single descriptor: returns that descriptor's capabilities in
|
|
97
|
+
* their declared order (the intersection of one set is itself).
|
|
98
|
+
* - Two or more: keeps a capability from the first descriptor iff
|
|
99
|
+
* every other descriptor also advertises it.
|
|
100
|
+
*
|
|
101
|
+
* The returned array is frozen so callers cannot mutate the cached
|
|
102
|
+
* derivation in place.
|
|
103
|
+
*/
|
|
104
|
+
export declare function deriveSharedCapabilities(descriptors: readonly ProviderDescriptor[]): readonly ProviderCapability[];
|
|
105
|
+
/**
|
|
106
|
+
* Derive the Z.AI-only Capabilities inventory: capabilities advertised
|
|
107
|
+
* by the Z.AI descriptor minus the union of capabilities advertised by
|
|
108
|
+
* every OTHER descriptor in the list. Preserves Z.AI descriptor order.
|
|
109
|
+
*
|
|
110
|
+
* Edge cases:
|
|
111
|
+
* - Empty descriptor list: returns an empty array.
|
|
112
|
+
* - Z.AI absent from the list: returns an empty array.
|
|
113
|
+
* - Z.AI present as the only descriptor: returns its capabilities
|
|
114
|
+
* verbatim (the "minus nothing" case).
|
|
115
|
+
* - Z.AI with other descriptors: each capability in Z.AI descriptor
|
|
116
|
+
* order is kept iff no other descriptor advertises it.
|
|
117
|
+
*
|
|
118
|
+
* The returned values are descriptor capability IDs only. No
|
|
119
|
+
* hand-maintained aliases, no parallel base-release list, no
|
|
120
|
+
* invented names. `repository-exploration` lands here naturally the
|
|
121
|
+
* moment Z.AI advertises it and another built-in does not.
|
|
122
|
+
*/
|
|
123
|
+
export declare function deriveZaiOnlyCapabilities(descriptors: readonly ProviderDescriptor[]): readonly ProviderCapability[];
|
|
124
|
+
/**
|
|
125
|
+
* Map a thrown error into a normalized diagnostic error entry. The
|
|
126
|
+
* caller is responsible for recursive redaction before the entry
|
|
127
|
+
* crosses an outward boundary (the doctor command does this in
|
|
128
|
+
* {@link buildDiagnosticsReport}).
|
|
129
|
+
*/
|
|
130
|
+
export declare function diagnosticErrorFromError(error: unknown): {
|
|
131
|
+
code: ScoutlineErrorCode;
|
|
132
|
+
message: string;
|
|
133
|
+
help?: string;
|
|
134
|
+
};
|
|
135
|
+
//# sourceMappingURL=diagnostics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diagnostics.d.ts","sourceRoot":"","sources":["../../src/capabilities/diagnostics.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAChG,OAAO,EAAkB,KAAK,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAM3E,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;CACzB;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,QAAQ,EAAE,UAAU,CAAC;IAC9B,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAC7B,QAAQ,CAAC,YAAY,EAAE,SAAS,kBAAkB,EAAE,CAAC;IACrD,QAAQ,CAAC,MAAM,EAAE,IAAI,GAAG,OAAO,GAAG,SAAS,CAAC;IAC5C,QAAQ,CAAC,MAAM,CAAC,EAAE,gBAAgB,GAAG,gBAAgB,CAAC;IACtD,QAAQ,CAAC,KAAK,CAAC,EAAE;QAAE,IAAI,EAAE,kBAAkB,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CAC/E;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,aAAa,EAAE,CAAC,CAAC;IAC1B,QAAQ,CAAC,iBAAiB,EAAE,UAAU,CAAC;IACvC,QAAQ,CAAC,kBAAkB,EAAE,SAAS,kBAAkB,EAAE,CAAC;IAC3D,QAAQ,CAAC,mBAAmB,EAAE,SAAS,MAAM,EAAE,CAAC;IAChD,QAAQ,CAAC,IAAI,EAAE;QACb,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;QACzB,QAAQ,CAAC,mBAAmB,EAAE,OAAO,CAAC;KACvC,CAAC;IACF,QAAQ,CAAC,SAAS,EAAE,SAAS,kBAAkB,EAAE,CAAC;IAClD;;;;;;;;;OASG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE;QAAE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;CAC/C;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,qBAAqB;IACpC,MAAM,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACnD;AAYD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,wBAAwB,CACtC,WAAW,EAAE,SAAS,kBAAkB,EAAE,GACzC,SAAS,kBAAkB,EAAE,CAc/B;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,yBAAyB,CACvC,WAAW,EAAE,SAAS,kBAAkB,EAAE,GACzC,SAAS,kBAAkB,EAAE,CAoB/B;AAMD;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,OAAO,GAAG;IACxD,IAAI,EAAE,kBAAkB,CAAC;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAYA"}
|