@runneth/cli 0.0.0-sha.372b2c9d0e4f.production → 0.0.0-sha.41910c2f7cce.production

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
@@ -4,11 +4,13 @@
4
4
 
5
5
  ```bash
6
6
  npx @runneth/cli open
7
- npx @runneth/cli send 'cd ~/project && pnpm test'
8
- npx @runneth/cli send 'git status --short'
9
- npx @runneth/cli oauth login
10
- npx @runneth/cli ssh
11
- npx @runneth/cli close
7
+ runneth send 'cd ~/project && pnpm test'
8
+ runneth send 'git status --short'
9
+ runneth oauth login
10
+ runneth chat --workspace <workspace-id>
11
+ runneth conversation create --workspace <workspace-id> --json
12
+ runneth ssh
13
+ runneth close
12
14
  ```
13
15
 
14
16
  ## npm Usage
@@ -33,28 +35,33 @@ environment variables, and other shell state persist between commands.
33
35
  ## Commands
34
36
 
35
37
  ```bash
36
- runneth-cli open [--name default] [--cwd <path>] [--shell <path>]
37
- runneth-cli send [--name default] [--timeout-ms 600000] [--stdin] -- <command...>
38
- runneth-cli status [--name default]
39
- runneth-cli list
40
- runneth-cli close [--name default]
41
- runneth-cli oauth login [--resource <url>] [--client-name "Runneth MCP"] [--scope <scope>] [--no-open]
42
- runneth-cli oauth status [--resource <url>]
43
- runneth-cli oauth logout [--resource <url>]
44
- runneth-cli ssh target add <name> (--host <host> | --ssh-url <url>) [--resource <url>] [--default]
45
- runneth-cli ssh target import <file>
46
- runneth-cli ssh target list
47
- runneth-cli ssh target use <name>
48
- runneth-cli ssh [--target <name>] [--unique-key | --identity-file <path>] [-- remote-command]
49
- runneth-cli ssh stdio [--target <name>] [--unique-key | --identity-file <path>]
50
- runneth-cli skills install [--agent claude|codex|all]
51
- runneth-cli shutdown
38
+ runneth open [--name default] [--cwd <path>] [--shell <path>]
39
+ runneth send [--name default] [--timeout-ms 600000] [--stdin] -- <command...>
40
+ runneth status [--name default]
41
+ runneth list
42
+ runneth close [--name default]
43
+ runneth oauth login [--resource <url>] [--client-id|--clientid <id>] [--client-secret|--secret <value>] [--client-name "Runneth MCP"] [--scope <scope>] [--no-open]
44
+ runneth oauth status [--resource <url>]
45
+ runneth oauth logout [--resource <url>]
46
+ runneth chat --workspace <workspace-id> [--api <builder-url>] [--resource <url>] [--auth mondrian|builder] [--conversation <id>]
47
+ runneth conversation create --workspace <workspace-id> --json [--title <title>]
48
+ runneth conversation send --workspace <workspace-id> --conversation <id> --json (--message <text> | --stdin)
49
+ runneth conversation state --workspace <workspace-id> --conversation <id> --json
50
+ runneth conversation session --workspace <workspace-id> --jsonl
51
+ runneth ssh target add <name> (--host <host> | --ssh-url <url>) [--resource <url>] [--default]
52
+ runneth ssh target import <file>
53
+ runneth ssh target list
54
+ runneth ssh target use <name>
55
+ runneth ssh [--conversation <id> --workspace <workspace-id> | --target <name> | --host <host> | --ssh-url <url>] [--api <builder-url>] [--resource <url>] [--unique-key | --identity-file <path>] [-- remote-command]
56
+ runneth ssh stdio [--conversation <id> --workspace <workspace-id> | --target <name> | --host <host> | --ssh-url <url>] [--api <builder-url>] [--resource <url>] [--unique-key | --identity-file <path>]
57
+ runneth skills install [--agent claude|codex|all]
58
+ runneth shutdown
52
59
  ```
53
60
 
54
61
  Use `--stdin` for multi-line commands:
55
62
 
