@stratusagent/cli 0.1.0 → 0.2.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/dist/index.d.ts +43 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1279 -180
- package/dist/index.js.map +1 -1
- package/package.json +6 -5
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { type JsonValue, type Session, type StratusEvent } from '@stratusagent/core';
|
|
1
|
+
import { type AgentMemoryStore, type JsonValue, type Session, type StratusEvent } from '@stratusagent/core';
|
|
2
|
+
import { type ParsedSoul } from '@stratusagent/agents';
|
|
2
3
|
export interface CliStreams {
|
|
3
4
|
stdout: Pick<typeof process.stdout, 'write'>;
|
|
4
5
|
stderr: Pick<typeof process.stderr, 'write'>;
|
|
@@ -10,6 +11,8 @@ export interface CliEnvironment {
|
|
|
10
11
|
setupInput?: NodeJS.ReadableStream;
|
|
11
12
|
processEnv?: NodeJS.ProcessEnv;
|
|
12
13
|
cwd?: string;
|
|
14
|
+
/** Home directory override (tests). Defaults to os.homedir(). */
|
|
15
|
+
homeDir?: string;
|
|
13
16
|
fetch?: typeof fetch;
|
|
14
17
|
openExternal?: (url: string) => Promise<void> | void;
|
|
15
18
|
dashboardAutoShutdownMs?: number;
|
|
@@ -19,7 +22,7 @@ export interface CliRunOptions {
|
|
|
19
22
|
streams?: CliStreams;
|
|
20
23
|
env?: CliEnvironment;
|
|
21
24
|
}
|
|
22
|
-
export type CliProviderName = 'demo' | 'openai';
|
|
25
|
+
export type CliProviderName = 'demo' | 'openai' | 'anthropic';
|
|
23
26
|
export type CliApprovalMode = 'always' | 'ask' | 'never';
|
|
24
27
|
export interface ParsedRunCommand {
|
|
25
28
|
command: 'run';
|
|
@@ -28,6 +31,8 @@ export interface ParsedRunCommand {
|
|
|
28
31
|
model?: string;
|
|
29
32
|
baseUrl?: string;
|
|
30
33
|
configPath?: string;
|
|
34
|
+
/** Path to a soul file defining the agent to run as. */
|
|
35
|
+
soul?: string;
|
|
31
36
|
format: 'text' | 'json';
|
|
32
37
|
events: boolean;
|
|
33
38
|
approvals: CliApprovalMode;
|
|
@@ -47,14 +52,23 @@ export interface ParsedAgentNewCommand {
|
|
|
47
52
|
command: 'agent-new';
|
|
48
53
|
name?: string;
|
|
49
54
|
instructions?: string;
|
|
50
|
-
format: 'text' | 'json';
|
|
55
|
+
format: 'text' | 'json' | 'soul';
|
|
51
56
|
}
|
|
52
57
|
export interface ParsedHelpCommand {
|
|
53
58
|
command: 'help';
|
|
54
59
|
}
|
|
55
60
|
export type ParsedCommand = ParsedRunCommand | ParsedDashboardCommand | ParsedSetupCommand | ParsedAgentNewCommand | ParsedHelpCommand;
|
|
61
|
+
/** A resolved, ready-to-run fallback model (always a real provider). */
|
|
62
|
+
interface FallbackRuntime {
|
|
63
|
+
provider: 'anthropic' | 'openai';
|
|
64
|
+
model: string;
|
|
65
|
+
baseUrl?: string;
|
|
66
|
+
apiKey?: string;
|
|
67
|
+
authToken?: string;
|
|
68
|
+
}
|
|
56
69
|
type RuntimeConfig = {
|
|
57
70
|
provider: 'demo';
|
|
71
|
+
soul?: ParsedSoul;
|
|
58
72
|
} | {
|
|
59
73
|
provider: 'openai';
|
|
60
74
|
model: string;
|
|
@@ -62,13 +76,38 @@ type RuntimeConfig = {
|
|
|
62
76
|
apiKey: string;
|
|
63
77
|
systemPrompt?: string;
|
|
64
78
|
fetch?: typeof fetch;
|
|
79
|
+
soul?: ParsedSoul;
|
|
80
|
+
fallback?: FallbackRuntime;
|
|
81
|
+
} | {
|
|
82
|
+
provider: 'anthropic';
|
|
83
|
+
model: string;
|
|
84
|
+
baseUrl?: string;
|
|
85
|
+
apiKey?: string;
|
|
86
|
+
/** Claude subscription auth (Claude Code setup token). */
|
|
87
|
+
authToken?: string;
|
|
88
|
+
systemPrompt?: string;
|
|
89
|
+
fetch?: typeof fetch;
|
|
90
|
+
soul?: ParsedSoul;
|
|
91
|
+
fallback?: FallbackRuntime;
|
|
65
92
|
};
|
|
93
|
+
/** A stored sign-in for a provider, kept in ~/.stratus/credentials.json. */
|
|
94
|
+
export interface StoredCredential {
|
|
95
|
+
type: 'api_key' | 'oauth_token';
|
|
96
|
+
value: string;
|
|
97
|
+
/**
|
|
98
|
+
* The endpoint this credential belongs to (openai-compatible services).
|
|
99
|
+
* Kept with the credential so a key for a local model or proxy is never
|
|
100
|
+
* sent to a different service, whatever the current default provider is.
|
|
101
|
+
*/
|
|
102
|
+
baseUrl?: string;
|
|
103
|
+
}
|
|
66
104
|
export interface DashboardServerHandle {
|
|
67
105
|
url: string;
|
|
68
106
|
close: () => Promise<void>;
|
|
69
107
|
}
|
|
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
|
|
108
|
+
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 ANTHROPIC_API_KEY=... stratus run --provider anthropic \"Say hello\"\n stratus run --soul ./examples/souls/ava.md \"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 Menu-driven onboarding: pick a provider, sign in (Claude\n subscription or API key), create your agent, and test it \u2014\n settings go to ~/.stratus/config.json, sign-ins to\n ~/.stratus/credentials.json (0600)\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, json, or soul (a ready-to-edit soul file)\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: anthropic, openai, or demo\n --model Model name for real providers (anthropic default: claude-opus-5, openai default: gpt-4.1-mini)\n --base-url Override the provider API base URL\n --soul Run as the agent defined by a soul file (markdown + frontmatter, see examples/souls)\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 first, then a path from --config / STRATUS_CONFIG,\n then the global ~/.stratus/config.json written by `stratus setup`.\n A \"soul\" key (or STRATUS_SOUL) points at a soul file so every run uses that agent.\n Legacy STRATUSCLAW_* env vars and stratusclaw.config.json are still supported for compatibility.\n\nSoul files:\n A soul file is markdown with frontmatter (name, provider, model, tools, credentials)\n followed by the agent's persona in prose. See examples/souls/ava.md.\n";
|
|
71
109
|
declare const stringifyValue: (value: JsonValue) => string;
|
|
110
|
+
export declare const createFileMemoryStore: (filePath: string) => AgentMemoryStore;
|
|
72
111
|
export declare const parseCommand: (argv: string[], env?: CliEnvironment) => ParsedCommand;
|
|
73
112
|
export declare const formatEvent: (event: StratusEvent) => string | null;
|
|
74
113
|
export declare const resolveRuntimeConfig: (command: ParsedRunCommand, env?: CliEnvironment) => Promise<RuntimeConfig>;
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRo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