@orchestree/cli 2.2.0 → 3.5.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.
@@ -1,89 +0,0 @@
1
- // orchestree agents list|create|get
2
- import { OrchestreeClient } from '@orchestree/sdk';
3
- import { getApiKey, loadConfig } from '../config.js';
4
- function getClient() {
5
- const config = loadConfig();
6
- return new OrchestreeClient({
7
- apiKey: getApiKey(),
8
- baseUrl: config.baseUrl,
9
- });
10
- }
11
- export async function agentsCommand(args) {
12
- const subcommand = args[0] ?? 'list';
13
- switch (subcommand) {
14
- case 'list':
15
- await listAgents(args.slice(1));
16
- break;
17
- case 'types':
18
- await listTypes(args.slice(1));
19
- break;
20
- case 'create':
21
- await createAgent(args.slice(1));
22
- break;
23
- case 'get':
24
- await getAgent(args.slice(1));
25
- break;
26
- default:
27
- console.error(`Unknown subcommand: ${subcommand}`);
28
- console.error('Usage: orchestree agents [list|types|create|get]');
29
- process.exit(1);
30
- }
31
- }
32
- async function listAgents(_args) {
33
- const client = getClient();
34
- const agents = await client.agents.list();
35
- if (agents.length === 0) {
36
- console.log('No agents created yet. Run: orchestree agents create <type-slug>');
37
- return;
38
- }
39
- console.log('\nYour Agents:');
40
- console.log('─'.repeat(60));
41
- for (const agent of agents) {
42
- const level = '★'.repeat(agent.relationshipLevel) + '☆'.repeat(5 - agent.relationshipLevel);
43
- console.log(` ${agent.name} (${agent.typeSlug}) [${level}] ${agent.isActive ? '' : '[inactive]'}`);
44
- }
45
- console.log();
46
- }
47
- async function listTypes(args) {
48
- const client = getClient();
49
- const market = args[0];
50
- const types = await client.agents.listTypes(market);
51
- console.log(`\nAgent Types${market ? ` (${market.toUpperCase()})` : ''}:`);
52
- console.log('─'.repeat(60));
53
- for (const type of types) {
54
- console.log(` ${type.icon ?? '●'} ${type.name} (${type.slug}) — ${type.tone}`);
55
- }
56
- console.log();
57
- }
58
- async function createAgent(args) {
59
- const slug = args[0];
60
- const name = args[1];
61
- if (!slug) {
62
- console.error('Usage: orchestree agents create <type-slug> [name]');
63
- process.exit(1);
64
- }
65
- const client = getClient();
66
- const agent = await client.agents.create(slug, name);
67
- console.log(`\nAgent created: ${agent.name} (${agent.typeSlug})`);
68
- console.log(` ID: ${agent.id}`);
69
- console.log(` Relationship Level: ${agent.relationshipLevel}/5`);
70
- console.log();
71
- }
72
- async function getAgent(args) {
73
- const id = args[0];
74
- if (!id) {
75
- console.error('Usage: orchestree agents get <id>');
76
- process.exit(1);
77
- }
78
- const client = getClient();
79
- const agent = await client.agents.get(id);
80
- const level = '★'.repeat(agent.relationshipLevel) + '☆'.repeat(5 - agent.relationshipLevel);
81
- console.log(`\n${agent.name}`);
82
- console.log('─'.repeat(40));
83
- console.log(` Type: ${agent.typeName} (${agent.typeSlug})`);
84
- console.log(` Market: ${agent.market.toUpperCase()}`);
85
- console.log(` Relationship: ${level}`);
86
- console.log(` Active: ${agent.isActive ? 'Yes' : 'No'}`);
87
- console.log(` Created: ${agent.createdAt}`);
88
- console.log();
89
- }
@@ -1 +0,0 @@
1
- export declare function chatCommand(args: string[]): Promise<void>;
@@ -1,33 +0,0 @@
1
- // orchestree chat "message" --agent buddy
2
- import { OrchestreeClient } from '@orchestree/sdk';
3
- import { getApiKey, loadConfig } from '../config.js';
4
- export async function chatCommand(args) {
5
- const message = args[0];
6
- if (!message) {
7
- console.error('Usage: orchestree chat "your message" [--agent <slug>]');
8
- process.exit(1);
9
- }
10
- // Parse --agent flag
11
- let agentType;
12
- const agentIdx = args.indexOf('--agent');
13
- if (agentIdx !== -1 && args[agentIdx + 1]) {
14
- agentType = args[agentIdx + 1];
15
- }
16
- const config = loadConfig();
17
- const client = new OrchestreeClient({
18
- apiKey: getApiKey(),
19
- baseUrl: config.baseUrl,
20
- });
21
- try {
22
- const response = await client.chat.send({
23
- message,
24
- agentType,
25
- });
26
- console.log(`\n[${response.agentType}] ${response.content}\n`);
27
- console.log(`Model: ${response.model} | Tokens: ${response.usage.inputTokens}/${response.usage.outputTokens} | Cost: $${response.usage.costUsd.toFixed(4)}`);
28
- }
29
- catch (err) {
30
- console.error('Chat error:', err.message);
31
- process.exit(1);
32
- }
33
- }
@@ -1 +0,0 @@
1
- export declare function deployCommand(args: string[]): Promise<void>;
@@ -1,27 +0,0 @@
1
- // orchestree deploy — deploy agent to channel
2
- import { OrchestreeClient } from '@orchestree/sdk';
3
- import { getApiKey, loadConfig } from '../config.js';
4
- export async function deployCommand(args) {
5
- const agentId = args[0];
6
- const channel = args[1];
7
- if (!agentId || !channel) {
8
- console.error('Usage: orchestree deploy <agent-id> <channel>');
9
- console.error('Channels: telegram, discord, slack, whatsapp, web, voice');
10
- process.exit(1);
11
- }
12
- const config = loadConfig();
13
- const client = new OrchestreeClient({
14
- apiKey: getApiKey(),
15
- baseUrl: config.baseUrl,
16
- });
17
- try {
18
- const agent = await client.agents.get(agentId);
19
- console.log(`\nDeploying ${agent.name} to ${channel}...`);
20
- console.log('Channel deployment configured. The agent will be available on the next server restart.');
21
- console.log();
22
- }
23
- catch (err) {
24
- console.error('Deploy error:', err.message);
25
- process.exit(1);
26
- }
27
- }
@@ -1 +0,0 @@
1
- export declare function loginCommand(args: string[]): Promise<void>;
@@ -1,32 +0,0 @@
1
- // orchestree login — save API key to config
2
- import { createInterface } from 'readline';
3
- import { saveConfig, loadConfig } from '../config.js';
4
- export async function loginCommand(args) {
5
- const apiKey = args[0];
6
- if (apiKey) {
7
- saveConfig({ apiKey });
8
- console.log('API key saved successfully.');
9
- return;
10
- }
11
- // Interactive prompt
12
- const rl = createInterface({ input: process.stdin, output: process.stdout });
13
- const ask = (question) => new Promise((resolve) => rl.question(question, resolve));
14
- try {
15
- const config = loadConfig();
16
- console.log(`Current base URL: ${config.baseUrl}`);
17
- const key = await ask('Enter your API key: ');
18
- if (!key.trim()) {
19
- console.error('API key cannot be empty.');
20
- process.exit(1);
21
- }
22
- const url = await ask(`Base URL [${config.baseUrl}]: `);
23
- saveConfig({
24
- apiKey: key.trim(),
25
- baseUrl: url.trim() || config.baseUrl,
26
- });
27
- console.log('Configuration saved to ~/.orchestree/config.json');
28
- }
29
- finally {
30
- rl.close();
31
- }
32
- }
@@ -1 +0,0 @@
1
- export declare function registryCommand(args: string[]): Promise<void>;
@@ -1,134 +0,0 @@
1
- // orchestree registry — browse, search, and inspect the agent registry
2
- import { OrchestreeClient } from '@orchestree/sdk';
3
- import { getApiKey, loadConfig } from '../config.js';
4
- export async function registryCommand(args) {
5
- const subcommand = args[0];
6
- switch (subcommand) {
7
- case 'search':
8
- await registrySearch(args.slice(1));
9
- break;
10
- case 'info':
11
- await registryInfo(args.slice(1));
12
- break;
13
- case 'stats':
14
- await registryStats();
15
- break;
16
- default:
17
- console.log(`
18
- Usage: orchestree registry <command>
19
-
20
- Commands:
21
- search [options] Search the agent registry
22
- info <slug> Get agent details
23
- stats Show registry statistics
24
-
25
- Search options:
26
- --vertical <id> Filter by vertical (e.g., V01, V02)
27
- --industry <id> Filter by industry (e.g., I01, I02)
28
- --query <text> Free-text search
29
- --limit <n> Max results (default: 20)
30
- `);
31
- }
32
- }
33
- async function registrySearch(args) {
34
- const config = loadConfig();
35
- const client = new OrchestreeClient({ apiKey: getApiKey(), baseUrl: config.baseUrl });
36
- const params = {};
37
- for (let i = 0; i < args.length; i++) {
38
- if (args[i] === '--vertical' && args[i + 1])
39
- params.vertical = args[++i];
40
- else if (args[i] === '--industry' && args[i + 1])
41
- params.industry = args[++i];
42
- else if (args[i] === '--query' && args[i + 1])
43
- params.query = args[++i];
44
- else if (args[i] === '--limit' && args[i + 1])
45
- params.limit = args[++i];
46
- }
47
- try {
48
- const result = await client.registry.search({
49
- vertical: params.vertical,
50
- industry: params.industry,
51
- query: params.query,
52
- limit: params.limit ? parseInt(params.limit, 10) : 20,
53
- });
54
- const agents = result.data.agents;
55
- if (agents.length === 0) {
56
- console.log('No agents found.');
57
- return;
58
- }
59
- console.log(`\nFound ${result.data.total} agents (showing ${agents.length}):\n`);
60
- for (const agent of agents) {
61
- console.log(` ${agent.slug}`);
62
- console.log(` ${agent.name} | ${agent.vertical} | ${agent.industry} | ${agent.min_tier}`);
63
- console.log(` ${agent.mission.slice(0, 80)}${agent.mission.length > 80 ? '...' : ''}`);
64
- console.log();
65
- }
66
- }
67
- catch (err) {
68
- console.error('Search error:', err.message);
69
- process.exit(1);
70
- }
71
- }
72
- async function registryInfo(args) {
73
- const slug = args[0];
74
- if (!slug) {
75
- console.error('Usage: orchestree registry info <slug>');
76
- process.exit(1);
77
- }
78
- const config = loadConfig();
79
- const client = new OrchestreeClient({ apiKey: getApiKey(), baseUrl: config.baseUrl });
80
- try {
81
- const result = await client.registry.getAgent(slug);
82
- const agent = result.data;
83
- console.log(`
84
- Agent: ${agent.name}
85
- Slug: ${agent.slug}
86
- Version: ${agent.version}
87
-
88
- Vertical: ${agent.vertical}
89
- Subcategory: ${agent.subcategory}
90
- Industry: ${agent.industry}
91
- Specialization: ${agent.specialization}
92
- Min Tier: ${agent.min_tier}
93
-
94
- Domain: ${agent.primary_domain}
95
- Model: ${agent.primary_model}
96
-
97
- Mission:
98
- ${agent.mission}
99
-
100
- Essence:
101
- ${agent.essence}
102
- `);
103
- }
104
- catch (err) {
105
- console.error('Error:', err.message);
106
- process.exit(1);
107
- }
108
- }
109
- async function registryStats() {
110
- const config = loadConfig();
111
- const client = new OrchestreeClient({ apiKey: getApiKey(), baseUrl: config.baseUrl });
112
- try {
113
- const result = await client.registry.getStats();
114
- const stats = result.data;
115
- console.log(`
116
- Registry Statistics
117
- ═══════════════════
118
- Total Agents: ${stats.totalAgents.toLocaleString()}
119
- Indexed At: ${stats.indexedAt}
120
-
121
- By Vertical:`);
122
- for (const [k, v] of Object.entries(stats.byVertical)) {
123
- console.log(` ${k}: ${v}`);
124
- }
125
- console.log('\nBy Tier:');
126
- for (const [k, v] of Object.entries(stats.byTier)) {
127
- console.log(` ${k}: ${v}`);
128
- }
129
- }
130
- catch (err) {
131
- console.error('Error:', err.message);
132
- process.exit(1);
133
- }
134
- }
@@ -1,2 +0,0 @@
1
- export declare function runCommand(args: string[]): Promise<void>;
2
- export declare function orchestrateCommand(args: string[]): Promise<void>;
@@ -1,67 +0,0 @@
1
- // orchestree run — execute agents and orchestrate tasks
2
- import { OrchestreeClient } from '@orchestree/sdk';
3
- import { getApiKey, loadConfig } from '../config.js';
4
- export async function runCommand(args) {
5
- const slug = args[0];
6
- const message = args[1];
7
- if (!slug || !message) {
8
- console.error('Usage: orchestree run <slug> "message" [--stream]');
9
- process.exit(1);
10
- }
11
- const isStream = args.includes('--stream');
12
- const config = loadConfig();
13
- const client = new OrchestreeClient({ apiKey: getApiKey(), baseUrl: config.baseUrl });
14
- try {
15
- if (isStream) {
16
- console.log(`Streaming from ${slug}...\n`);
17
- for await (const event of client.agentRun.stream(slug, { message })) {
18
- if (event.type === 'text_delta') {
19
- process.stdout.write(event.content);
20
- }
21
- else if (event.type === 'error') {
22
- console.error('\nError:', event.error);
23
- }
24
- else if (event.type === 'message_stop') {
25
- console.log('\n');
26
- }
27
- }
28
- }
29
- else {
30
- const result = await client.agentRun.run(slug, { message });
31
- console.log(`\n[${result.data.agentSlug}] ${result.data.content}\n`);
32
- console.log(`Model: ${result.data.model} | Cost: $${result.data.usage.totalCost.toFixed(4)} | Savings: $${result.data.usage.savings.toFixed(4)}`);
33
- }
34
- }
35
- catch (err) {
36
- console.error('Execution error:', err.message);
37
- process.exit(1);
38
- }
39
- }
40
- export async function orchestrateCommand(args) {
41
- const message = args[0];
42
- if (!message) {
43
- console.error('Usage: orchestree orchestrate "message" [--stream]');
44
- process.exit(1);
45
- }
46
- const isStream = args.includes('--stream');
47
- const config = loadConfig();
48
- const client = new OrchestreeClient({ apiKey: getApiKey(), baseUrl: config.baseUrl });
49
- try {
50
- if (isStream) {
51
- console.log('Orchestrating (streaming)...\n');
52
- for await (const event of client.conductor.stream({ message })) {
53
- console.log(`[${event.type}]`, JSON.stringify(event.data));
54
- }
55
- console.log();
56
- }
57
- else {
58
- const result = await client.conductor.run({ message });
59
- console.log(`\n${result.data.result}\n`);
60
- console.log(`Cost: $${result.data.totalCost.toFixed(4)} | Savings: $${result.data.savings.toFixed(4)} | Duration: ${result.data.durationMs}ms`);
61
- }
62
- }
63
- catch (err) {
64
- console.error('Orchestration error:', err.message);
65
- process.exit(1);
66
- }
67
- }
@@ -1 +0,0 @@
1
- export declare function statusCommand(_args: string[]): Promise<void>;
@@ -1,41 +0,0 @@
1
- // orchestree status — heartbeat overview
2
- import { OrchestreeClient } from '@orchestree/sdk';
3
- import { getApiKey, loadConfig } from '../config.js';
4
- export async function statusCommand(_args) {
5
- const config = loadConfig();
6
- const client = new OrchestreeClient({
7
- apiKey: getApiKey(),
8
- baseUrl: config.baseUrl,
9
- });
10
- try {
11
- const telemetry = await client.heartbeat.getAll();
12
- const goals = await client.heartbeat.getGoals();
13
- console.log('\n📊 Agent Status');
14
- console.log('─'.repeat(60));
15
- if (telemetry.length === 0) {
16
- console.log(' No agent telemetry available.');
17
- }
18
- else {
19
- for (const t of telemetry) {
20
- const statusIcon = t.status === 'active' ? '🟢' : t.status === 'idle' ? '🟡' : '🔴';
21
- const energy = Math.round(t.energyLevel * 100);
22
- console.log(` ${statusIcon} Agent ${t.agentInstanceId.slice(0, 8)} — ${t.status} | Energy: ${energy}% | Task: ${t.currentTask ?? 'none'}`);
23
- }
24
- }
25
- if (goals.length > 0) {
26
- console.log('\n🎯 North Star Goals');
27
- console.log('─'.repeat(60));
28
- for (const g of goals) {
29
- const progress = g.targetValue ? Math.round(((g.currentValue ?? 0) / g.targetValue) * 100) : 0;
30
- const bar = '█'.repeat(Math.floor(progress / 5)) + '░'.repeat(20 - Math.floor(progress / 5));
31
- console.log(` ${g.goal}`);
32
- console.log(` [${bar}] ${progress}%${g.deadline ? ` (due: ${g.deadline})` : ''}`);
33
- }
34
- }
35
- console.log();
36
- }
37
- catch (err) {
38
- console.error('Status error:', err.message);
39
- process.exit(1);
40
- }
41
- }
package/dist/config.d.ts DELETED
@@ -1,8 +0,0 @@
1
- export interface CLIConfig {
2
- apiKey?: string;
3
- baseUrl: string;
4
- defaultAgent?: string;
5
- }
6
- export declare function loadConfig(): CLIConfig;
7
- export declare function saveConfig(config: Partial<CLIConfig>): void;
8
- export declare function getApiKey(): string;
package/dist/config.js DELETED
@@ -1,38 +0,0 @@
1
- // CLI configuration — stored in ~/.orchestree/config.json
2
- import { readFileSync, writeFileSync, existsSync, mkdirSync } from 'fs';
3
- import { join } from 'path';
4
- import { homedir } from 'os';
5
- const CONFIG_DIR = join(homedir(), '.orchestree');
6
- const CONFIG_FILE = join(CONFIG_DIR, 'config.json');
7
- const DEFAULT_CONFIG = {
8
- baseUrl: 'https://api.orchestree.ai',
9
- };
10
- export function loadConfig() {
11
- if (!existsSync(CONFIG_FILE)) {
12
- return { ...DEFAULT_CONFIG };
13
- }
14
- try {
15
- const raw = readFileSync(CONFIG_FILE, 'utf-8');
16
- return { ...DEFAULT_CONFIG, ...JSON.parse(raw) };
17
- }
18
- catch {
19
- return { ...DEFAULT_CONFIG };
20
- }
21
- }
22
- export function saveConfig(config) {
23
- if (!existsSync(CONFIG_DIR)) {
24
- mkdirSync(CONFIG_DIR, { recursive: true });
25
- }
26
- const current = loadConfig();
27
- const merged = { ...current, ...config };
28
- writeFileSync(CONFIG_FILE, JSON.stringify(merged, null, 2));
29
- }
30
- export function getApiKey() {
31
- const config = loadConfig();
32
- const key = process.env.ORCHESTREE_API_KEY ?? config.apiKey;
33
- if (!key) {
34
- console.error('No API key configured. Run: orchestree login');
35
- process.exit(1);
36
- }
37
- return key;
38
- }