@stav-ai/cli 0.1.2 → 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 CHANGED
@@ -8,6 +8,8 @@ needs, and starts the app pointed at Stav.
8
8
  npx @stav-ai/cli launch claude
9
9
  npx @stav-ai/cli launch codex --model zai-org/glm-5-2
10
10
  npx @stav-ai/cli launch dsh -- "run the tests"
11
+ npx @stav-ai/cli launch kilo
12
+ npx @stav-ai/cli launch copilot
11
13
  ```
12
14
 
13
15
  Always use the scoped name `@stav-ai/cli`. The unscoped `stav` package on npm
@@ -24,8 +26,10 @@ is not ours.
24
26
  | `stav apps` | The apps this CLI can launch |
25
27
  | `stav launch <app> [--model <id>] [--workspace <slug>] [--yes] [-- <app arguments>]` | Start an app on Stav |
26
28
 
27
- It launches **Claude Code** (`claude`), **Codex** (`codex`) and
28
- **DeepSeek Harness** (`dsh`). The app must already be installed.
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.
29
33
 
30
34
  ## What `stav launch` does
31
35
 
@@ -36,7 +40,8 @@ It launches **Claude Code** (`claude`), **Codex** (`codex`) and
36
40
  refuses it and you are an owner or admin, a workspace key instead;
37
41
  - named for the app and you, marked with the app in your request log;
38
42
  - with only the scope the app needs (`inference:messages` for Claude Code,
39
- `inference:chat` for Codex and DeepSeek Harness).
43
+ `inference:chat` for Codex, DeepSeek Harness, Kilo Code and the
44
+ GitHub Copilot CLI).
40
45
  4. Starts the app with the Stav gateway and the key in its environment.
41
46
  **No file is written.** Your `~/.claude` and `~/.codex/config.toml` are not
42
47
  changed. For a model Claude Code does not know, the CLI also tells it the
@@ -52,6 +57,32 @@ It launches **Claude Code** (`claude`), **Codex** (`codex`) and
52
57
  model writes without asking. Its own `SAFETY.md` says to run it in a
53
58
  container or a VM.
54
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
+
55
86
  The key is kept in your operating system's keychain, or in a file only you
56
87
  can read when there is no keychain. Never in your project folder.
57
88
 
@@ -16,6 +16,16 @@
16
16
  "apps": [
17
17
  "deepseek-harness"
18
18
  ]
19
+ },
20
+ "kilo-code": {
21
+ "apps": [
22
+ "kilo-code"
23
+ ]
24
+ },
25
+ "github-copilot": {
26
+ "apps": [
27
+ "github-copilot"
28
+ ]
19
29
  }
20
30
  }
21
31
  }
@@ -5,9 +5,11 @@
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
7
  * the CLI. No adapter writes a file: Claude Code and Codex take everything
8
- * from the environment and the command line, and DeepSeek Harness reads a
8
+ * from the environment and the command line, DeepSeek Harness reads a
9
9
  * fixed overlay file shipped with the CLI (deepseek-harness.patch.yml) whose
10
- * values all come from the environment. The key goes only into the child's
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
11
13
  * environment, never into its arguments or a file (R-20).
12
14
  *
13
15
  * adapters.json is byte-identical to the Stav API's
@@ -219,9 +221,176 @@ const deepseekHarness = {
219
221
  };
220
222
  },
221
223
  };
222
- export const ADAPTERS = [claudeCode, codex, deepseekHarness];
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];
223
387
  /** Names a person may type for an app (DECIDE-APPS-P: `claude` → claude-code). */
224
- export const ALIASES = { claude: 'claude-code', dsh: 'deepseek-harness' };
388
+ export const ALIASES = {
389
+ claude: 'claude-code',
390
+ dsh: 'deepseek-harness',
391
+ kilo: 'kilo-code',
392
+ copilot: 'github-copilot',
393
+ };
225
394
  export function resolveApp(name) {
226
395
  const n = name.trim().toLowerCase();
227
396
  return ALIASES[n] ?? n;
package/dist/cli.js CHANGED
@@ -43,6 +43,8 @@ Examples:
43
43
  stav launch claude
44
44
  stav launch codex --model zai-org/glm-5-2
45
45
  stav launch dsh -- "run the tests"
46
+ stav launch kilo
47
+ stav launch copilot -- -p "fix the failing test"
46
48
  `;
47
49
  // Every line goes through terminalText: much of it is text from the Stav API.
48
50
  const out = (line = '') => process.stdout.write(`${terminalText(line)}\n`);
package/dist/launch.js CHANGED
@@ -21,6 +21,8 @@ export const INSTALL_HINT = {
21
21
  claude: 'npm install -g @anthropic-ai/claude-code',
22
22
  codex: 'npm install -g @openai/codex',
23
23
  dsh: 'npm install -g @deepseek-ai/dsh',
24
+ kilo: 'npm install -g @kilocode/cli',
25
+ copilot: 'npm install -g @github/copilot',
24
26
  };
25
27
  export async function planLaunch(opts, d) {
26
28
  if (d.platform === 'win32') {
@@ -241,11 +243,11 @@ async function readContextWindow(plan, key, d) {
241
243
  n = await stav.modelContext(key, plan.model);
242
244
  }
243
245
  catch (err) {
244
- d.log(`Could not read the context window of ${plan.model} (${err instanceof Error ? err.message : String(err)}); ${plan.adapter.displayName} uses its own guess.`);
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).`);
245
247
  return null;
246
248
  }
247
249
  if (n === null)
248
- d.log(`Stav does not know the context window of ${plan.model} for your workspace; ${plan.adapter.displayName} uses its own guess.`);
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).`);
249
251
  return n;
250
252
  }
251
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 version.test.ts. */
2
- export const VERSION = '0.1.2';
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.2",
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": {