@stratusagent/cli 0.1.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Stratus Labs
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,82 @@
1
+ # @stratusagent/cli
2
+
3
+ Thin local entrypoint for exercising the Stratus Agent kernel without pulling product UI concerns into the runtime.
4
+
5
+ ## Local usage
6
+
7
+ From the repo root:
8
+
9
+ ```bash
10
+ pnpm install
11
+ pnpm cli run "say hello"
12
+ pnpm cli run --prompt "please use the echo tool"
13
+ echo "please inspect this with the echo tool" | pnpm cli run --stdin
14
+ pnpm cli run --prompt "please use the echo tool" --format json
15
+ pnpm cli dashboard
16
+ pnpm cli dashboard --port 4123 --no-open
17
+ ```
18
+
19
+ ## Real provider usage
20
+
21
+ You can run the CLI against an OpenAI-compatible API instead of only the demo provider.
22
+
23
+ ### Environment-only setup
24
+
25
+ ```bash
26
+ export STRATUS_PROVIDER=openai
27
+ export OPENAI_API_KEY=your-key
28
+ export STRATUS_MODEL=gpt-4.1-mini
29
+ pnpm cli run "Say hello"
30
+ ```
31
+
32
+ Optional:
33
+
34
+ ```bash
35
+ export STRATUS_BASE_URL=https://openrouter.ai/api/v1
36
+ ```
37
+
38
+ ### Config file setup
39
+
40
+ Create `stratus.config.json` in the repo root, or pass `--config`:
41
+
42
+ ```json
43
+ {
44
+ "provider": "openai",
45
+ "model": "gpt-4.1-mini",
46
+ "baseUrl": "https://api.openai.com/v1",
47
+ "apiKeyEnv": "OPENAI_API_KEY"
48
+ }
49
+ ```
50
+
51
+ Then run:
52
+
53
+ ```bash
54
+ export OPENAI_API_KEY=your-key
55
+ pnpm cli run "Say hello"
56
+ ```
57
+
58
+ Legacy `STRATUSCLAW_*` env vars and `stratusclaw.config.json` are still accepted.
59
+
60
+ ## Dashboard
61
+
62
+ `stratus dashboard` starts a small local server, prints the URL, opens your browser, and serves:
63
+
64
+ - `GET /`, a simple Stratus Agent dashboard page
65
+ - `GET /api/status`, a basic status payload
66
+ - `POST /api/echo`, a tiny local test endpoint used by the page
67
+
68
+ This is intentionally dependency-light and built on Node standard library primitives.
69
+
70
+ ## What it does today
71
+
72
+ - runs a single local session against either the demo provider or an OpenAI-compatible provider
73
+ - shows event progress in text mode
74
+ - executes the built-in `demo.echo` tool through `@stratusagent/executor-local`
75
+ - can emit the full session as JSON for scripts and fixtures
76
+ - serves a minimal dashboard for browser-based local smoke tests
77
+
78
+ ## Notes
79
+
80
+ - `pnpm cli ...` runs the TypeScript source directly, so local testing does not require a pre-build step
81
+ - `pnpm demo` is still the quickest smoke test for the demo path
82
+ - real provider mode is text-only for now, it does not expose tool calling yet
package/dist/bin.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=bin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bin.d.ts","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":""}
package/dist/bin.js ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env node
2
+ import { runCli } from "./index.js";
3
+ const exitCode = await runCli({ argv: process.argv.slice(2) });
4
+ if (exitCode !== 0) {
5
+ process.exitCode = exitCode;
6
+ }
7
+ //# sourceMappingURL=bin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bin.js","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEpC,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;AAC/D,IAAI,QAAQ,KAAK,CAAC,EAAE,CAAC;IACnB,OAAO,CAAC,QAAQ,GAAG,QAAQ,CAAC;AAC9B,CAAC"}
@@ -0,0 +1,93 @@
1
+ import { type JsonValue, type Session, type StratusEvent } from '@stratusagent/core';
2
+ export interface CliStreams {
3
+ stdout: Pick<typeof process.stdout, 'write'>;
4
+ stderr: Pick<typeof process.stderr, 'write'>;
5
+ }
6
+ export interface CliEnvironment {
7
+ stdin?: string;
8
+ stdinStream?: NodeJS.ReadableStream;
9
+ approvalInput?: NodeJS.ReadableStream;
10
+ setupInput?: NodeJS.ReadableStream;
11
+ processEnv?: NodeJS.ProcessEnv;
12
+ cwd?: string;
13
+ fetch?: typeof fetch;
14
+ openExternal?: (url: string) => Promise<void> | void;
15
+ dashboardAutoShutdownMs?: number;
16
+ }
17
+ export interface CliRunOptions {
18
+ argv: string[];
19
+ streams?: CliStreams;
20
+ env?: CliEnvironment;
21
+ }
22
+ export type CliProviderName = 'demo' | 'openai';
23
+ export type CliApprovalMode = 'always' | 'ask' | 'never';
24
+ export interface ParsedRunCommand {
25
+ command: 'run';
26
+ prompt: string;
27
+ provider?: CliProviderName;
28
+ model?: string;
29
+ baseUrl?: string;
30
+ configPath?: string;
31
+ format: 'text' | 'json';
32
+ events: boolean;
33
+ approvals: CliApprovalMode;
34
+ maxTurns?: number;
35
+ }
36
+ export interface ParsedDashboardCommand {
37
+ command: 'dashboard';
38
+ port?: number;
39
+ host: string;
40
+ openBrowser: boolean;
41
+ }
42
+ export interface ParsedSetupCommand {
43
+ command: 'setup';
44
+ configPath?: string;
45
+ }
46
+ export interface ParsedAgentNewCommand {
47
+ command: 'agent-new';
48
+ name?: string;
49
+ instructions?: string;
50
+ format: 'text' | 'json';
51
+ }
52
+ export interface ParsedHelpCommand {
53
+ command: 'help';
54
+ }
55
+ export type ParsedCommand = ParsedRunCommand | ParsedDashboardCommand | ParsedSetupCommand | ParsedAgentNewCommand | ParsedHelpCommand;
56
+ type RuntimeConfig = {
57
+ provider: 'demo';
58
+ } | {
59
+ provider: 'openai';
60
+ model: string;
61
+ baseUrl: string;
62
+ apiKey: string;
63
+ systemPrompt?: string;
64
+ fetch?: typeof fetch;
65
+ };
66
+ export interface DashboardServerHandle {
67
+ url: string;
68
+ close: () => Promise<void>;
69
+ }
70
+ declare const HELP_TEXT = "Stratus Agent CLI\n\nUsage:\n stratus setup\n stratus run --prompt \"Use the demo tool\"\n stratus run \"Say hello\"\n echo \"Use the echo tool\" | stratus run --stdin\n STRATUS_PROVIDER=openai OPENAI_API_KEY=... stratus run \"Say hello\"\n stratus run --config ./stratus.config.json --provider openai \"Say hello\"\n stratus dashboard\n stratus dashboard --port 4123 --host 0.0.0.0 --no-open\n\nCommands:\n setup Interactive walkthrough that writes stratus.config.json\n run Execute one local Stratus Agent session\n agent new Create an agent identity (generates a human-ish name + avatar theme)\n dashboard Start the local Stratus Agent dashboard and open it in your browser\n help Show this help message\n\nAgent options:\n --name Agent name (omit to have one generated)\n --instructions The agent's persona/instructions\n --format Output format for agent new: text or json\n\nOptions:\n --prompt, -p Prompt to send to the local agent loop\n --stdin Read the prompt from stdin\n --provider Provider to use: demo or openai\n --model Model name for real providers (default: gpt-4.1-mini)\n --base-url Override the OpenAI-compatible API base URL\n --config Config file path (run: load settings from it, setup: write it)\n --format Output format: text or json (default: text)\n --no-events Hide event-by-event progress lines in text mode\n --approvals Tool approval mode: always, ask, or never (default: always)\n --max-turns Maximum provider turns per run (default: 8)\n --port Dashboard port, defaults to an open local port\n --host Dashboard host (default: 127.0.0.1)\n --no-open Do not open the browser automatically\n --help, -h Show this help message\n\nConfig file:\n The CLI looks for ./stratus.config.json by default, or a path from --config / STRATUS_CONFIG.\n Legacy STRATUSCLAW_* env vars and stratusclaw.config.json are still supported for compatibility.\n";
71
+ declare const stringifyValue: (value: JsonValue) => string;
72
+ export declare const parseCommand: (argv: string[], env?: CliEnvironment) => ParsedCommand;
73
+ export declare const formatEvent: (event: StratusEvent) => string | null;
74
+ export declare const resolveRuntimeConfig: (command: ParsedRunCommand, env?: CliEnvironment) => Promise<RuntimeConfig>;
75
+ export declare const runSingleLoop: (prompt: string, streams: CliStreams, options: {
76
+ events?: boolean;
77
+ runtime: RuntimeConfig;
78
+ approvals?: CliApprovalMode;
79
+ maxTurns?: number;
80
+ env?: CliEnvironment;
81
+ }) => Promise<Session>;
82
+ export declare const printSessionSummary: (session: Session, streams: CliStreams) => void;
83
+ export declare const openExternalUrl: (url: string) => Promise<void>;
84
+ export declare const startDashboardServer: (options: {
85
+ host: string;
86
+ port?: number;
87
+ }) => Promise<DashboardServerHandle>;
88
+ export declare const runSetup: (command: ParsedSetupCommand, streams: CliStreams, env?: CliEnvironment) => Promise<number>;
89
+ export declare const runAgentNew: (command: ParsedAgentNewCommand, streams: CliStreams) => number;
90
+ export declare const runDashboard: (command: ParsedDashboardCommand, streams: CliStreams, env?: CliEnvironment) => Promise<number>;
91
+ export declare const runCli: ({ argv, streams, env }: CliRunOptions) => Promise<number>;
92
+ export { HELP_TEXT, stringifyValue };
93
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1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