56
63
  ```bash
57
- cat <<'SCRIPT' | runneth-cli send --stdin
64
+ cat <<'SCRIPT' | runneth send --stdin
58
65
  cd ~/project
59
66
  pnpm check
60
67
  SCRIPT
@@ -65,37 +72,114 @@ use a different state directory.
65
72
 
66
73
  ## OAuth
67
74
 
68
- `runneth-cli oauth login` performs OAuth protected-resource discovery, dynamic
69
- client registration as a public MCP-style client, PKCE authorization, and token
70
- exchange through a local loopback callback.
75
+ `runneth-cli oauth login` performs OAuth protected-resource discovery, PKCE
76
+ authorization, and token exchange through a local loopback callback. By default
77
+ it uses dynamic client registration as a public MCP-style client. Provide
78
+ `--client-id`/`--clientid` and `--client-secret`/`--secret`, or set
79
+ `RUNNETH_OAUTH_CLIENT_ID` and `RUNNETH_OAUTH_CLIENT_SECRET`, to use a
80
+ pre-registered confidential client instead.
71
81
 
72
82
  ```bash
73
- runneth-cli oauth login --resource http://localhost:4100/mcp
74
- runneth-cli oauth status --resource http://localhost:4100/mcp
83
+ runneth oauth login --resource http://localhost:4100/mcp
84
+ RUNNETH_OAUTH_CLIENT_ID=client-id RUNNETH_OAUTH_CLIENT_SECRET=client-secret runneth oauth login --resource http://localhost:4100/mcp
85
+ runneth oauth status --resource http://localhost:4100/mcp
75
86
  ```
76
87
 
77
88
  OAuth credentials are stored under `~/.runneth-cli/oauth` with user-only file
78
89
  permissions on Unix-like systems. Commands that need an access token refresh it
79
90
  internally when the server issued a refresh token.
80
91
 
92
+ ## Chat
93
+
94
+ `runneth-cli chat` starts an interactive terminal conversation against Builder's
95
+ canonical Runneth conversation API. Official environment builds carry the
96
+ correct Builder URL in the package; use `--api` only for local or custom Builder
97
+ deployments.
98
+
99
+ ```bash
100
+ runneth chat --workspace "$MONDRIAN_WORKSPACE_ID"
101
+ ```
102
+
103
+ If no stored OAuth credential exists, chat starts the same browser-based OAuth
104
+ flow as SSH and stores the credential under `~/.runneth-cli/oauth`. Use
105
+ `--token`, `RUNNETH_TOKEN`, `MONDRIAN_TOKEN`, or `BUILDER_AGENT_CHAT_TOKEN` only
106
+ for automation and local API mocks that should bypass OAuth.
107
+
108
+ Inside the terminal UI, use `/state` to redraw the current conversation and
109
+ `/exit` to quit.
110
+
111
+ ## Conversation Commands
112
+
113
+ `runneth-cli conversation` is the machine-oriented conversation interface for
114
+ agents and scripts. It uses the same auth, workspace scoping, and conversation
115
+ API as `runneth chat`, but avoids terminal banners and ANSI UI output.
116
+
117
+ ```bash
118
+ runneth conversation create --workspace "$MONDRIAN_WORKSPACE_ID" --title "SSH routine setup" --json
119
+ runneth conversation send --workspace "$MONDRIAN_WORKSPACE_ID" --conversation "$CONVERSATION_ID" --message "Create a routine" --json
120
+ runneth conversation state --workspace "$MONDRIAN_WORKSPACE_ID" --conversation "$CONVERSATION_ID" --json
121
+ ```
122
+
123
+ `send` waits for the assistant response by default. `send` and `state` require an
124
+ explicit `--conversation`; the CLI does not track an implicit active
125
+ conversation for machine commands. State reads advertise Runneth stream V2, so
126
+ the same command can inspect read-only task-origin transcripts.
127
+
128
+ Long-lived agents can keep one authenticated process open with JSONL over
129
+ stdin/stdout:
130
+
131
+ ```bash
132
+ runneth conversation session --workspace "$MONDRIAN_WORKSPACE_ID" --jsonl
133
+ ```
134
+
135
+ The session `ready` frame reports the resolved client target context, not a
136
+ separate active conversation identity. Authoritative user and conversation
137
+ identity comes from the `conversation` object returned by `create` and `state`.
138
+
139
+ Typical requests:
140
+
141
+ ```jsonl
142
+ {"id":"1","method":"create","params":{"title":"SSH routine setup"}}
143
+ {"id":"2","method":"send","params":{"conversationId":"11111111-1111-4111-8111-111111111111","text":"Create a routine"}}
144
+ {"id":"3","method":"state","params":{"conversationId":"11111111-1111-4111-8111-111111111111"}}
145
+ {"id":"4","method":"close"}
146
+ ```
147
+
148
+ Typical responses:
149
+
150
+ ```jsonl
151
+ {"type":"ready","ok":true,"protocol":"runneth-conversation-stdio","version":1,"authMode":"mondrian","workspaceId":"65cbcb84095884aaf08dc76a"}
152
+ {"id":"1","type":"created","ok":true,"conversation":{"id":"11111111-1111-4111-8111-111111111111"}}
153
+ {"id":"2","type":"sent","ok":true,"send":{"assistantMessageId":"55555555-5555-4555-8555-555555555555"}}
154
+ {"id":"2","type":"state","ok":true,"state":{"conversation":{"id":"11111111-1111-4111-8111-111111111111"}}}
155
+ {"id":"2","type":"complete","ok":true,"assistantMessage":{"id":"55555555-5555-4555-8555-555555555555","status":"completed"}}
156
+ ```
157
+
81
158
  ## SSH
82
159
 
83
160
  `runneth-cli ssh` uses the stored OAuth credential for the resource. If no
84
- credential exists yet, it starts the OAuth login flow first. The first SSH
85
- connection for a resource/app pair generates an ed25519 keypair, sends the
86
- public key to the Runneth SSH app, writes an isolated OpenSSH config, and then
87
- starts `ssh` through the app tunnel.
161
+ credential exists yet, it starts the OAuth login flow first. Pass a conversation
162
+ and workspace to resolve its public SSH app target from Builder, or pass a
163
+ named, host, or URL target directly. The first SSH connection for a resource/app
164
+ pair generates an ed25519 keypair, sends the public key to the Runneth SSH app,
165
+ writes an isolated OpenSSH config, and then starts `ssh` through the app tunnel.
88
166
 
89
167
  ```bash
