@stav-ai/cli 0.1.1 → 0.1.3
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 +44 -3
- package/dist/adapters/adapters.json +15 -0
- package/dist/adapters/deepseek-harness.patch.yml +25 -0
- package/dist/adapters/index.js +240 -4
- package/dist/cli.js +3 -0
- package/dist/launch.js +5 -2
- package/dist/version.js +2 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -7,6 +7,9 @@ needs, and starts the app pointed at Stav.
|
|
|
7
7
|
```sh
|
|
8
8
|
npx @stav-ai/cli launch claude
|
|
9
9
|
npx @stav-ai/cli launch codex --model zai-org/glm-5-2
|
|
10
|
+
npx @stav-ai/cli launch dsh -- "run the tests"
|
|
11
|
+
npx @stav-ai/cli launch kilo
|
|
12
|
+
npx @stav-ai/cli launch copilot
|
|
10
13
|
```
|
|
11
14
|
|
|
12
15
|
Always use the scoped name `@stav-ai/cli`. The unscoped `stav` package on npm
|
|
@@ -23,8 +26,10 @@ is not ours.
|
|
|
23
26
|
| `stav apps` | The apps this CLI can launch |
|
|
24
27
|
| `stav launch <app> [--model <id>] [--workspace <slug>] [--yes] [-- <app arguments>]` | Start an app on Stav |
|
|
25
28
|
|
|
26
|
-
|
|
27
|
-
(`
|
|
29
|
+
It launches **Claude Code** (`claude`), **Codex** (`codex`),
|
|
30
|
+
**DeepSeek Harness** (`dsh`), **Kilo Code** (`kilo`) and the
|
|
31
|
+
**GitHub Copilot CLI** (`copilot`). The app must
|
|
32
|
+
already be installed.
|
|
28
33
|
|
|
29
34
|
## What `stav launch` does
|
|
30
35
|
|
|
@@ -35,13 +40,49 @@ The first release launches **Claude Code** (`claude`) and **Codex**
|
|
|
35
40
|
refuses it and you are an owner or admin, a workspace key instead;
|
|
36
41
|
- named for the app and you, marked with the app in your request log;
|
|
37
42
|
- with only the scope the app needs (`inference:messages` for Claude Code,
|
|
38
|
-
`inference:chat` for Codex
|
|
43
|
+
`inference:chat` for Codex, DeepSeek Harness, Kilo Code and the
|
|
44
|
+
GitHub Copilot CLI).
|
|
39
45
|
4. Starts the app with the Stav gateway and the key in its environment.
|
|
40
46
|
**No file is written.** Your `~/.claude` and `~/.codex/config.toml` are not
|
|
41
47
|
changed. For a model Claude Code does not know, the CLI also tells it the
|
|
42
48
|
model's context window (`CLAUDE_CODE_MAX_CONTEXT_TOKENS`, the largest
|
|
43
49
|
window Stav serves that model at for your workspace).
|
|
44
50
|
|
|
51
|
+
DeepSeek Harness reads its model providers from a file, so the CLI starts
|
|
52
|
+
its one-shot command `dsh --profile headless` with `--patch` and a file
|
|
53
|
+
that ships with the CLI. That file holds no key and no address: every
|
|
54
|
+
value comes from the environment. Your `~/.dsh` is not changed. Give the
|
|
55
|
+
task after `--`. The CLI also turns off DeepSeek Harness feedback uploads
|
|
56
|
+
(`DSH_TELEMETRY_MODE=DISABLED`). DeepSeek Harness runs the commands the
|
|
57
|
+
model writes without asking. Its own `SAFETY.md` says to run it in a
|
|
58
|
+
container or a VM.
|
|
59
|
+
|
|
60
|
+
Kilo Code takes the whole Stav provider from the environment
|
|
61
|
+
(`KILO_CONFIG_CONTENT`, which it reads after its own config files). The
|
|
62
|
+
key is only in `STAV_KILO_API_KEY`. For this run Stav is Kilo Code's only
|
|
63
|
+
provider, and your `~/.config/kilo` is not changed. The CLI also turns off
|
|
64
|
+
Kilo Code's usage data and session uploads to Kilo
|
|
65
|
+
(`KILO_TELEMETRY_LEVEL=off`, `KILO_DISABLE_SESSION_INGEST=1`,
|
|
66
|
+
`KILO_DISABLE_SHARE=1`). It starts the chat screen; for one task without
|
|
67
|
+
it, give `run "<task>"` after `--`. `kilo run` cannot ask, so it refuses
|
|
68
|
+
the shell commands it would ask about: add `--auto` after `run` to let it
|
|
69
|
+
run them without asking.
|
|
70
|
+
|
|
71
|
+
The GitHub Copilot CLI takes Stav as its model provider from the
|
|
72
|
+
environment (`COPILOT_PROVIDER_BASE_URL` and `COPILOT_PROVIDER_API_KEY`).
|
|
73
|
+
It then needs no GitHub sign-in, and no provider settings are written to
|
|
74
|
+
`~/.copilot`. The
|
|
75
|
+
CLI also sets `COPILOT_OFFLINE=true`, so the Copilot CLI sends nothing to
|
|
76
|
+
GitHub: no sign-in, telemetry, web tools, GitHub MCP server or
|
|
77
|
+
auto-update. The Copilot CLI keeps the model name `auto` for GitHub's own
|
|
78
|
+
router, so for `auto` or a Router the CLI names the model `stav-router`
|
|
79
|
+
and sends the Stav value as `COPILOT_PROVIDER_WIRE_MODEL`. The Copilot CLI
|
|
80
|
+
asks before it runs a tool; the CLI removes `COPILOT_ALLOW_ALL` from your
|
|
81
|
+
shell for the run so that stays true. For one task without the chat
|
|
82
|
+
screen, give `-p "<task>"` after `--`. `-p` cannot ask, so it refuses
|
|
83
|
+
edits and commands: add `--allow-tool` or `--allow-all-tools` after the
|
|
84
|
+
task to allow them without asking.
|
|
85
|
+
|
|
45
86
|
The key is kept in your operating system's keychain, or in a file only you
|
|
46
87
|
can read when there is no keychain. Never in your project folder.
|
|
47
88
|
|
|
@@ -11,6 +11,21 @@
|
|
|
11
11
|
"apps": [
|
|
12
12
|
"codex"
|
|
13
13
|
]
|
|
14
|
+
},
|
|
15
|
+
"deepseek-harness": {
|
|
16
|
+
"apps": [
|
|
17
|
+
"deepseek-harness"
|
|
18
|
+
]
|
|
19
|
+
},
|
|
20
|
+
"kilo-code": {
|
|
21
|
+
"apps": [
|
|
22
|
+
"kilo-code"
|
|
23
|
+
]
|
|
24
|
+
},
|
|
25
|
+
"github-copilot": {
|
|
26
|
+
"apps": [
|
|
27
|
+
"github-copilot"
|
|
28
|
+
]
|
|
14
29
|
}
|
|
15
30
|
}
|
|
16
31
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# The Stav provider for DeepSeek Harness, given to `dsh --patch` by the
|
|
2
|
+
# deepseek-harness adapter in index.ts. Shipped with the CLI and never
|
|
3
|
+
# written at run time: every value comes from the environment the CLI sets
|
|
4
|
+
# for the child, so the key is never in this file or in an argument (R-20).
|
|
5
|
+
#
|
|
6
|
+
# A --patch overlay is applied after the profile's own cordis.patch.yml and
|
|
7
|
+
# $DSH_HOME/cordis.patch.yml, and replaces each entry's config: for this run
|
|
8
|
+
# Stav is the only model provider and the default model. ~/.dsh is not
|
|
9
|
+
# changed. Checked with dsh 0.2.2-rc.5 (`--dump-config`, and a run).
|
|
10
|
+
- id: llm-pi-ai
|
|
11
|
+
config:
|
|
12
|
+
providers:
|
|
13
|
+
stav-cli:
|
|
14
|
+
displayName: Stav
|
|
15
|
+
apiKeyEnv: STAV_DSH_API_KEY
|
|
16
|
+
api: openai-completions
|
|
17
|
+
baseURL: !!js process.env.STAV_DSH_BASE_URL
|
|
18
|
+
models:
|
|
19
|
+
- id: !!js process.env.STAV_DSH_MODEL
|
|
20
|
+
contextWindow: !!js Number(process.env.STAV_DSH_CONTEXT_WINDOW)
|
|
21
|
+
maxTokens: !!js Number(process.env.STAV_DSH_MAX_TOKENS)
|
|
22
|
+
- id: agent-default-model
|
|
23
|
+
config:
|
|
24
|
+
provider: stav-cli
|
|
25
|
+
model: !!js process.env.STAV_DSH_MODEL
|
package/dist/adapters/index.js
CHANGED
|
@@ -4,8 +4,12 @@
|
|
|
4
4
|
* A catalogue row's recipe only picks one of these by name and may give a
|
|
5
5
|
* default model. Everything that runs on the person's machine — the program,
|
|
6
6
|
* its environment and its arguments — is here, reviewed and released with
|
|
7
|
-
* the CLI. No adapter writes a file
|
|
8
|
-
* environment and the command line
|
|
7
|
+
* the CLI. No adapter writes a file: Claude Code and Codex take everything
|
|
8
|
+
* from the environment and the command line, DeepSeek Harness reads a
|
|
9
|
+
* fixed overlay file shipped with the CLI (deepseek-harness.patch.yml) whose
|
|
10
|
+
* values all come from the environment, Kilo Code takes its whole
|
|
11
|
+
* provider from KILO_CONFIG_CONTENT, and the GitHub Copilot CLI from its
|
|
12
|
+
* COPILOT_PROVIDER_* variables. The key goes only into the child's
|
|
9
13
|
* environment, never into its arguments or a file (R-20).
|
|
10
14
|
*
|
|
11
15
|
* adapters.json is byte-identical to the Stav API's
|
|
@@ -15,6 +19,7 @@
|
|
|
15
19
|
import { promises as fs } from 'node:fs';
|
|
16
20
|
import os from 'node:os';
|
|
17
21
|
import path from 'node:path';
|
|
22
|
+
import { fileURLToPath } from 'node:url';
|
|
18
23
|
import list from './adapters.json' with { type: 'json' };
|
|
19
24
|
/**
|
|
20
25
|
* A model Claude Code knows by name brings its own window, and for one of
|
|
@@ -152,9 +157,240 @@ const codex = {
|
|
|
152
157
|
};
|
|
153
158
|
},
|
|
154
159
|
};
|
|
155
|
-
|
|
160
|
+
/** The overlay DeepSeek Harness reads; built next to this module (npm run build copies it). */
|
|
161
|
+
export const DSH_PATCH_FILE = fileURLToPath(new URL('./deepseek-harness.patch.yml', import.meta.url));
|
|
162
|
+
/** dsh's own guess when nothing sizes a model (its defaultContextWindow). */
|
|
163
|
+
const DSH_DEFAULT_CONTEXT_WINDOW = 1_000_000;
|
|
164
|
+
/**
|
|
165
|
+
* The output cap dsh asks for on every call. Without one it asks for 128,000,
|
|
166
|
+
* which many models refuse; 32,000 is the value the app test proved.
|
|
167
|
+
*/
|
|
168
|
+
export const DSH_MAX_TOKENS = 32_000;
|
|
169
|
+
/** A named model, not "auto" or an @workspace/router. */
|
|
170
|
+
function namedModel(model) {
|
|
171
|
+
return model !== null && model !== 'auto' && !model.startsWith('@');
|
|
172
|
+
}
|
|
173
|
+
const deepseekHarness = {
|
|
174
|
+
name: 'deepseek-harness',
|
|
175
|
+
apps: ['deepseek-harness'],
|
|
176
|
+
displayName: 'DeepSeek Harness',
|
|
177
|
+
program: 'dsh',
|
|
178
|
+
scopes: ['inference:chat'],
|
|
179
|
+
wantsContextWindow: namedModel,
|
|
180
|
+
plan({ gatewayUrl, key, model, contextWindow }) {
|
|
181
|
+
// dsh reads model providers only from patch files. --patch adds the
|
|
182
|
+
// shipped overlay for this run; its values come from the STAV_DSH_*
|
|
183
|
+
// variables, a set no other tool uses, so a key dsh has stored or a
|
|
184
|
+
// ~/.dsh/.env cannot stand in for the Stav one. Only the one-shot
|
|
185
|
+
// headless profile was tested, so that is the one started. With no model,
|
|
186
|
+
// "auto" (the workspace's default Router): dsh's own default is
|
|
187
|
+
// DeepSeek's cloud, which must never get the run.
|
|
188
|
+
const base = `${gatewayUrl}/v1`;
|
|
189
|
+
const id = model ?? 'auto';
|
|
190
|
+
const window = contextWindow && namedModel(model) ? contextWindow : DSH_DEFAULT_CONTEXT_WINDOW;
|
|
191
|
+
// undefined: the preview, before the key exists (launch.ts passes no
|
|
192
|
+
// window); null: read, and Stav knows none.
|
|
193
|
+
const describeWindow = contextWindow && namedModel(model)
|
|
194
|
+
? `a context window of ${contextWindow} tokens (the model's in your workspace)`
|
|
195
|
+
: contextWindow === undefined && namedModel(model)
|
|
196
|
+
? "the model's largest context window in your workspace, read from Stav"
|
|
197
|
+
: `dsh's own context window guess (${DSH_DEFAULT_CONTEXT_WINDOW} tokens)`;
|
|
198
|
+
return {
|
|
199
|
+
program: 'dsh',
|
|
200
|
+
args: ['--profile', 'headless', '--patch', DSH_PATCH_FILE],
|
|
201
|
+
env: {
|
|
202
|
+
STAV_DSH_API_KEY: key,
|
|
203
|
+
STAV_DSH_BASE_URL: base,
|
|
204
|
+
STAV_DSH_MODEL: id,
|
|
205
|
+
STAV_DSH_CONTEXT_WINDOW: String(window),
|
|
206
|
+
STAV_DSH_MAX_TOKENS: String(DSH_MAX_TOKENS),
|
|
207
|
+
// Feedback would upload the whole session to DeepSeek, not to Stav.
|
|
208
|
+
DSH_TELEMETRY_MODE: 'DISABLED',
|
|
209
|
+
},
|
|
210
|
+
unset: [],
|
|
211
|
+
describe: [
|
|
212
|
+
`the one-shot command dsh --profile headless, with a "stav-cli" model provider at ${base} for this run only (your ~/.dsh is not changed)`,
|
|
213
|
+
'STAV_DSH_API_KEY=<the key, in the environment only>',
|
|
214
|
+
model ? `model ${model}` : 'model auto (your workspace\'s default Router)',
|
|
215
|
+
describeWindow,
|
|
216
|
+
`at most ${DSH_MAX_TOKENS} output tokens per call`,
|
|
217
|
+
'DSH_TELEMETRY_MODE=DISABLED (no feedback uploads to DeepSeek)',
|
|
218
|
+
"note: dsh runs the commands the model writes without asking; DeepSeek's own SAFETY.md says to run it in a container or VM",
|
|
219
|
+
'give the task after --, for example: stav launch deepseek-harness -- "run the tests"',
|
|
220
|
+
],
|
|
221
|
+
};
|
|
222
|
+
},
|
|
223
|
+
};
|
|
224
|
+
/** The provider id the kilo-code adapter gives Stav; one only the CLI uses, so a "stav" block a person made from the guide never merges into it. */
|
|
225
|
+
export const KILO_PROVIDER = 'stav-cli';
|
|
226
|
+
/**
|
|
227
|
+
* The output cap Kilo Code sends as max_tokens on every call (limit.output).
|
|
228
|
+
* 16,384 is the value the app test proved; Stav lowers it to an endpoint's
|
|
229
|
+
* own cap and names that in X-Stav-Clamped-Params.
|
|
230
|
+
*/
|
|
231
|
+
export const KILO_MAX_OUTPUT = 16_384;
|
|
232
|
+
/**
|
|
233
|
+
* The context window given for auto, a Router, or a model Stav knows no
|
|
234
|
+
* window for. Kilo Code compacts by it; 128,000 fits the smaller models a
|
|
235
|
+
* Router may pick.
|
|
236
|
+
*/
|
|
237
|
+
export const KILO_DEFAULT_CONTEXT = 128_000;
|
|
238
|
+
const kiloCode = {
|
|
239
|
+
name: 'kilo-code',
|
|
240
|
+
apps: ['kilo-code'],
|
|
241
|
+
displayName: 'Kilo Code',
|
|
242
|
+
program: 'kilo',
|
|
243
|
+
scopes: ['inference:chat'],
|
|
244
|
+
wantsContextWindow: namedModel,
|
|
245
|
+
plan({ gatewayUrl, key, model, contextWindow }) {
|
|
246
|
+
// Kilo Code merges KILO_CONFIG_CONTENT after the global and the project
|
|
247
|
+
// config files, and resolves {env:} in it (checked with Kilo Code
|
|
248
|
+
// 7.8.40), so the whole provider is given in the environment and no file
|
|
249
|
+
// is written. The key itself is only in STAV_KILO_API_KEY, a name no
|
|
250
|
+
// other tool uses. enabled_providers replaces any list the person has,
|
|
251
|
+
// so for this run Stav is the only provider: an agent or small_model in
|
|
252
|
+
// their config set to another provider fails instead of going there.
|
|
253
|
+
// With no model, "auto" (the workspace's default Router), never Kilo's
|
|
254
|
+
// own cloud default.
|
|
255
|
+
const base = `${gatewayUrl}/v1`;
|
|
256
|
+
const id = model ?? 'auto';
|
|
257
|
+
const ref = `${KILO_PROVIDER}/${id}`;
|
|
258
|
+
const window = contextWindow && namedModel(model) ? contextWindow : KILO_DEFAULT_CONTEXT;
|
|
259
|
+
// The config files merge deep, so a "stav-cli" block in the person's own
|
|
260
|
+
// config keeps every key this one does not set. The SDK and the address
|
|
261
|
+
// are therefore set at both levels Kilo Code reads them from (provider and
|
|
262
|
+
// model); options.baseURL wins over both. Headers from such a block still
|
|
263
|
+
// reach Stav, never anywhere else. Only a Kilo organisation's console
|
|
264
|
+
// config and MDM-managed config merge after KILO_CONFIG_CONTENT; those are
|
|
265
|
+
// set by the person's administrator and are meant to win.
|
|
266
|
+
const sdk = '@ai-sdk/openai-compatible';
|
|
267
|
+
const config = {
|
|
268
|
+
model: ref,
|
|
269
|
+
small_model: ref,
|
|
270
|
+
enabled_providers: [KILO_PROVIDER],
|
|
271
|
+
provider: {
|
|
272
|
+
[KILO_PROVIDER]: {
|
|
273
|
+
npm: sdk,
|
|
274
|
+
api: base,
|
|
275
|
+
name: 'Stav',
|
|
276
|
+
options: { apiKey: '{env:STAV_KILO_API_KEY}', baseURL: base },
|
|
277
|
+
models: {
|
|
278
|
+
[id]: { name: id, provider: { npm: sdk, api: base }, limit: { context: window, output: KILO_MAX_OUTPUT } },
|
|
279
|
+
},
|
|
280
|
+
},
|
|
281
|
+
},
|
|
282
|
+
};
|
|
283
|
+
// undefined: the preview, before the key exists; null: read, and Stav knows none.
|
|
284
|
+
const describeWindow = contextWindow && namedModel(model)
|
|
285
|
+
? `a context window of ${contextWindow} tokens (the model's in your workspace)`
|
|
286
|
+
: contextWindow === undefined && namedModel(model)
|
|
287
|
+
? "the model's largest context window in your workspace, read from Stav"
|
|
288
|
+
: `a context window of ${KILO_DEFAULT_CONTEXT} tokens (Kilo Code compacts the chat by it)`;
|
|
289
|
+
return {
|
|
290
|
+
program: 'kilo',
|
|
291
|
+
args: [],
|
|
292
|
+
env: {
|
|
293
|
+
STAV_KILO_API_KEY: key,
|
|
294
|
+
KILO_CONFIG_CONTENT: JSON.stringify(config),
|
|
295
|
+
// Usage data to Kilo, and session uploads to Kilo's cloud when signed in.
|
|
296
|
+
KILO_TELEMETRY_LEVEL: 'off',
|
|
297
|
+
KILO_DISABLE_SESSION_INGEST: '1',
|
|
298
|
+
KILO_DISABLE_SHARE: '1',
|
|
299
|
+
},
|
|
300
|
+
unset: [],
|
|
301
|
+
describe: [
|
|
302
|
+
`Kilo Code with a "${KILO_PROVIDER}" provider at ${base} as its only provider, for this run only (your ~/.config/kilo is not changed)`,
|
|
303
|
+
'STAV_KILO_API_KEY=<the key, in the environment only>',
|
|
304
|
+
model ? `model ${model}` : "model auto (your workspace's default Router)",
|
|
305
|
+
describeWindow,
|
|
306
|
+
`at most ${KILO_MAX_OUTPUT} output tokens per call`,
|
|
307
|
+
'KILO_TELEMETRY_LEVEL=off, KILO_DISABLE_SESSION_INGEST=1, KILO_DISABLE_SHARE=1 (no usage data or session uploads to Kilo)',
|
|
308
|
+
'note: Kilo Code runs commands and edits files. It asks before most shell commands, unless your Kilo config allows them (Kilo writes bash: allow into a config file that existed before its first start)',
|
|
309
|
+
'an agent in your Kilo config with a model of its own stops with "Model not found" for this run: Stav is the only provider',
|
|
310
|
+
'run one task without the chat screen after --, for example: stav launch kilo-code -- run "fix the failing test". kilo run refuses the shell commands it would ask about; add --auto after run to allow them without asking',
|
|
311
|
+
],
|
|
312
|
+
};
|
|
313
|
+
},
|
|
314
|
+
};
|
|
315
|
+
/**
|
|
316
|
+
* The name the github-copilot adapter gives the CLI for "auto" or a Router.
|
|
317
|
+
* The Copilot CLI keeps the name "auto" for GitHub's own router and stops
|
|
318
|
+
* before it sends anything ("Auto is unavailable for this account"), so the
|
|
319
|
+
* Stav value goes in COPILOT_PROVIDER_WIRE_MODEL under another name.
|
|
320
|
+
*/
|
|
321
|
+
export const COPILOT_ROUTER_MODEL = 'stav-router';
|
|
322
|
+
const githubCopilot = {
|
|
323
|
+
name: 'github-copilot',
|
|
324
|
+
apps: ['github-copilot'],
|
|
325
|
+
displayName: 'GitHub Copilot CLI',
|
|
326
|
+
program: 'copilot',
|
|
327
|
+
scopes: ['inference:chat'],
|
|
328
|
+
plan({ gatewayUrl, key, model }) {
|
|
329
|
+
// Setting COPILOT_PROVIDER_BASE_URL switches the CLI to its own-provider
|
|
330
|
+
// mode: no GitHub sign-in, and a saved ~/.copilot/providers.json is
|
|
331
|
+
// ignored unless COPILOT_PROVIDERS_CONFIG names one (checked with the
|
|
332
|
+
// Copilot CLI 1.0.117, `copilot help environment`). Chat Completions with
|
|
333
|
+
// the openai type is the path the app test proved end to end. With no
|
|
334
|
+
// model, "auto" (the workspace's default Router), never a GitHub model.
|
|
335
|
+
const base = `${gatewayUrl}/v1`;
|
|
336
|
+
const id = model ?? 'auto';
|
|
337
|
+
const routed = !namedModel(id);
|
|
338
|
+
const env = {
|
|
339
|
+
COPILOT_PROVIDER_BASE_URL: base,
|
|
340
|
+
COPILOT_PROVIDER_TYPE: 'openai',
|
|
341
|
+
COPILOT_PROVIDER_WIRE_API: 'completions',
|
|
342
|
+
COPILOT_PROVIDER_API_KEY: key,
|
|
343
|
+
COPILOT_MODEL: routed ? COPILOT_ROUTER_MODEL : id,
|
|
344
|
+
// No GitHub sign-in, no telemetry to GitHub, no web tools, no GitHub
|
|
345
|
+
// MCP server, no auto-update: only model traffic leaves, to Stav.
|
|
346
|
+
COPILOT_OFFLINE: 'true',
|
|
347
|
+
};
|
|
348
|
+
if (routed)
|
|
349
|
+
env.COPILOT_PROVIDER_WIRE_MODEL = id;
|
|
350
|
+
return {
|
|
351
|
+
program: 'copilot',
|
|
352
|
+
args: [],
|
|
353
|
+
env,
|
|
354
|
+
// Settings from the person's shell that would send this run, or the
|
|
355
|
+
// key, somewhere else: a providers file named here wins over the base
|
|
356
|
+
// URL, and a key command or bearer token wins over the key.
|
|
357
|
+
unset: [
|
|
358
|
+
'COPILOT_PROVIDERS_CONFIG',
|
|
359
|
+
'COPILOT_PROVIDER_API_KEY_COMMAND',
|
|
360
|
+
'COPILOT_PROVIDER_BEARER_TOKEN',
|
|
361
|
+
'COPILOT_PROVIDER_HEADERS',
|
|
362
|
+
'COPILOT_PROVIDER_TRANSPORT',
|
|
363
|
+
'COPILOT_PROVIDER_AZURE_API_VERSION',
|
|
364
|
+
'COPILOT_PROVIDER_MODEL_ID',
|
|
365
|
+
// Sizes and image support set for another provider's model.
|
|
366
|
+
'COPILOT_PROVIDER_MAX_PROMPT_TOKENS',
|
|
367
|
+
'COPILOT_PROVIDER_MAX_OUTPUT_TOKENS',
|
|
368
|
+
'COPILOT_PROVIDER_VISION',
|
|
369
|
+
// Approval turned off in the shell: the launch says it asks first.
|
|
370
|
+
'COPILOT_ALLOW_ALL',
|
|
371
|
+
...(routed ? [] : ['COPILOT_PROVIDER_WIRE_MODEL']),
|
|
372
|
+
],
|
|
373
|
+
describe: [
|
|
374
|
+
`the Copilot CLI with Stav at ${base} as its model provider, for this run only (no provider settings are written to ~/.copilot)`,
|
|
375
|
+
'COPILOT_PROVIDER_API_KEY=<the key, in the environment only>',
|
|
376
|
+
routed
|
|
377
|
+
? `model ${id}${model ? '' : " (your workspace's default Router)"}, given to the CLI as ${COPILOT_ROUTER_MODEL}`
|
|
378
|
+
: `model ${id}`,
|
|
379
|
+
'COPILOT_OFFLINE=true (no GitHub sign-in, telemetry, web tools, GitHub MCP server or auto-update)',
|
|
380
|
+
'note: the Copilot CLI runs commands and edits files. It asks first unless you pass --allow-all-tools (COPILOT_ALLOW_ALL from your shell is removed for this run)',
|
|
381
|
+
'run one task without the chat screen after --, for example: stav launch github-copilot -- -p "fix the failing test". -p cannot ask, so it refuses edits and commands; add --allow-tool or --allow-all-tools after the task to allow them without asking',
|
|
382
|
+
],
|
|
383
|
+
};
|
|
384
|
+
},
|
|
385
|
+
};
|
|
386
|
+
export const ADAPTERS = [claudeCode, codex, deepseekHarness, kiloCode, githubCopilot];
|
|
156
387
|
/** Names a person may type for an app (DECIDE-APPS-P: `claude` → claude-code). */
|
|
157
|
-
export const ALIASES = {
|
|
388
|
+
export const ALIASES = {
|
|
389
|
+
claude: 'claude-code',
|
|
390
|
+
dsh: 'deepseek-harness',
|
|
391
|
+
kilo: 'kilo-code',
|
|
392
|
+
copilot: 'github-copilot',
|
|
393
|
+
};
|
|
158
394
|
export function resolveApp(name) {
|
|
159
395
|
const n = name.trim().toLowerCase();
|
|
160
396
|
return ALIASES[n] ?? n;
|
package/dist/cli.js
CHANGED
|
@@ -42,6 +42,9 @@ Environment:
|
|
|
42
42
|
Examples:
|
|
43
43
|
stav launch claude
|
|
44
44
|
stav launch codex --model zai-org/glm-5-2
|
|
45
|
+
stav launch dsh -- "run the tests"
|
|
46
|
+
stav launch kilo
|
|
47
|
+
stav launch copilot -- -p "fix the failing test"
|
|
45
48
|
`;
|
|
46
49
|
// Every line goes through terminalText: much of it is text from the Stav API.
|
|
47
50
|
const out = (line = '') => process.stdout.write(`${terminalText(line)}\n`);
|
package/dist/launch.js
CHANGED
|
@@ -20,6 +20,9 @@ import { chooseWorkspace } from './workspace.js';
|
|
|
20
20
|
export const INSTALL_HINT = {
|
|
21
21
|
claude: 'npm install -g @anthropic-ai/claude-code',
|
|
22
22
|
codex: 'npm install -g @openai/codex',
|
|
23
|
+
dsh: 'npm install -g @deepseek-ai/dsh',
|
|
24
|
+
kilo: 'npm install -g @kilocode/cli',
|
|
25
|
+
copilot: 'npm install -g @github/copilot',
|
|
23
26
|
};
|
|
24
27
|
export async function planLaunch(opts, d) {
|
|
25
28
|
if (d.platform === 'win32') {
|
|
@@ -240,11 +243,11 @@ async function readContextWindow(plan, key, d) {
|
|
|
240
243
|
n = await stav.modelContext(key, plan.model);
|
|
241
244
|
}
|
|
242
245
|
catch (err) {
|
|
243
|
-
d.log(`Could not read the context window of ${plan.model} (${err instanceof Error ? err.message : String(err)}); ${plan.adapter.displayName}
|
|
246
|
+
d.log(`Could not read the context window of ${plan.model} (${err instanceof Error ? err.message : String(err)}); ${plan.adapter.displayName} starts without the window from Stav (see the plan above for what it uses).`);
|
|
244
247
|
return null;
|
|
245
248
|
}
|
|
246
249
|
if (n === null)
|
|
247
|
-
d.log(`Stav does not know the context window of ${plan.model} for your workspace; ${plan.adapter.displayName}
|
|
250
|
+
d.log(`Stav does not know the context window of ${plan.model} for your workspace; ${plan.adapter.displayName} starts without the window from Stav (see the plan above for what it uses).`);
|
|
248
251
|
return n;
|
|
249
252
|
}
|
|
250
253
|
/** PATH lookup without a shell. */
|
package/dist/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/** The CLI's own version. Kept equal to package.json by
|
|
2
|
-
export const VERSION = '0.1.
|
|
1
|
+
/** The CLI's own version. Kept equal to package.json by units.test.ts ("VERSION matches package.json"). */
|
|
2
|
+
export const VERSION = '0.1.3';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stav-ai/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "Run your coding agent on Stav: sign in, get a key for the app, and start it pointed at the Stav gateway.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"node": ">=22"
|
|
16
16
|
},
|
|
17
17
|
"scripts": {
|
|
18
|
-
"build": "tsc -p tsconfig.build.json",
|
|
18
|
+
"build": "tsc -p tsconfig.build.json && node --input-type=module -e \"import { copyFileSync } from 'node:fs'; copyFileSync('src/adapters/deepseek-harness.patch.yml', 'dist/adapters/deepseek-harness.patch.yml')\"",
|
|
19
19
|
"prepack": "npm run build",
|
|
20
20
|
"typecheck": "tsc --noEmit",
|
|
21
21
|
"test": "tsx --test 'src/**/*.test.ts'",
|