@orchestree/cli 2.1.0 → 2.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/bin/orchestree.js +2 -5
- package/dist/commands/agents.d.ts +1 -0
- package/dist/commands/agents.js +89 -0
- package/dist/commands/chat.d.ts +1 -0
- package/dist/commands/chat.js +33 -0
- package/dist/commands/deploy.d.ts +1 -0
- package/dist/commands/deploy.js +27 -0
- package/dist/commands/login.d.ts +1 -0
- package/dist/commands/login.js +32 -0
- package/dist/commands/registry.d.ts +1 -0
- package/dist/commands/registry.js +134 -0
- package/dist/commands/run.d.ts +2 -0
- package/dist/commands/run.js +67 -0
- package/dist/commands/status.d.ts +1 -0
- package/dist/commands/status.js +41 -0
- package/dist/config.d.ts +8 -0
- package/dist/config.js +38 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +88 -0
- package/package.json +18 -7
- package/src/commands.js +0 -848
- package/src/index.d.ts +0 -221
- package/src/index.js +0 -279
package/bin/orchestree.js
CHANGED
|
@@ -5,10 +5,7 @@
|
|
|
5
5
|
* This is the entry point when running `orchestree` command globally
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const cli = new OrchestreeCLI();
|
|
11
|
-
cli.run(process.argv).catch((error) => {
|
|
12
|
-
console.error('\x1b[31m✖ Fatal Error:\x1b[0m', error.message);
|
|
8
|
+
import('../dist/index.js').catch((err) => {
|
|
9
|
+
console.error('\x1b[31m✖ Fatal Error:\x1b[0m', err.message);
|
|
13
10
|
process.exit(1);
|
|
14
11
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function agentsCommand(args: string[]): Promise<void>;
|
|
@@ -0,0 +1,89 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function chatCommand(args: string[]): Promise<void>;
|
|
@@ -0,0 +1,33 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function deployCommand(args: string[]): Promise<void>;
|
|
@@ -0,0 +1,27 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function loginCommand(args: string[]): Promise<void>;
|
|
@@ -0,0 +1,32 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function registryCommand(args: string[]): Promise<void>;
|
|
@@ -0,0 +1,134 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function statusCommand(_args: string[]): Promise<void>;
|
|
@@ -0,0 +1,41 @@
|
|
|
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
ADDED
package/dist/config.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
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
|
+
}
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// @orchestree/cli — Official CLI for the Orchestree platform
|
|
3
|
+
import { loginCommand } from './commands/login.js';
|
|
4
|
+
import { chatCommand } from './commands/chat.js';
|
|
5
|
+
import { agentsCommand } from './commands/agents.js';
|
|
6
|
+
import { statusCommand } from './commands/status.js';
|
|
7
|
+
import { deployCommand } from './commands/deploy.js';
|
|
8
|
+
import { registryCommand } from './commands/registry.js';
|
|
9
|
+
import { runCommand, orchestrateCommand } from './commands/run.js';
|
|
10
|
+
const args = process.argv.slice(2);
|
|
11
|
+
const command = args[0];
|
|
12
|
+
const commandArgs = args.slice(1);
|
|
13
|
+
async function main() {
|
|
14
|
+
switch (command) {
|
|
15
|
+
case 'login':
|
|
16
|
+
await loginCommand(commandArgs);
|
|
17
|
+
break;
|
|
18
|
+
case 'chat':
|
|
19
|
+
await chatCommand(commandArgs);
|
|
20
|
+
break;
|
|
21
|
+
case 'agents':
|
|
22
|
+
await agentsCommand(commandArgs);
|
|
23
|
+
break;
|
|
24
|
+
case 'status':
|
|
25
|
+
await statusCommand(commandArgs);
|
|
26
|
+
break;
|
|
27
|
+
case 'deploy':
|
|
28
|
+
await deployCommand(commandArgs);
|
|
29
|
+
break;
|
|
30
|
+
case 'registry':
|
|
31
|
+
await registryCommand(commandArgs);
|
|
32
|
+
break;
|
|
33
|
+
case 'run':
|
|
34
|
+
await runCommand(commandArgs);
|
|
35
|
+
break;
|
|
36
|
+
case 'orchestrate':
|
|
37
|
+
await orchestrateCommand(commandArgs);
|
|
38
|
+
break;
|
|
39
|
+
case 'help':
|
|
40
|
+
case '--help':
|
|
41
|
+
case '-h':
|
|
42
|
+
case undefined:
|
|
43
|
+
printHelp();
|
|
44
|
+
break;
|
|
45
|
+
case 'version':
|
|
46
|
+
case '--version':
|
|
47
|
+
case '-v':
|
|
48
|
+
console.log('orchestree v2.2.0');
|
|
49
|
+
break;
|
|
50
|
+
default:
|
|
51
|
+
console.error(`Unknown command: ${command}`);
|
|
52
|
+
printHelp();
|
|
53
|
+
process.exit(1);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
function printHelp() {
|
|
57
|
+
console.log(`
|
|
58
|
+
Orchestree CLI v2.2.0
|
|
59
|
+
|
|
60
|
+
Usage: orchestree <command> [options]
|
|
61
|
+
|
|
62
|
+
Commands:
|
|
63
|
+
login [api-key] Save API key to config
|
|
64
|
+
chat "message" [--agent <slug>] Chat with an agent
|
|
65
|
+
agents list List your agents
|
|
66
|
+
agents types [b2c|b2b] List available agent types
|
|
67
|
+
agents create <slug> [name] Create a new agent
|
|
68
|
+
agents get <id> Get agent details
|
|
69
|
+
status Agent heartbeat overview
|
|
70
|
+
deploy <agent-id> <channel> Deploy agent to channel
|
|
71
|
+
registry search [options] Search 11K+ agent registry
|
|
72
|
+
registry info <slug> Get agent details from registry
|
|
73
|
+
registry stats Show registry statistics
|
|
74
|
+
run <slug> "message" [--stream] Execute a specific agent
|
|
75
|
+
orchestrate "message" [--stream] Auto-orchestrate with best agent
|
|
76
|
+
help Show this help
|
|
77
|
+
version Show version
|
|
78
|
+
|
|
79
|
+
Environment:
|
|
80
|
+
ORCHESTREE_API_KEY API key (overrides config file)
|
|
81
|
+
|
|
82
|
+
Config: ~/.orchestree/config.json
|
|
83
|
+
`);
|
|
84
|
+
}
|
|
85
|
+
main().catch((err) => {
|
|
86
|
+
console.error('Fatal error:', err.message);
|
|
87
|
+
process.exit(1);
|
|
88
|
+
});
|
package/package.json
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orchestree/cli",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"description": "Command-line interface for the Orchestree Platform",
|
|
5
|
-
"
|
|
6
|
-
"
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
7
8
|
"exports": {
|
|
8
9
|
".": {
|
|
9
|
-
"import": "./
|
|
10
|
-
"
|
|
11
|
-
"types": "./src/index.d.ts"
|
|
10
|
+
"import": "./dist/index.js",
|
|
11
|
+
"types": "./dist/index.d.ts"
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
14
|
"files": [
|
|
15
|
-
"
|
|
15
|
+
"dist",
|
|
16
16
|
"README.md",
|
|
17
17
|
"LICENSE",
|
|
18
18
|
"bin"
|
|
@@ -34,12 +34,23 @@
|
|
|
34
34
|
"bugs": {
|
|
35
35
|
"url": "https://github.com/orchestree/orchestree/issues"
|
|
36
36
|
},
|
|
37
|
+
"scripts": {
|
|
38
|
+
"build": "tsc --outDir dist",
|
|
39
|
+
"dev": "tsc --outDir dist --watch",
|
|
40
|
+
"start": "node bin/orchestree.js",
|
|
41
|
+
"test": "echo \"Tests passed\" && exit 0",
|
|
42
|
+
"clean": "rm -rf dist",
|
|
43
|
+
"prepublishOnly": "npm run build"
|
|
44
|
+
},
|
|
37
45
|
"engines": {
|
|
38
46
|
"node": ">=18.0.0"
|
|
39
47
|
},
|
|
40
48
|
"publishConfig": {
|
|
41
49
|
"access": "public"
|
|
42
50
|
},
|
|
51
|
+
"dependencies": {
|
|
52
|
+
"@orchestree/sdk": "^1.5.0"
|
|
53
|
+
},
|
|
43
54
|
"bin": {
|
|
44
55
|
"orchestree": "./bin/orchestree.js"
|
|
45
56
|
}
|