@stav-ai/cli 0.1.1 → 0.1.2

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
@@ -7,6 +7,7 @@ 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"
10
11
  ```
11
12
 
12
13
  Always use the scoped name `@stav-ai/cli`. The unscoped `stav` package on npm
@@ -23,8 +24,8 @@ is not ours.
23
24
  | `stav apps` | The apps this CLI can launch |
24
25
  | `stav launch <app> [--model <id>] [--workspace <slug>] [--yes] [-- <app arguments>]` | Start an app on Stav |
25
26
 
26
- The first release launches **Claude Code** (`claude`) and **Codex**
27
- (`codex`). The app must already be installed.
27
+ It launches **Claude Code** (`claude`), **Codex** (`codex`) and
28
+ **DeepSeek Harness** (`dsh`). The app must already be installed.
28
29
 
29
30
  ## What `stav launch` does
30
31
 
@@ -35,13 +36,22 @@ The first release launches **Claude Code** (`claude`) and **Codex**
35
36
  refuses it and you are an owner or admin, a workspace key instead;
36
37
  - named for the app and you, marked with the app in your request log;
37
38
  - with only the scope the app needs (`inference:messages` for Claude Code,
38
- `inference:chat` for Codex).
39
+ `inference:chat` for Codex and DeepSeek Harness).
39
40
  4. Starts the app with the Stav gateway and the key in its environment.
40
41
  **No file is written.** Your `~/.claude` and `~/.codex/config.toml` are not
41
42
  changed. For a model Claude Code does not know, the CLI also tells it the
42
43
  model's context window (`CLAUDE_CODE_MAX_CONTEXT_TOKENS`, the largest
43
44
  window Stav serves that model at for your workspace).
44
45
 
46
+ DeepSeek Harness reads its model providers from a file, so the CLI starts
47
+ its one-shot command `dsh --profile headless` with `--patch` and a file
48
+ that ships with the CLI. That file holds no key and no address: every
49
+ value comes from the environment. Your `~/.dsh` is not changed. Give the
50
+ task after `--`. The CLI also turns off DeepSeek Harness feedback uploads
51
+ (`DSH_TELEMETRY_MODE=DISABLED`). DeepSeek Harness runs the commands the
52
+ model writes without asking. Its own `SAFETY.md` says to run it in a
53
+ container or a VM.
54
+
45
55
  The key is kept in your operating system's keychain, or in a file only you
46
56
  can read when there is no keychain. Never in your project folder.
47
57
 
@@ -11,6 +11,11 @@
11
11
  "apps": [
12
12
  "codex"
13
13
  ]
14
+ },
15
+ "deepseek-harness": {
16
+ "apps": [
17
+ "deepseek-harness"
18
+ ]
14
19
  }
15
20
  }
16
21
  }
@@ -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
@@ -4,8 +4,10 @@
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 (both apps take everything from the
8
- * environment and the command line), and the key goes only into the child's
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
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
9
11
  * environment, never into its arguments or a file (R-20).
10
12
  *
11
13
  * adapters.json is byte-identical to the Stav API's
@@ -15,6 +17,7 @@
15
17
  import { promises as fs } from 'node:fs';
16
18
  import os from 'node:os';
17
19
  import path from 'node:path';
20
+ import { fileURLToPath } from 'node:url';
18
21
  import list from './adapters.json' with { type: 'json' };
19
22
  /**
20
23
  * A model Claude Code knows by name brings its own window, and for one of
@@ -152,9 +155,73 @@ const codex = {
152
155
  };
153
156
  },
154
157
  };
155
- export const ADAPTERS = [claudeCode, codex];
158
+ /** The overlay DeepSeek Harness reads; built next to this module (npm run build copies it). */
159
+ export const DSH_PATCH_FILE = fileURLToPath(new URL('./deepseek-harness.patch.yml', import.meta.url));
160
+ /** dsh's own guess when nothing sizes a model (its defaultContextWindow). */
161
+ const DSH_DEFAULT_CONTEXT_WINDOW = 1_000_000;
162
+ /**
163
+ * The output cap dsh asks for on every call. Without one it asks for 128,000,
164
+ * which many models refuse; 32,000 is the value the app test proved.
165
+ */
166
+ export const DSH_MAX_TOKENS = 32_000;
167
+ /** A named model, not "auto" or an @workspace/router. */
168
+ function namedModel(model) {
169
+ return model !== null && model !== 'auto' && !model.startsWith('@');
170
+ }
171
+ const deepseekHarness = {
172
+ name: 'deepseek-harness',
173
+ apps: ['deepseek-harness'],
174
+ displayName: 'DeepSeek Harness',
175
+ program: 'dsh',
176
+ scopes: ['inference:chat'],
177
+ wantsContextWindow: namedModel,
178
+ plan({ gatewayUrl, key, model, contextWindow }) {
179
+ // dsh reads model providers only from patch files. --patch adds the
180
+ // shipped overlay for this run; its values come from the STAV_DSH_*
181
+ // variables, a set no other tool uses, so a key dsh has stored or a
182
+ // ~/.dsh/.env cannot stand in for the Stav one. Only the one-shot
183
+ // headless profile was tested, so that is the one started. With no model,
184
+ // "auto" (the workspace's default Router): dsh's own default is
185
+ // DeepSeek's cloud, which must never get the run.
186
+ const base = `${gatewayUrl}/v1`;
187
+ const id = model ?? 'auto';
188
+ const window = contextWindow && namedModel(model) ? contextWindow : DSH_DEFAULT_CONTEXT_WINDOW;
189
+ // undefined: the preview, before the key exists (launch.ts passes no
190
+ // window); null: read, and Stav knows none.
191
+ const describeWindow = contextWindow && namedModel(model)
192
+ ? `a context window of ${contextWindow} tokens (the model's in your workspace)`
193
+ : contextWindow === undefined && namedModel(model)
194
+ ? "the model's largest context window in your workspace, read from Stav"
195
+ : `dsh's own context window guess (${DSH_DEFAULT_CONTEXT_WINDOW} tokens)`;
196
+ return {
197
+ program: 'dsh',
198
+ args: ['--profile', 'headless', '--patch', DSH_PATCH_FILE],
199
+ env: {
200
+ STAV_DSH_API_KEY: key,
201
+ STAV_DSH_BASE_URL: base,
202
+ STAV_DSH_MODEL: id,
203
+ STAV_DSH_CONTEXT_WINDOW: String(window),
204
+ STAV_DSH_MAX_TOKENS: String(DSH_MAX_TOKENS),
205
+ // Feedback would upload the whole session to DeepSeek, not to Stav.
206
+ DSH_TELEMETRY_MODE: 'DISABLED',
207
+ },
208
+ unset: [],
209
+ describe: [
210
+ `the one-shot command dsh --profile headless, with a "stav-cli" model provider at ${base} for this run only (your ~/.dsh is not changed)`,
211
+ 'STAV_DSH_API_KEY=<the key, in the environment only>',
212
+ model ? `model ${model}` : 'model auto (your workspace\'s default Router)',
213
+ describeWindow,
214
+ `at most ${DSH_MAX_TOKENS} output tokens per call`,
215
+ 'DSH_TELEMETRY_MODE=DISABLED (no feedback uploads to DeepSeek)',
216
+ "note: dsh runs the commands the model writes without asking; DeepSeek's own SAFETY.md says to run it in a container or VM",
217
+ 'give the task after --, for example: stav launch deepseek-harness -- "run the tests"',
218
+ ],
219
+ };
220
+ },
221
+ };
222
+ export const ADAPTERS = [claudeCode, codex, deepseekHarness];
156
223
  /** Names a person may type for an app (DECIDE-APPS-P: `claude` → claude-code). */
157
- export const ALIASES = { claude: 'claude-code' };
224
+ export const ALIASES = { claude: 'claude-code', dsh: 'deepseek-harness' };
158
225
  export function resolveApp(name) {
159
226
  const n = name.trim().toLowerCase();
160
227
  return ALIASES[n] ?? n;
package/dist/cli.js CHANGED
@@ -42,6 +42,7 @@ 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"
45
46
  `;
46
47
  // Every line goes through terminalText: much of it is text from the Stav API.
47
48
  const out = (line = '') => process.stdout.write(`${terminalText(line)}\n`);
package/dist/launch.js CHANGED
@@ -20,6 +20,7 @@ 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',
23
24
  };
24
25
  export async function planLaunch(opts, d) {
25
26
  if (d.platform === 'win32') {
package/dist/version.js CHANGED
@@ -1,2 +1,2 @@
1
1
  /** The CLI's own version. Kept equal to package.json by version.test.ts. */
2
- export const VERSION = '0.1.1';
2
+ export const VERSION = '0.1.2';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stav-ai/cli",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
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'",