@stav-ai/cli 0.1.5 → 0.1.6
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 +22 -3
- package/dist/adapters/adapters.json +5 -0
- package/dist/adapters/hermes-managed/config.yaml +26 -0
- package/dist/adapters/index.js +84 -2
- package/dist/cli.js +1 -0
- package/dist/launch.js +5 -1
- package/dist/version.js +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -11,6 +11,7 @@ npx @stav-ai/cli launch dsh -- "run the tests"
|
|
|
11
11
|
npx @stav-ai/cli launch kilo
|
|
12
12
|
npx @stav-ai/cli launch copilot
|
|
13
13
|
npx @stav-ai/cli launch pi
|
|
14
|
+
npx @stav-ai/cli launch hermes
|
|
14
15
|
```
|
|
15
16
|
|
|
16
17
|
Always use the scoped name `@stav-ai/cli`. The unscoped `stav` package on npm
|
|
@@ -29,9 +30,10 @@ is not ours.
|
|
|
29
30
|
|
|
30
31
|
It launches **Claude Code** (`claude`), **Codex** (`codex`),
|
|
31
32
|
**DeepSeek Harness** (`dsh`), **Kilo Code** (`kilo`), the
|
|
32
|
-
**GitHub Copilot CLI** (`copilot`)
|
|
33
|
-
not installed, it offers to install it with
|
|
34
|
-
only if you say yes
|
|
33
|
+
**GitHub Copilot CLI** (`copilot`), **pi** (`pi`) and **Hermes Agent**
|
|
34
|
+
(`hermes`). If the app is not installed, it offers to install it with
|
|
35
|
+
`npm install -g` and does so only if you say yes (Hermes Agent is not on
|
|
36
|
+
npm: the CLI says where its installer is). With `--yes`, or with no terminal, it installs
|
|
35
37
|
nothing and prints the command instead.
|
|
36
38
|
|
|
37
39
|
## What `stav launch` does
|
|
@@ -95,6 +97,23 @@ nothing and prints the command instead.
|
|
|
95
97
|
the model writes without asking. For one task without the chat screen,
|
|
96
98
|
give `-p "<task>"` after `--`.
|
|
97
99
|
|
|
100
|
+
Hermes Agent runs every turn in a background process that keeps the key it
|
|
101
|
+
started with, and reads a key saved in `~/.hermes/.env` before the
|
|
102
|
+
environment. So the CLI starts Hermes with a home of its own in
|
|
103
|
+
`~/.stav/hermes` (`HERMES_HOME`), one folder per API key, so a launch for
|
|
104
|
+
another workspace never uses the key of one still open; a new key starts an
|
|
105
|
+
empty folder. Sessions, memory
|
|
106
|
+
and skills there are kept apart from your own Hermes, and `~/.hermes` is
|
|
107
|
+
not read or changed.
|
|
108
|
+
Hermes takes the provider from a settings folder that ships with the CLI
|
|
109
|
+
(`HERMES_MANAGED_DIR`). That file holds no key and no address: every value
|
|
110
|
+
comes from the environment, and the key is only in `STAV_HERMES_API_KEY`.
|
|
111
|
+
The same file turns off the update check at GitHub and the free web search
|
|
112
|
+
fallback. Hermes runs the commands the model writes; those it does not
|
|
113
|
+
judge dangerous run without asking, and they can read
|
|
114
|
+
`STAV_HERMES_API_KEY` from their environment. For one task without the chat screen,
|
|
115
|
+
give `-z "<task>"` after `--`; then every command runs without asking.
|
|
116
|
+
|
|
98
117
|
The key is kept in your operating system's keychain, or in a file only you
|
|
99
118
|
can read when there is no keychain. Never in your project folder.
|
|
100
119
|
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# The Hermes Agent settings for `stav launch hermes-agent`.
|
|
2
|
+
#
|
|
3
|
+
# The Stav CLI points Hermes at this folder with HERMES_MANAGED_DIR (Hermes's
|
|
4
|
+
# administrator overlay, laid over its own config.yaml). Hermes expands each
|
|
5
|
+
# ${VAR} from the environment of the process only, so every value comes from
|
|
6
|
+
# what the CLI sets for this run. No secret is written here: the key is read
|
|
7
|
+
# from STAV_HERMES_API_KEY through key_env.
|
|
8
|
+
model:
|
|
9
|
+
provider: custom:stav-cli
|
|
10
|
+
default: ${STAV_HERMES_MODEL}
|
|
11
|
+
providers:
|
|
12
|
+
stav-cli:
|
|
13
|
+
api: ${STAV_HERMES_BASE_URL}
|
|
14
|
+
key_env: STAV_HERMES_API_KEY
|
|
15
|
+
transport: chat_completions
|
|
16
|
+
# Traffic that would not go through Stav: the daily update check at GitHub and
|
|
17
|
+
# the free third-party web search fallback.
|
|
18
|
+
updates:
|
|
19
|
+
check: false
|
|
20
|
+
web:
|
|
21
|
+
keyless_fallback: false
|
|
22
|
+
# Hermes runs each turn in a background process that keeps the key and model
|
|
23
|
+
# it started with. Let it end soon after the last window closes, so the next
|
|
24
|
+
# launch starts one with its own values.
|
|
25
|
+
gateway:
|
|
26
|
+
unmanaged_idle_exit_seconds: 5
|
package/dist/adapters/index.js
CHANGED
|
@@ -11,13 +11,15 @@
|
|
|
11
11
|
* provider from KILO_CONFIG_CONTENT, the GitHub Copilot CLI from its
|
|
12
12
|
* COPILOT_PROVIDER_* variables, and pi from a fixed provider extension
|
|
13
13
|
* shipped with the CLI (pi-stav-provider.js) whose values all come from the
|
|
14
|
-
* environment
|
|
14
|
+
* environment, and Hermes Agent from a fixed overlay folder shipped with the
|
|
15
|
+
* CLI (hermes-managed/), in a Hermes home of its own. The key goes only into the child's
|
|
15
16
|
* environment, never into its arguments or a file (R-20).
|
|
16
17
|
*
|
|
17
18
|
* adapters.json is byte-identical to the Stav API's
|
|
18
19
|
* app/services/launch_recipes/adapters.json (the admin endpoint checks
|
|
19
20
|
* recipes against it; a lockstep test pins the copy).
|
|
20
21
|
*/
|
|
22
|
+
import { createHash } from 'node:crypto';
|
|
21
23
|
import { promises as fs } from 'node:fs';
|
|
22
24
|
import os from 'node:os';
|
|
23
25
|
import path from 'node:path';
|
|
@@ -535,13 +537,93 @@ const pi = {
|
|
|
535
537
|
return null;
|
|
536
538
|
},
|
|
537
539
|
};
|
|
538
|
-
|
|
540
|
+
/** The folder Hermes reads its fixed overlay from; built next to this module (npm run build copies it). */
|
|
541
|
+
export const HERMES_MANAGED_DIR = fileURLToPath(new URL('./hermes-managed/', import.meta.url));
|
|
542
|
+
/** The provider id in that overlay; one only the CLI uses. */
|
|
543
|
+
export const HERMES_PROVIDER = 'stav-cli';
|
|
544
|
+
/** The folder that holds the Hermes homes of every launch. */
|
|
545
|
+
export function hermesHomes(home = os.homedir()) {
|
|
546
|
+
return path.join(home, '.stav', 'hermes');
|
|
547
|
+
}
|
|
548
|
+
/**
|
|
549
|
+
* The Hermes home a launch uses: its own, never the person's ~/.hermes, and
|
|
550
|
+
* one per key. Hermes runs every turn in a background process that reads the
|
|
551
|
+
* key from its own environment and from <home>/.env, which wins over the
|
|
552
|
+
* environment. Into the person's home, a launch would use a key saved there
|
|
553
|
+
* or the key of a Hermes window already open; into one shared home, a launch
|
|
554
|
+
* for another workspace would use the key of a launch still open, and bill
|
|
555
|
+
* the wrong workspace (checked with Hermes 0.23.5). The folder name is a
|
|
556
|
+
* short hash of the key, never the key.
|
|
557
|
+
*/
|
|
558
|
+
export function hermesHome(key, home = os.homedir()) {
|
|
559
|
+
return path.join(hermesHomes(home), createHash('sha256').update(key).digest('hex').slice(0, 16));
|
|
560
|
+
}
|
|
561
|
+
/**
|
|
562
|
+
* Variables that would send this run somewhere else, or change what the
|
|
563
|
+
* overlay sets: another provider, base URL or model, a remote gateway, a
|
|
564
|
+
* profile, or a mode that skips the config or the command approvals. Also
|
|
565
|
+
* STAV_API_KEY: Hermes would take it as the key for any api.stav.ai address.
|
|
566
|
+
*/
|
|
567
|
+
export const HERMES_UNSET = [
|
|
568
|
+
'STAV_API_KEY',
|
|
569
|
+
'OPENAI_BASE_URL', 'OPENAI_API_KEY',
|
|
570
|
+
'CUSTOM_BASE_URL', 'CUSTOM_API_KEY',
|
|
571
|
+
'OPENROUTER_BASE_URL', 'OPENROUTER_API_KEY',
|
|
572
|
+
'HERMES_INFERENCE_PROVIDER', 'HERMES_INFERENCE_MODEL', 'HERMES_MODEL',
|
|
573
|
+
'HERMES_TUI_PROVIDER', 'HERMES_TUI_GATEWAY_URL', 'HERMES_PROFILE',
|
|
574
|
+
'HERMES_YOLO_MODE', 'HERMES_SAFE_MODE', 'HERMES_IGNORE_USER_CONFIG', 'HERMES_ACCEPT_HOOKS',
|
|
575
|
+
];
|
|
576
|
+
const hermesAgent = {
|
|
577
|
+
name: 'hermes-agent',
|
|
578
|
+
apps: ['hermes-agent'],
|
|
579
|
+
displayName: 'Hermes Agent',
|
|
580
|
+
program: 'hermes',
|
|
581
|
+
// Hermes reads GET /v1/models for each model's context window.
|
|
582
|
+
scopes: ['inference:chat', 'inference:models'],
|
|
583
|
+
plan({ gatewayUrl, key, model }) {
|
|
584
|
+
// Hermes takes this run's provider from the overlay in HERMES_MANAGED_DIR,
|
|
585
|
+
// whose values all come from the STAV_HERMES_* variables, and keeps its
|
|
586
|
+
// state in a home of its own (checked with Hermes 0.23.5). It reads each
|
|
587
|
+
// model's context window from Stav itself. The provider and model are
|
|
588
|
+
// also given as arguments: a second window shares the first one's
|
|
589
|
+
// background process, which would otherwise keep the first one's model.
|
|
590
|
+
// With no model, "auto" (the workspace's default Router), never Hermes's
|
|
591
|
+
// own default.
|
|
592
|
+
const base = `${gatewayUrl}/v1`;
|
|
593
|
+
const id = model ?? 'auto';
|
|
594
|
+
const home = hermesHome(key);
|
|
595
|
+
return {
|
|
596
|
+
program: 'hermes',
|
|
597
|
+
args: ['--provider', `custom:${HERMES_PROVIDER}`, '-m', id],
|
|
598
|
+
env: {
|
|
599
|
+
HERMES_HOME: home,
|
|
600
|
+
HERMES_MANAGED_DIR,
|
|
601
|
+
STAV_HERMES_API_KEY: key,
|
|
602
|
+
STAV_HERMES_BASE_URL: base,
|
|
603
|
+
STAV_HERMES_MODEL: id,
|
|
604
|
+
},
|
|
605
|
+
unset: [...HERMES_UNSET],
|
|
606
|
+
describe: [
|
|
607
|
+
`Hermes Agent with a "${HERMES_PROVIDER}" provider at ${base}, set by a file that ships with the Stav CLI, for this run only`,
|
|
608
|
+
`a Hermes home of its own in ${hermesHomes()}, one folder per API key (a new key starts an empty one): sessions, memory and skills there are kept apart from your own Hermes, and ~/.hermes is not read or changed`,
|
|
609
|
+
'STAV_HERMES_API_KEY=<the key, in the environment only>',
|
|
610
|
+
model ? `model ${model}` : "model auto (your workspace's default Router)",
|
|
611
|
+
"Hermes reads each model's context window from Stav",
|
|
612
|
+
'no update check at GitHub and no free third-party web search fallback (both would go around Stav)',
|
|
613
|
+
'note: Hermes runs the commands the model writes. Commands it does not judge dangerous run without asking, and with -z every command runs without asking. Those commands can read STAV_HERMES_API_KEY from their environment; run it in a folder or container where that is safe',
|
|
614
|
+
'run one task without the chat screen after --, for example: stav launch hermes-agent -- -z "fix the failing test"',
|
|
615
|
+
],
|
|
616
|
+
};
|
|
617
|
+
},
|
|
618
|
+
};
|
|
619
|
+
export const ADAPTERS = [claudeCode, codex, deepseekHarness, kiloCode, githubCopilot, pi, hermesAgent];
|
|
539
620
|
/** Names a person may type for an app (DECIDE-APPS-P: `claude` → claude-code). */
|
|
540
621
|
export const ALIASES = {
|
|
541
622
|
claude: 'claude-code',
|
|
542
623
|
dsh: 'deepseek-harness',
|
|
543
624
|
kilo: 'kilo-code',
|
|
544
625
|
copilot: 'github-copilot',
|
|
626
|
+
hermes: 'hermes-agent',
|
|
545
627
|
};
|
|
546
628
|
export function resolveApp(name) {
|
|
547
629
|
const n = name.trim().toLowerCase();
|
package/dist/cli.js
CHANGED
|
@@ -46,6 +46,7 @@ Examples:
|
|
|
46
46
|
stav launch kilo
|
|
47
47
|
stav launch copilot -- -p "fix the failing test"
|
|
48
48
|
stav launch pi
|
|
49
|
+
stav launch hermes -- -z "fix the failing test"
|
|
49
50
|
`;
|
|
50
51
|
// Every line goes through terminalText: much of it is text from the Stav API.
|
|
51
52
|
const out = (line = '') => process.stdout.write(`${terminalText(line)}\n`);
|
package/dist/launch.js
CHANGED
|
@@ -26,7 +26,11 @@ export const INSTALL_PACKAGE = {
|
|
|
26
26
|
copilot: '@github/copilot',
|
|
27
27
|
pi: '@earendil-works/pi-coding-agent',
|
|
28
28
|
};
|
|
29
|
-
export const INSTALL_HINT =
|
|
29
|
+
export const INSTALL_HINT = {
|
|
30
|
+
...Object.fromEntries(Object.entries(INSTALL_PACKAGE).map(([program, pkg]) => [program, `npm install -g ${pkg}`])),
|
|
31
|
+
// Not on npm: Hermes installs with its own installer, so the CLI only says where.
|
|
32
|
+
hermes: 'its installer, see https://hermes-agent.nousresearch.com/docs/getting-started/quickstart',
|
|
33
|
+
};
|
|
30
34
|
/**
|
|
31
35
|
* Everything that can refuse runs first; only then, if the app is missing,
|
|
32
36
|
* is the install offered, so a yes never installs an app for a launch that
|
package/dist/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
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.
|
|
2
|
+
export const VERSION = '0.1.6';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stav-ai/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
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 && node --input-type=module -e \"import { copyFileSync } from 'node:fs'; copyFileSync('src/adapters/deepseek-harness.patch.yml', 'dist/adapters/deepseek-harness.patch.yml'); copyFileSync('src/adapters/pi-stav-provider.js', 'dist/adapters/pi-stav-provider.js')\"",
|
|
18
|
+
"build": "tsc -p tsconfig.build.json && node --input-type=module -e \"import { copyFileSync, mkdirSync } from 'node:fs'; copyFileSync('src/adapters/deepseek-harness.patch.yml', 'dist/adapters/deepseek-harness.patch.yml'); copyFileSync('src/adapters/pi-stav-provider.js', 'dist/adapters/pi-stav-provider.js'); mkdirSync('dist/adapters/hermes-managed', { recursive: true }); copyFileSync('src/adapters/hermes-managed/config.yaml', 'dist/adapters/hermes-managed/config.yaml')\"",
|
|
19
19
|
"prepack": "npm run build",
|
|
20
20
|
"typecheck": "tsc --noEmit",
|
|
21
21
|
"test": "tsx --test 'src/**/*.test.ts'",
|