90
- runneth-cli ssh \
168
+ runneth ssh \
169
+ --conversation 11111111-1111-4111-8111-111111111111 \
170
+ --workspace 22222222-2222-4222-8222-222222222222 \
91
171
  --resource https://projects.motionapp.com/mcp \
92
- --host 93c7ca56-debe-4b95-8be2-a873afe72234.app.runneth.com
172
+ --api https://projects.motionapp.com
93
173
  ```
94
174
 
95
175
  SSH keys, known hosts, and generated config files are stored under
96
176
  `~/.runneth-cli/ssh`. The generated OpenSSH config uses an internal
97
177
  `ProxyCommand` transport that attaches the OAuth bearer token to the SSH app
98
- HTTP tunnel.
178
+ tunnel. The CLI reads the target VM's authenticated `/runneth/ssh/api` metadata
179
+ before connecting, independently of app catalog health:
180
+ VMs that advertise `runneth-ssh-v1` use one full-duplex WebSocket, while older
181
+ VMs continue through the HTTPS tunnel. Transport selection is automatic. Capability
182
+ discovery allows 70 seconds for authorization and response delivery.
99
183
 
100
184
  ### SSH stdio
101
185
 
@@ -103,7 +187,7 @@ Use `ssh stdio` when an agent needs to keep one authenticated SSH connection
103
187
  open and run multiple commands or remote processes without reconnecting:
104
188
 
105
189
  ```bash
106
- runneth-cli ssh stdio --target primary-vm
190
+ runneth ssh stdio --target primary-vm
107
191
  ```
108
192
 
109
193
  The command writes JSONL events to stdout and reads JSONL requests from stdin.
@@ -1 +1,6 @@
1
- export declare const resolveBuildDefaultMcpResourceUrl: () => string | undefined;
1
+ //#region src/build-defaults.d.ts
2
+ declare const resolveBuildDefaultMcpResourceUrl: () => string | undefined;
3
+ declare const resolveBuildDefaultMondrianApiUrl: () => string | undefined;
4
+ declare const resolveBuildDefaultRunnethApiUrl: () => string | undefined;
5
+ //#endregion
6
+ export { resolveBuildDefaultMcpResourceUrl, resolveBuildDefaultMondrianApiUrl, resolveBuildDefaultRunnethApiUrl };
@@ -1,21 +1,36 @@
1
+ //#region src/build-defaults.ts
1
2
  const BUILD_DEFAULT_MONDRIAN_API_URL = "https://projects.motionapp.com/";
2
- const BUILD_DEFAULT_MONDRIAN_API_URL_PLACEHOLDER = "__RUNNETH_CLI_DEFAULT_MONDRIAN_API_URL__";
3
+ const BUILD_DEFAULT_RUNNETH_API_URL = "https://build-be.runneth.com/";
3
4
  const appendMcpPath = (url) => {
4
- const basePath = url.pathname === "/" ? "" : url.pathname.replace(/\/+$/u, "");
5
- url.pathname = `${basePath}/mcp`;
5
+ url.pathname = `${url.pathname === "/" ? "" : url.pathname.replace(/\/+$/u, "")}/mcp`;
6
6
  };
7
- export const resolveBuildDefaultMcpResourceUrl = () => {
8
- const rawApiUrl = BUILD_DEFAULT_MONDRIAN_API_URL.trim();
9
- if (rawApiUrl.length === 0 ||
10
- rawApiUrl === BUILD_DEFAULT_MONDRIAN_API_URL_PLACEHOLDER) {
11
- return undefined;
12
- }
13
- const url = new URL(rawApiUrl);
14
- if (url.protocol !== "http:" && url.protocol !== "https:") {
15
- throw new Error("Build default MONDRIAN_API_URL must use http or https");
16
- }
17
- url.hash = "";
18
- url.search = "";
19
- appendMcpPath(url);
20
- return url.toString();
7
+ const resolveBuildDefaultMcpResourceUrl = () => {
8
+ const apiUrl = resolveBuildDefaultMondrianApiUrl();
9
+ if (apiUrl === void 0) return;
10
+ const url = new URL(apiUrl);
11
+ appendMcpPath(url);
12
+ return url.toString();
21
13
  };
14
+ const normalizeBuildDefaultUrl = (input) => {
15
+ const rawApiUrl = input.value.trim();
16
+ if (rawApiUrl.length === 0 || rawApiUrl.startsWith("__RUNNETH_CLI_DEFAULT_") && rawApiUrl.endsWith("_API_URL__")) return;
17
+ const url = new URL(rawApiUrl);
18
+ if (url.protocol !== "http:" && url.protocol !== "https:") throw new Error(`Build default ${input.envName} must use http or https`);
19
+ url.hash = "";
20
+ url.search = "";
21
+ return url.toString().replace(/\/+$/u, "");
22
+ };
23
+ const resolveBuildDefaultMondrianApiUrl = () => {
24
+ return normalizeBuildDefaultUrl({
25
+ envName: "MONDRIAN_API_URL",
26
+ value: BUILD_DEFAULT_MONDRIAN_API_URL
27
+ });
28
+ };
29
+ const resolveBuildDefaultRunnethApiUrl = () => {
30
+ return normalizeBuildDefaultUrl({
31
+ envName: "BACKEND_URL",
32
+ value: BUILD_DEFAULT_RUNNETH_API_URL
33
+ });
34
+ };
35
+ //#endregion
36
+ export { resolveBuildDefaultMcpResourceUrl, resolveBuildDefaultMondrianApiUrl, resolveBuildDefaultRunnethApiUrl };
package/dist/cli.d.ts CHANGED
@@ -1,2 +1 @@
1
- #!/usr/bin/env node
2
- export {};
1
+ export { };