@orchagent/cli 0.3.47 → 0.3.48
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/commands/agents.js +1 -8
- package/dist/commands/billing.js +1 -1
- package/dist/commands/index.js +0 -10
- package/dist/commands/publish.js +0 -70
- package/dist/lib/api.js +0 -127
- package/dist/lib/doctor/checks/llm.js +2 -2
- package/dist/lib/output.js +0 -55
- package/package.json +2 -2
- package/dist/commands/fork.js +0 -42
- package/dist/commands/pricing.js +0 -93
- package/dist/commands/search.js +0 -111
- package/dist/commands/seller.js +0 -142
- package/dist/commands/star.js +0 -48
package/dist/commands/agents.js
CHANGED
|
@@ -41,7 +41,6 @@ const chalk_1 = __importDefault(require("chalk"));
|
|
|
41
41
|
const config_1 = require("../lib/config");
|
|
42
42
|
const api_1 = require("../lib/api");
|
|
43
43
|
const output_1 = require("../lib/output");
|
|
44
|
-
const pricing_1 = require("../lib/pricing");
|
|
45
44
|
function registerAgentsCommand(program) {
|
|
46
45
|
program
|
|
47
46
|
.command('agents')
|
|
@@ -65,15 +64,12 @@ function registerAgentsCommand(program) {
|
|
|
65
64
|
: 'No agents published yet.\n\nPublish an agent: orch publish\n');
|
|
66
65
|
return;
|
|
67
66
|
}
|
|
68
|
-
// Print table with pricing
|
|
69
67
|
const Table = (await Promise.resolve().then(() => __importStar(require('cli-table3')))).default;
|
|
70
68
|
const table = new Table({
|
|
71
69
|
head: [
|
|
72
70
|
chalk_1.default.bold('Agent'),
|
|
73
71
|
chalk_1.default.bold('Version'),
|
|
74
72
|
chalk_1.default.bold('Type'),
|
|
75
|
-
chalk_1.default.bold('Stars'),
|
|
76
|
-
chalk_1.default.bold('Price'),
|
|
77
73
|
chalk_1.default.bold('Description'),
|
|
78
74
|
],
|
|
79
75
|
});
|
|
@@ -81,15 +77,12 @@ function registerAgentsCommand(program) {
|
|
|
81
77
|
const name = agent.name;
|
|
82
78
|
const version = agent.version;
|
|
83
79
|
const type = agent.type || 'tool';
|
|
84
|
-
const stars = agent.stars_count ?? 0;
|
|
85
|
-
const price = (0, pricing_1.formatPrice)(agent);
|
|
86
|
-
const coloredPrice = (0, pricing_1.isPaidAgent)(agent) ? chalk_1.default.yellow(price) : chalk_1.default.green(price);
|
|
87
80
|
const desc = agent.description
|
|
88
81
|
? agent.description.length > 60
|
|
89
82
|
? agent.description.slice(0, 57) + '...'
|
|
90
83
|
: agent.description
|
|
91
84
|
: '-';
|
|
92
|
-
table.push([name, version, type,
|
|
85
|
+
table.push([name, version, type, desc]);
|
|
93
86
|
});
|
|
94
87
|
process.stdout.write(`${table.toString()}\n`);
|
|
95
88
|
process.stdout.write(`\nTotal: ${filteredAgents.length} agent${filteredAgents.length === 1 ? '' : 's'}\n`);
|
package/dist/commands/billing.js
CHANGED
|
@@ -14,7 +14,7 @@ const output_1 = require("../lib/output");
|
|
|
14
14
|
function registerBillingCommand(program) {
|
|
15
15
|
const billing = program
|
|
16
16
|
.command('billing')
|
|
17
|
-
.description('Manage
|
|
17
|
+
.description('Manage platform credits and usage');
|
|
18
18
|
// orch billing balance
|
|
19
19
|
billing
|
|
20
20
|
.command('balance')
|
package/dist/commands/index.js
CHANGED
|
@@ -7,9 +7,6 @@ const agents_1 = require("./agents");
|
|
|
7
7
|
const init_1 = require("./init");
|
|
8
8
|
const publish_1 = require("./publish");
|
|
9
9
|
const whoami_1 = require("./whoami");
|
|
10
|
-
const star_1 = require("./star");
|
|
11
|
-
const fork_1 = require("./fork");
|
|
12
|
-
const search_1 = require("./search");
|
|
13
10
|
const keys_1 = require("./keys");
|
|
14
11
|
const run_1 = require("./run");
|
|
15
12
|
const info_1 = require("./info");
|
|
@@ -30,8 +27,6 @@ const list_1 = require("./list");
|
|
|
30
27
|
const test_1 = require("./test");
|
|
31
28
|
const security_1 = require("./security");
|
|
32
29
|
const billing_1 = require("./billing");
|
|
33
|
-
const seller_1 = require("./seller");
|
|
34
|
-
const pricing_1 = require("./pricing");
|
|
35
30
|
function registerCommands(program) {
|
|
36
31
|
(0, login_1.registerLoginCommand)(program);
|
|
37
32
|
(0, whoami_1.registerWhoamiCommand)(program);
|
|
@@ -41,9 +36,6 @@ function registerCommands(program) {
|
|
|
41
36
|
(0, run_1.registerRunCommand)(program);
|
|
42
37
|
(0, info_1.registerInfoCommand)(program);
|
|
43
38
|
(0, agents_1.registerAgentsCommand)(program);
|
|
44
|
-
(0, search_1.registerSearchCommand)(program);
|
|
45
|
-
(0, star_1.registerStarCommand)(program);
|
|
46
|
-
(0, fork_1.registerForkCommand)(program);
|
|
47
39
|
(0, keys_1.registerKeysCommand)(program);
|
|
48
40
|
(0, skill_1.registerSkillCommand)(program);
|
|
49
41
|
(0, delete_1.registerDeleteCommand)(program);
|
|
@@ -62,6 +54,4 @@ function registerCommands(program) {
|
|
|
62
54
|
(0, test_1.registerTestCommand)(program);
|
|
63
55
|
(0, security_1.registerSecurityCommand)(program);
|
|
64
56
|
(0, billing_1.registerBillingCommand)(program);
|
|
65
|
-
(0, seller_1.registerSellerCommand)(program);
|
|
66
|
-
(0, pricing_1.registerPricingCommand)(program);
|
|
67
57
|
}
|
package/dist/commands/publish.js
CHANGED
|
@@ -172,8 +172,6 @@ function registerPublishCommand(program) {
|
|
|
172
172
|
.option('--skills <skills>', 'Default skills (comma-separated, e.g., org/skill@v1,org/other@v1)')
|
|
173
173
|
.option('--skills-locked', 'Lock default skills (callers cannot override via headers)')
|
|
174
174
|
.option('--docker', 'Include Dockerfile for custom environment (builds E2B template)')
|
|
175
|
-
.option('--price <amount>', 'Set price per call in USD (e.g., 0.50 for $0.50/call)')
|
|
176
|
-
.option('--pricing-mode <mode>', 'Pricing mode: free or per_call (default: free)')
|
|
177
175
|
.option('--local-download', 'Allow users to download and run locally (default: server-only)')
|
|
178
176
|
.action(async (options) => {
|
|
179
177
|
if (options.private) {
|
|
@@ -245,46 +243,12 @@ function registerPublishCommand(program) {
|
|
|
245
243
|
});
|
|
246
244
|
const skillVersion = skillResult.agent?.version || 'v1';
|
|
247
245
|
const skillAgentId = skillResult.agent?.id;
|
|
248
|
-
// Handle pricing for skills
|
|
249
|
-
if (skillAgentId && (options.price || options.pricingMode)) {
|
|
250
|
-
let pricingMode = 'free';
|
|
251
|
-
let pricePerCallCents;
|
|
252
|
-
if (options.price) {
|
|
253
|
-
const priceFloat = parseFloat(options.price);
|
|
254
|
-
if (isNaN(priceFloat) || priceFloat < 0) {
|
|
255
|
-
throw new errors_1.CliError('Price must be a positive number', errors_1.ExitCodes.INVALID_INPUT);
|
|
256
|
-
}
|
|
257
|
-
if (priceFloat === 0) {
|
|
258
|
-
pricingMode = 'free';
|
|
259
|
-
}
|
|
260
|
-
else if (priceFloat < 0.01) {
|
|
261
|
-
throw new errors_1.CliError('Price must be at least $0.01 USD', errors_1.ExitCodes.INVALID_INPUT);
|
|
262
|
-
}
|
|
263
|
-
else {
|
|
264
|
-
pricingMode = 'per_call';
|
|
265
|
-
pricePerCallCents = Math.round(priceFloat * 100);
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
else if (options.pricingMode) {
|
|
269
|
-
pricingMode = options.pricingMode === 'per_call' ? 'per_call' : 'free';
|
|
270
|
-
}
|
|
271
|
-
// Set pricing
|
|
272
|
-
if (pricingMode === 'per_call' && !pricePerCallCents) {
|
|
273
|
-
throw new errors_1.CliError('--price required when using per_call mode', errors_1.ExitCodes.INVALID_INPUT);
|
|
274
|
-
}
|
|
275
|
-
await (0, api_1.setAgentPricing)(config, skillAgentId, pricingMode, pricePerCallCents);
|
|
276
|
-
}
|
|
277
246
|
await (0, analytics_1.track)('cli_publish', { agent_type: 'skill', multi_file: hasMultipleFiles });
|
|
278
247
|
process.stdout.write(`\nPublished skill: ${org.slug}/${skillData.frontmatter.name}@${skillVersion}\n`);
|
|
279
248
|
if (hasMultipleFiles) {
|
|
280
249
|
process.stdout.write(`Files: ${skillFiles.length} files included\n`);
|
|
281
250
|
}
|
|
282
251
|
process.stdout.write(`Public: ${options.public ? 'yes' : 'no'}\n`);
|
|
283
|
-
// Show pricing info
|
|
284
|
-
if (options.price && parseFloat(options.price) > 0) {
|
|
285
|
-
const price = parseFloat(options.price);
|
|
286
|
-
process.stdout.write(`Pricing: $${price.toFixed(2)} USD per call\n`);
|
|
287
|
-
}
|
|
288
252
|
process.stdout.write(`\nView analytics and usage: https://orchagent.io/dashboard\n`);
|
|
289
253
|
}
|
|
290
254
|
catch (err) {
|
|
@@ -672,45 +636,11 @@ function registerPublishCommand(program) {
|
|
|
672
636
|
await promises_1.default.rm(tempDir, { recursive: true, force: true });
|
|
673
637
|
}
|
|
674
638
|
}
|
|
675
|
-
// Handle pricing for agents
|
|
676
|
-
if (agentId && (options.price || options.pricingMode)) {
|
|
677
|
-
let pricingMode = 'free';
|
|
678
|
-
let pricePerCallCents;
|
|
679
|
-
if (options.price) {
|
|
680
|
-
const priceFloat = parseFloat(options.price);
|
|
681
|
-
if (isNaN(priceFloat) || priceFloat < 0) {
|
|
682
|
-
throw new errors_1.CliError('Price must be a positive number', errors_1.ExitCodes.INVALID_INPUT);
|
|
683
|
-
}
|
|
684
|
-
if (priceFloat === 0) {
|
|
685
|
-
pricingMode = 'free';
|
|
686
|
-
}
|
|
687
|
-
else if (priceFloat < 0.01) {
|
|
688
|
-
throw new errors_1.CliError('Price must be at least $0.01 USD', errors_1.ExitCodes.INVALID_INPUT);
|
|
689
|
-
}
|
|
690
|
-
else {
|
|
691
|
-
pricingMode = 'per_call';
|
|
692
|
-
pricePerCallCents = Math.round(priceFloat * 100);
|
|
693
|
-
}
|
|
694
|
-
}
|
|
695
|
-
else if (options.pricingMode) {
|
|
696
|
-
pricingMode = options.pricingMode === 'per_call' ? 'per_call' : 'free';
|
|
697
|
-
}
|
|
698
|
-
// Set pricing
|
|
699
|
-
if (pricingMode === 'per_call' && !pricePerCallCents) {
|
|
700
|
-
throw new errors_1.CliError('--price required when using per_call mode', errors_1.ExitCodes.INVALID_INPUT);
|
|
701
|
-
}
|
|
702
|
-
await (0, api_1.setAgentPricing)(config, agentId, pricingMode, pricePerCallCents);
|
|
703
|
-
}
|
|
704
639
|
await (0, analytics_1.track)('cli_publish', { agent_type: manifest.type, hosted: shouldUploadBundle });
|
|
705
640
|
process.stdout.write(`\nPublished agent: ${org.slug}/${manifest.name}@${assignedVersion}\n`);
|
|
706
641
|
process.stdout.write(`Type: ${manifest.type}${shouldUploadBundle ? ' (hosted)' : ''}\n`);
|
|
707
642
|
process.stdout.write(`Providers: ${supportedProviders.join(', ')}\n`);
|
|
708
643
|
process.stdout.write(`Public: ${options.public ? 'yes' : 'no'}\n`);
|
|
709
|
-
// Show pricing info
|
|
710
|
-
if (options.price && parseFloat(options.price) > 0) {
|
|
711
|
-
const price = parseFloat(options.price);
|
|
712
|
-
process.stdout.write(`Pricing: $${price.toFixed(2)} USD per call\n`);
|
|
713
|
-
}
|
|
714
644
|
if (result.service_key) {
|
|
715
645
|
process.stdout.write(`\nService key (save this - shown only once):\n`);
|
|
716
646
|
process.stdout.write(` ${result.service_key}\n`);
|
package/dist/lib/api.js
CHANGED
|
@@ -40,15 +40,9 @@ exports.request = request;
|
|
|
40
40
|
exports.publicRequest = publicRequest;
|
|
41
41
|
exports.getOrg = getOrg;
|
|
42
42
|
exports.updateOrg = updateOrg;
|
|
43
|
-
exports.listPublicAgents = listPublicAgents;
|
|
44
43
|
exports.getPublicAgent = getPublicAgent;
|
|
45
44
|
exports.listMyAgents = listMyAgents;
|
|
46
45
|
exports.createAgent = createAgent;
|
|
47
|
-
exports.starAgent = starAgent;
|
|
48
|
-
exports.unstarAgent = unstarAgent;
|
|
49
|
-
exports.forkAgent = forkAgent;
|
|
50
|
-
exports.searchAgents = searchAgents;
|
|
51
|
-
exports.searchMyAgents = searchMyAgents;
|
|
52
46
|
exports.fetchLlmKeys = fetchLlmKeys;
|
|
53
47
|
exports.downloadCodeBundle = downloadCodeBundle;
|
|
54
48
|
exports.uploadCodeBundle = uploadCodeBundle;
|
|
@@ -67,11 +61,6 @@ exports.deleteEnvironment = deleteEnvironment;
|
|
|
67
61
|
exports.setWorkspaceDefaultEnvironment = setWorkspaceDefaultEnvironment;
|
|
68
62
|
exports.getCreditsBalance = getCreditsBalance;
|
|
69
63
|
exports.createCreditCheckout = createCreditCheckout;
|
|
70
|
-
exports.getSellerStatus = getSellerStatus;
|
|
71
|
-
exports.createSellerOnboarding = createSellerOnboarding;
|
|
72
|
-
exports.getSellerDashboardLink = getSellerDashboardLink;
|
|
73
|
-
exports.getSellerEarnings = getSellerEarnings;
|
|
74
|
-
exports.setAgentPricing = setAgentPricing;
|
|
75
64
|
const errors_1 = require("./errors");
|
|
76
65
|
const DEFAULT_TIMEOUT_MS = 15000;
|
|
77
66
|
const CALL_TIMEOUT_MS = 120000; // 2 minutes for agent calls (can take time)
|
|
@@ -234,21 +223,9 @@ async function updateOrg(config, payload) {
|
|
|
234
223
|
headers: { 'Content-Type': 'application/json' },
|
|
235
224
|
});
|
|
236
225
|
}
|
|
237
|
-
async function listPublicAgents(config, options) {
|
|
238
|
-
const params = new URLSearchParams();
|
|
239
|
-
if (options?.sort)
|
|
240
|
-
params.append('sort', options.sort);
|
|
241
|
-
if (options?.tags?.length)
|
|
242
|
-
params.append('tags', options.tags.join(','));
|
|
243
|
-
if (options?.type)
|
|
244
|
-
params.append('type', options.type);
|
|
245
|
-
const queryStr = params.toString();
|
|
246
|
-
return publicRequest(config, `/public/agents${queryStr ? `?${queryStr}` : ''}`);
|
|
247
|
-
}
|
|
248
226
|
async function getPublicAgent(config, org, agent, version) {
|
|
249
227
|
return publicRequest(config, `/public/agents/${org}/${agent}/${version}`);
|
|
250
228
|
}
|
|
251
|
-
// GitHub-like features
|
|
252
229
|
async function listMyAgents(config) {
|
|
253
230
|
return request(config, 'GET', '/agents');
|
|
254
231
|
}
|
|
@@ -258,85 +235,6 @@ async function createAgent(config, data) {
|
|
|
258
235
|
headers: { 'Content-Type': 'application/json' },
|
|
259
236
|
});
|
|
260
237
|
}
|
|
261
|
-
async function starAgent(config, agentId) {
|
|
262
|
-
return request(config, 'POST', `/agents/${agentId}/star`);
|
|
263
|
-
}
|
|
264
|
-
async function unstarAgent(config, agentId) {
|
|
265
|
-
await request(config, 'DELETE', `/agents/${agentId}/star`);
|
|
266
|
-
}
|
|
267
|
-
async function forkAgent(config, agentId) {
|
|
268
|
-
return request(config, 'POST', `/agents/${agentId}/fork`);
|
|
269
|
-
}
|
|
270
|
-
async function searchAgents(config, query, options) {
|
|
271
|
-
const params = new URLSearchParams();
|
|
272
|
-
if (query)
|
|
273
|
-
params.append('search', query);
|
|
274
|
-
if (options?.sort)
|
|
275
|
-
params.append('sort', options.sort);
|
|
276
|
-
if (options?.tags?.length)
|
|
277
|
-
params.append('tags', options.tags.join(','));
|
|
278
|
-
if (options?.type)
|
|
279
|
-
params.append('type', options.type);
|
|
280
|
-
const queryStr = params.toString();
|
|
281
|
-
return publicRequest(config, `/public/agents${queryStr ? `?${queryStr}` : ''}`);
|
|
282
|
-
}
|
|
283
|
-
/**
|
|
284
|
-
* Search within the authenticated user's own agents (public and private).
|
|
285
|
-
* Uses the authenticated /agents endpoint with client-side filtering.
|
|
286
|
-
*/
|
|
287
|
-
async function searchMyAgents(config, query, options) {
|
|
288
|
-
let agents = await listMyAgents(config);
|
|
289
|
-
// Deduplicate: keep only latest version per agent name
|
|
290
|
-
const latestByName = new Map();
|
|
291
|
-
for (const agent of agents) {
|
|
292
|
-
const existing = latestByName.get(agent.name);
|
|
293
|
-
if (!existing || new Date(agent.created_at) > new Date(existing.created_at)) {
|
|
294
|
-
latestByName.set(agent.name, agent);
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
agents = Array.from(latestByName.values());
|
|
298
|
-
// Apply type filter
|
|
299
|
-
if (options?.type) {
|
|
300
|
-
const typeFilter = options.type;
|
|
301
|
-
if (typeFilter === 'agents') {
|
|
302
|
-
agents = agents.filter(a => a.type === 'prompt' || a.type === 'tool');
|
|
303
|
-
}
|
|
304
|
-
else if (typeFilter === 'skills' || typeFilter === 'skill') {
|
|
305
|
-
agents = agents.filter(a => a.type === 'skill');
|
|
306
|
-
}
|
|
307
|
-
else if (typeFilter === 'tool' || typeFilter === 'prompt') {
|
|
308
|
-
agents = agents.filter(a => a.type === typeFilter);
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
// Apply search filter (match against name and description)
|
|
312
|
-
if (query) {
|
|
313
|
-
const words = query.toLowerCase().replace(/-/g, ' ').split(/\s+/);
|
|
314
|
-
agents = agents.filter(a => {
|
|
315
|
-
const name = (a.name || '').toLowerCase().replace(/-/g, ' ');
|
|
316
|
-
const desc = (a.description || '').toLowerCase();
|
|
317
|
-
return words.every(w => name.includes(w) || desc.includes(w));
|
|
318
|
-
});
|
|
319
|
-
}
|
|
320
|
-
// Map Agent to PublicAgent-compatible objects
|
|
321
|
-
const org = await getOrg(config);
|
|
322
|
-
return agents.map(a => ({
|
|
323
|
-
id: a.id,
|
|
324
|
-
org_name: org.name || org.slug || 'unknown',
|
|
325
|
-
org_slug: a.org_slug || org.slug || 'unknown',
|
|
326
|
-
name: a.name,
|
|
327
|
-
version: a.version,
|
|
328
|
-
type: a.type,
|
|
329
|
-
description: a.description,
|
|
330
|
-
stars_count: a.stars_count ?? 0,
|
|
331
|
-
tags: a.tags ?? [],
|
|
332
|
-
default_endpoint: a.default_endpoint || 'analyze',
|
|
333
|
-
created_at: a.created_at,
|
|
334
|
-
supported_providers: a.supported_providers ?? ['any'],
|
|
335
|
-
is_public: a.is_public,
|
|
336
|
-
pricing_mode: a.pricing_mode,
|
|
337
|
-
price_per_call_cents: a.price_per_call_cents,
|
|
338
|
-
}));
|
|
339
|
-
}
|
|
340
238
|
async function fetchLlmKeys(config) {
|
|
341
239
|
const result = await request(config, 'GET', '/llm-keys/export');
|
|
342
240
|
return result.keys;
|
|
@@ -532,28 +430,3 @@ async function createCreditCheckout(config, amountCents) {
|
|
|
532
430
|
headers: { 'Content-Type': 'application/json' },
|
|
533
431
|
});
|
|
534
432
|
}
|
|
535
|
-
async function getSellerStatus(config) {
|
|
536
|
-
return request(config, 'GET', '/sellers/status');
|
|
537
|
-
}
|
|
538
|
-
async function createSellerOnboarding(config, country) {
|
|
539
|
-
return request(config, 'POST', '/sellers/onboard', {
|
|
540
|
-
body: JSON.stringify({ country }),
|
|
541
|
-
headers: { 'Content-Type': 'application/json' },
|
|
542
|
-
});
|
|
543
|
-
}
|
|
544
|
-
async function getSellerDashboardLink(config) {
|
|
545
|
-
return request(config, 'POST', '/sellers/dashboard-link');
|
|
546
|
-
}
|
|
547
|
-
async function getSellerEarnings(config) {
|
|
548
|
-
return request(config, 'GET', '/billing/earnings');
|
|
549
|
-
}
|
|
550
|
-
async function setAgentPricing(config, agentId, pricingMode, pricePerCallCents, allowLocalDownload) {
|
|
551
|
-
return request(config, 'PUT', `/agents/${agentId}/pricing`, {
|
|
552
|
-
body: JSON.stringify({
|
|
553
|
-
pricing_mode: pricingMode,
|
|
554
|
-
price_per_call_cents: pricePerCallCents,
|
|
555
|
-
allow_local_download: allowLocalDownload,
|
|
556
|
-
}),
|
|
557
|
-
headers: { 'Content-Type': 'application/json' },
|
|
558
|
-
});
|
|
559
|
-
}
|
|
@@ -128,7 +128,7 @@ async function runLlmChecks(options) {
|
|
|
128
128
|
if (configuredCount === 0) {
|
|
129
129
|
summaryStatus = 'warning';
|
|
130
130
|
summaryMessage = 'No LLM providers configured';
|
|
131
|
-
summaryFix = firstUnconfigured ? `Run:
|
|
131
|
+
summaryFix = firstUnconfigured ? `Run: orchagent keys add ${firstUnconfigured.providerId}` : undefined;
|
|
132
132
|
}
|
|
133
133
|
else {
|
|
134
134
|
summaryStatus = 'success';
|
|
@@ -136,7 +136,7 @@ async function runLlmChecks(options) {
|
|
|
136
136
|
configuredCount < 2
|
|
137
137
|
? 'Tip: Multiple providers enable automatic rate limit fallback.'
|
|
138
138
|
: `${configuredCount} providers configured`;
|
|
139
|
-
summaryFix = firstUnconfigured ? `Run:
|
|
139
|
+
summaryFix = firstUnconfigured ? `Run: orchagent keys add ${firstUnconfigured.providerId}` : undefined;
|
|
140
140
|
}
|
|
141
141
|
results.push({
|
|
142
142
|
category: 'llm',
|
package/dist/lib/output.js
CHANGED
|
@@ -1,61 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.printJson = printJson;
|
|
7
|
-
exports.printAgentsTable = printAgentsTable;
|
|
8
|
-
const cli_table3_1 = __importDefault(require("cli-table3"));
|
|
9
|
-
const chalk_1 = __importDefault(require("chalk"));
|
|
10
|
-
const pricing_1 = require("./pricing");
|
|
11
4
|
function printJson(value) {
|
|
12
5
|
process.stdout.write(`${JSON.stringify(value, null, 2)}\n`);
|
|
13
6
|
}
|
|
14
|
-
function printAgentsTable(agents, options) {
|
|
15
|
-
const head = [
|
|
16
|
-
chalk_1.default.bold('Agent'),
|
|
17
|
-
chalk_1.default.bold('Type'),
|
|
18
|
-
...(options?.showVisibility ? [chalk_1.default.bold('Visibility')] : []),
|
|
19
|
-
chalk_1.default.bold('Providers'),
|
|
20
|
-
chalk_1.default.bold('Stars'),
|
|
21
|
-
chalk_1.default.bold('Price'),
|
|
22
|
-
chalk_1.default.bold('Description'),
|
|
23
|
-
];
|
|
24
|
-
const table = new cli_table3_1.default({ head });
|
|
25
|
-
agents.forEach((agent) => {
|
|
26
|
-
const fullName = `${agent.org_slug}/${agent.name}`;
|
|
27
|
-
const type = agent.type || 'tool';
|
|
28
|
-
const providers = formatProviders(agent.supported_providers);
|
|
29
|
-
const stars = agent.stars_count ?? 0;
|
|
30
|
-
const price = (0, pricing_1.formatPrice)(agent);
|
|
31
|
-
const priceColored = (0, pricing_1.isPaidAgent)(agent) ? chalk_1.default.yellow(price) : chalk_1.default.green(price);
|
|
32
|
-
const desc = agent.description
|
|
33
|
-
? agent.description.length > 60
|
|
34
|
-
? agent.description.slice(0, 57) + '...'
|
|
35
|
-
: agent.description
|
|
36
|
-
: '-';
|
|
37
|
-
const visibility = agent.is_public === false
|
|
38
|
-
? chalk_1.default.yellow('private')
|
|
39
|
-
: chalk_1.default.green('public');
|
|
40
|
-
const row = [fullName, type];
|
|
41
|
-
if (options?.showVisibility)
|
|
42
|
-
row.push(visibility);
|
|
43
|
-
row.push(providers, stars.toString(), priceColored, desc);
|
|
44
|
-
table.push(row);
|
|
45
|
-
});
|
|
46
|
-
process.stdout.write(`${table.toString()}\n`);
|
|
47
|
-
}
|
|
48
|
-
function formatProviders(providers) {
|
|
49
|
-
if (!providers || providers.length === 0 || providers.includes('any')) {
|
|
50
|
-
return chalk_1.default.green('any');
|
|
51
|
-
}
|
|
52
|
-
return providers.map(p => {
|
|
53
|
-
if (p === 'openai')
|
|
54
|
-
return chalk_1.default.cyan('openai');
|
|
55
|
-
if (p === 'anthropic')
|
|
56
|
-
return chalk_1.default.magenta('anthropic');
|
|
57
|
-
if (p === 'gemini')
|
|
58
|
-
return chalk_1.default.yellow('gemini');
|
|
59
|
-
return p;
|
|
60
|
-
}).join(', ');
|
|
61
|
-
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orchagent/cli",
|
|
3
|
-
"version": "0.3.
|
|
4
|
-
"description": "Command-line interface for
|
|
3
|
+
"version": "0.3.48",
|
|
4
|
+
"description": "Command-line interface for orchagent — deploy and run AI agents for your team",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "orchagent <hello@orchagent.io>",
|
|
7
7
|
"homepage": "https://orchagent.io",
|
package/dist/commands/fork.js
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.registerForkCommand = registerForkCommand;
|
|
4
|
-
const config_1 = require("../lib/config");
|
|
5
|
-
const api_1 = require("../lib/api");
|
|
6
|
-
const errors_1 = require("../lib/errors");
|
|
7
|
-
const analytics_1 = require("../lib/analytics");
|
|
8
|
-
function parseAgentRef(ref) {
|
|
9
|
-
// Format: org/agent/version or org/agent (defaults to v1)
|
|
10
|
-
const parts = ref.split('/');
|
|
11
|
-
if (parts.length < 2 || parts.length > 3) {
|
|
12
|
-
throw new errors_1.CliError('Invalid agent reference. Use: org/agent or org/agent/version');
|
|
13
|
-
}
|
|
14
|
-
return {
|
|
15
|
-
org: parts[0],
|
|
16
|
-
name: parts[1],
|
|
17
|
-
version: parts[2] || 'v1',
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
function registerForkCommand(program) {
|
|
21
|
-
program
|
|
22
|
-
.command('fork')
|
|
23
|
-
.description('Fork an agent to your account')
|
|
24
|
-
.argument('<agent>', 'Agent reference (org/name or org/name/version)')
|
|
25
|
-
.action(async (agent) => {
|
|
26
|
-
const config = await (0, config_1.getResolvedConfig)();
|
|
27
|
-
const { org, name, version } = parseAgentRef(agent);
|
|
28
|
-
// Get the agent to get its ID
|
|
29
|
-
const agentInfo = await (0, api_1.getPublicAgent)(config, org, name, version);
|
|
30
|
-
// Fork it
|
|
31
|
-
const result = await (0, api_1.forkAgent)(config, agentInfo.id);
|
|
32
|
-
// Get our org info
|
|
33
|
-
const myOrg = await (0, api_1.getOrg)(config);
|
|
34
|
-
await (0, analytics_1.track)('cli_fork', { agent: `${org}/${name}/${version}` });
|
|
35
|
-
process.stdout.write(`Forked ${org}/${name}/${version} to your account\n`);
|
|
36
|
-
process.stdout.write(`\nYour forked agent: ${myOrg.slug}/${name}/v1\n`);
|
|
37
|
-
process.stdout.write(`\nNext steps:\n`);
|
|
38
|
-
process.stdout.write(` 1. Run: orchagent install ${myOrg.slug}/${name}\n`);
|
|
39
|
-
process.stdout.write(` 2. Edit the prompt and schemas locally\n`);
|
|
40
|
-
process.stdout.write(` 3. Run: orchagent publish\n`);
|
|
41
|
-
});
|
|
42
|
-
}
|
package/dist/commands/pricing.js
DELETED
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.registerPricingCommand = registerPricingCommand;
|
|
7
|
-
const chalk_1 = __importDefault(require("chalk"));
|
|
8
|
-
const config_1 = require("../lib/config");
|
|
9
|
-
const api_1 = require("../lib/api");
|
|
10
|
-
const errors_1 = require("../lib/errors");
|
|
11
|
-
function registerPricingCommand(program) {
|
|
12
|
-
program
|
|
13
|
-
.command('pricing <agent> <mode>')
|
|
14
|
-
.description('Set pricing for your agent (free or per-call in USD)')
|
|
15
|
-
.option('--local-download', 'Allow users to download and run locally')
|
|
16
|
-
.option('--no-local-download', 'Restrict to server-only (cloud execution)')
|
|
17
|
-
.action(async (agentRef, mode, options) => {
|
|
18
|
-
const resolved = await (0, config_1.getResolvedConfig)();
|
|
19
|
-
// Parse agent reference
|
|
20
|
-
const [orgOrAgent, maybeName] = agentRef.split('/');
|
|
21
|
-
let org;
|
|
22
|
-
let agentName;
|
|
23
|
-
if (maybeName) {
|
|
24
|
-
// Format: org/agent
|
|
25
|
-
org = orgOrAgent;
|
|
26
|
-
agentName = maybeName;
|
|
27
|
-
}
|
|
28
|
-
else {
|
|
29
|
-
// Format: agent (use default org)
|
|
30
|
-
const userOrg = await (0, api_1.getOrg)(resolved);
|
|
31
|
-
org = userOrg.slug;
|
|
32
|
-
agentName = orgOrAgent;
|
|
33
|
-
}
|
|
34
|
-
// Look up agent ID
|
|
35
|
-
const myAgents = await (0, api_1.listMyAgents)(resolved);
|
|
36
|
-
const agent = myAgents.find(a => a.org_slug === org && a.name === agentName);
|
|
37
|
-
if (!agent) {
|
|
38
|
-
throw new errors_1.CliError(`Agent '${org}/${agentName}' not found in your agents.\n\n` +
|
|
39
|
-
`List your agents: orch agents`, errors_1.ExitCodes.NOT_FOUND);
|
|
40
|
-
}
|
|
41
|
-
// Parse pricing mode
|
|
42
|
-
let pricingMode;
|
|
43
|
-
let pricePerCallCents;
|
|
44
|
-
if (mode === 'free' || mode === '0') {
|
|
45
|
-
pricingMode = 'free';
|
|
46
|
-
pricePerCallCents = undefined;
|
|
47
|
-
}
|
|
48
|
-
else {
|
|
49
|
-
// Parse as dollar amount
|
|
50
|
-
const priceFloat = parseFloat(mode);
|
|
51
|
-
if (isNaN(priceFloat)) {
|
|
52
|
-
throw new errors_1.CliError(`Invalid pricing mode: ${mode}\n\n` +
|
|
53
|
-
`Use "free" or a dollar amount (e.g., "0.50" for $0.50 USD)`, errors_1.ExitCodes.INVALID_INPUT);
|
|
54
|
-
}
|
|
55
|
-
if (priceFloat < 0.01) {
|
|
56
|
-
throw new errors_1.CliError('Price must be at least $0.01 USD', errors_1.ExitCodes.INVALID_INPUT);
|
|
57
|
-
}
|
|
58
|
-
pricingMode = 'per_call';
|
|
59
|
-
pricePerCallCents = Math.round(priceFloat * 100);
|
|
60
|
-
}
|
|
61
|
-
// Determine allow_local_download value
|
|
62
|
-
let allowLocalDownload;
|
|
63
|
-
if (pricingMode === 'per_call') {
|
|
64
|
-
// Paid agents are always server-only
|
|
65
|
-
allowLocalDownload = false;
|
|
66
|
-
if (options.localDownload) {
|
|
67
|
-
process.stderr.write(chalk_1.default.yellow('Note: Paid agents are always server-only. --local-download ignored.\n'));
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
else if (options.localDownload !== undefined) {
|
|
71
|
-
allowLocalDownload = options.localDownload;
|
|
72
|
-
}
|
|
73
|
-
// Set pricing
|
|
74
|
-
await (0, api_1.setAgentPricing)(resolved, agent.id, pricingMode, pricePerCallCents, allowLocalDownload);
|
|
75
|
-
// Show confirmation
|
|
76
|
-
process.stdout.write(chalk_1.default.green('✓ Pricing updated\n'));
|
|
77
|
-
process.stdout.write(`Agent: ${org}/${agentName}\n`);
|
|
78
|
-
if (pricingMode === 'free') {
|
|
79
|
-
process.stdout.write(`Mode: FREE\n`);
|
|
80
|
-
if (allowLocalDownload === true) {
|
|
81
|
-
process.stdout.write(`Local download: enabled\n`);
|
|
82
|
-
}
|
|
83
|
-
else if (allowLocalDownload === false) {
|
|
84
|
-
process.stdout.write(`Local download: disabled (server-only)\n`);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
else {
|
|
88
|
-
process.stdout.write(`Mode: Pay per call\n`);
|
|
89
|
-
process.stdout.write(`Price: $${(pricePerCallCents / 100).toFixed(2)} USD per call\n`);
|
|
90
|
-
process.stdout.write(`Local download: disabled (paid agents are server-only)\n`);
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
}
|
package/dist/commands/search.js
DELETED
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.registerSearchCommand = registerSearchCommand;
|
|
4
|
-
const config_1 = require("../lib/config");
|
|
5
|
-
const api_1 = require("../lib/api");
|
|
6
|
-
const output_1 = require("../lib/output");
|
|
7
|
-
const analytics_1 = require("../lib/analytics");
|
|
8
|
-
const pricing_1 = require("../lib/pricing");
|
|
9
|
-
const DEFAULT_LIMIT = 20;
|
|
10
|
-
function registerSearchCommand(program) {
|
|
11
|
-
program
|
|
12
|
-
.command('search')
|
|
13
|
-
.description('Search for agents and skills')
|
|
14
|
-
.argument('[query]', 'Search query (required unless using --popular or --recent)')
|
|
15
|
-
.option('--popular', 'Show top agents/skills by stars')
|
|
16
|
-
.option('--recent', 'Show most recently published')
|
|
17
|
-
.option('--mine', 'Show only your own agents (including private)')
|
|
18
|
-
.option('--type <type>', 'Filter by type: agents, skills, code, prompt, skill, all (default: all)', 'all')
|
|
19
|
-
.option('--tags <tags>', 'Filter by tags (comma-separated, e.g., security,devops)')
|
|
20
|
-
.option('--limit <n>', `Max results (default: ${DEFAULT_LIMIT})`, String(DEFAULT_LIMIT))
|
|
21
|
-
.option('--free', 'Show only free agents')
|
|
22
|
-
.option('--paid', 'Show only paid agents')
|
|
23
|
-
.option('--json', 'Output raw JSON')
|
|
24
|
-
.addHelpText('after', `
|
|
25
|
-
Pricing Filters:
|
|
26
|
-
--free Show only free agents
|
|
27
|
-
--paid Show only paid agents
|
|
28
|
-
|
|
29
|
-
Tag Filters:
|
|
30
|
-
--tags security,devops Show agents matching any of these tags
|
|
31
|
-
|
|
32
|
-
Ownership Filters:
|
|
33
|
-
--mine Show your own agents (public and private). Requires login.
|
|
34
|
-
`)
|
|
35
|
-
.action(async (query, options) => {
|
|
36
|
-
const config = await (0, config_1.getResolvedConfig)();
|
|
37
|
-
const limit = parseInt(options.limit, 10) || DEFAULT_LIMIT;
|
|
38
|
-
// Map type filter for API (null means no filter)
|
|
39
|
-
const typeFilter = options.type === 'all' ? undefined : options.type;
|
|
40
|
-
const sort = options.popular ? 'stars' : options.recent ? 'recent' : undefined;
|
|
41
|
-
const tags = options.tags ? options.tags.split(',').map(t => t.trim()).filter(Boolean) : undefined;
|
|
42
|
-
let agents;
|
|
43
|
-
if (options.mine) {
|
|
44
|
-
// --mine: search within user's own agents (public + private)
|
|
45
|
-
if (!config.apiKey) {
|
|
46
|
-
process.stderr.write('Error: --mine requires authentication. Run `orchagent login` first.\n');
|
|
47
|
-
process.exitCode = 1;
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
agents = await (0, api_1.searchMyAgents)(config, query, { sort, type: typeFilter });
|
|
51
|
-
await (0, analytics_1.track)('cli_search', { query, type: options.type, mine: true });
|
|
52
|
-
}
|
|
53
|
-
else {
|
|
54
|
-
// Default to popular when no args
|
|
55
|
-
if (!query && !options.popular && !options.recent) {
|
|
56
|
-
options.popular = true;
|
|
57
|
-
}
|
|
58
|
-
if (query) {
|
|
59
|
-
agents = await (0, api_1.searchAgents)(config, query, { sort, tags, type: typeFilter });
|
|
60
|
-
await (0, analytics_1.track)('cli_search', { query, type: options.type, tags: options.tags });
|
|
61
|
-
}
|
|
62
|
-
else {
|
|
63
|
-
agents = await (0, api_1.listPublicAgents)(config, { sort, tags, type: typeFilter });
|
|
64
|
-
await (0, analytics_1.track)('cli_search', { mode: options.popular ? 'popular' : 'recent', type: options.type, tags: options.tags });
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
// Filter by pricing if requested
|
|
68
|
-
if (options.free) {
|
|
69
|
-
agents = agents.filter(a => !(0, pricing_1.isPaidAgent)(a));
|
|
70
|
-
}
|
|
71
|
-
if (options.paid) {
|
|
72
|
-
agents = agents.filter(a => (0, pricing_1.isPaidAgent)(a));
|
|
73
|
-
}
|
|
74
|
-
// Sort results
|
|
75
|
-
if (options.popular || (!query && !options.recent && !options.mine)) {
|
|
76
|
-
agents.sort((a, b) => (b.stars_count ?? 0) - (a.stars_count ?? 0));
|
|
77
|
-
}
|
|
78
|
-
else if (options.recent) {
|
|
79
|
-
agents.sort((a, b) => (b.created_at ?? '').localeCompare(a.created_at ?? ''));
|
|
80
|
-
}
|
|
81
|
-
// Apply limit
|
|
82
|
-
agents = agents.slice(0, limit);
|
|
83
|
-
if (options.json) {
|
|
84
|
-
(0, output_1.printJson)(agents);
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
if (agents.length === 0) {
|
|
88
|
-
if (options.mine) {
|
|
89
|
-
process.stdout.write(query
|
|
90
|
-
? `No agents found matching "${query}" in your account.\n`
|
|
91
|
-
: 'You have no published agents yet.\n');
|
|
92
|
-
process.stdout.write('\nTip: Run "orchagent init" to create your first agent.\n');
|
|
93
|
-
}
|
|
94
|
-
else {
|
|
95
|
-
process.stdout.write(query ? 'No results found matching your search.\n' : 'No public agents found.\n');
|
|
96
|
-
process.stdout.write('\nView all agents at: https://orchagent.io/explore\n');
|
|
97
|
-
}
|
|
98
|
-
return;
|
|
99
|
-
}
|
|
100
|
-
(0, output_1.printAgentsTable)(agents, { showVisibility: options.mine });
|
|
101
|
-
if (agents.length === limit) {
|
|
102
|
-
process.stdout.write(`\nShowing top ${limit} results. Use --limit <n> for more.\n`);
|
|
103
|
-
}
|
|
104
|
-
if (options.mine) {
|
|
105
|
-
process.stdout.write('\nTip: Run "orchagent info <agent>" to see details, or "orchagent delete <agent>" to remove.\n');
|
|
106
|
-
}
|
|
107
|
-
else {
|
|
108
|
-
process.stdout.write('\nTip: Run "orchagent info <agent>" to see input schema and details.\n');
|
|
109
|
-
}
|
|
110
|
-
});
|
|
111
|
-
}
|
package/dist/commands/seller.js
DELETED
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.registerSellerCommand = registerSellerCommand;
|
|
7
|
-
const cli_table3_1 = __importDefault(require("cli-table3"));
|
|
8
|
-
const chalk_1 = __importDefault(require("chalk"));
|
|
9
|
-
const open_1 = __importDefault(require("open"));
|
|
10
|
-
const config_1 = require("../lib/config");
|
|
11
|
-
const api_1 = require("../lib/api");
|
|
12
|
-
const api_2 = require("../lib/api");
|
|
13
|
-
const errors_1 = require("../lib/errors");
|
|
14
|
-
const output_1 = require("../lib/output");
|
|
15
|
-
function registerSellerCommand(program) {
|
|
16
|
-
const seller = program
|
|
17
|
-
.command('seller')
|
|
18
|
-
.description('Manage monetization account for your agents');
|
|
19
|
-
// orch seller onboard
|
|
20
|
-
seller
|
|
21
|
-
.command('onboard')
|
|
22
|
-
.description('Start Stripe monetization onboarding process')
|
|
23
|
-
.option('--country <code>', 'Country code (default: GB)', 'GB')
|
|
24
|
-
.action(async (options) => {
|
|
25
|
-
const resolved = await (0, config_1.getResolvedConfig)();
|
|
26
|
-
const country = options.country || 'GB';
|
|
27
|
-
// Create onboarding session
|
|
28
|
-
const response = await (0, api_1.createSellerOnboarding)(resolved, country);
|
|
29
|
-
// Open in browser
|
|
30
|
-
process.stdout.write(`\nOpening Stripe onboarding...\n`);
|
|
31
|
-
process.stdout.write(`Country: ${country}\n\n`);
|
|
32
|
-
await (0, open_1.default)(response.onboarding_url);
|
|
33
|
-
process.stdout.write(chalk_1.default.gray(`If browser doesn't open, visit:\n${response.onboarding_url}\n`));
|
|
34
|
-
});
|
|
35
|
-
// orch seller status
|
|
36
|
-
seller
|
|
37
|
-
.command('status')
|
|
38
|
-
.description('Check monetization account status')
|
|
39
|
-
.option('--json', 'Output as JSON')
|
|
40
|
-
.action(async (options) => {
|
|
41
|
-
const resolved = await (0, config_1.getResolvedConfig)();
|
|
42
|
-
const status = await (0, api_1.getSellerStatus)(resolved);
|
|
43
|
-
if (options.json) {
|
|
44
|
-
(0, output_1.printJson)(status);
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
// Display status
|
|
48
|
-
if (!status.onboarded) {
|
|
49
|
-
process.stdout.write(chalk_1.default.yellow('\nNot onboarded\n\n'));
|
|
50
|
-
process.stdout.write('Enable monetization: orch seller onboard\n');
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
process.stdout.write(chalk_1.default.green('\n✓ Onboarded\n\n'));
|
|
54
|
-
if (status.charges_enabled !== undefined) {
|
|
55
|
-
const chargesStatus = status.charges_enabled ? chalk_1.default.green('✓ Enabled') : chalk_1.default.yellow('⚠ Disabled');
|
|
56
|
-
process.stdout.write(`Charges: ${chargesStatus}\n`);
|
|
57
|
-
}
|
|
58
|
-
if (status.payouts_enabled !== undefined) {
|
|
59
|
-
const payoutsStatus = status.payouts_enabled ? chalk_1.default.green('✓ Enabled') : chalk_1.default.yellow('⚠ Disabled');
|
|
60
|
-
process.stdout.write(`Payouts: ${payoutsStatus}\n`);
|
|
61
|
-
}
|
|
62
|
-
if (!status.charges_enabled || !status.payouts_enabled) {
|
|
63
|
-
process.stdout.write(chalk_1.default.gray('\nComplete setup: orch seller dashboard\n'));
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
// orch seller dashboard
|
|
67
|
-
seller
|
|
68
|
-
.command('dashboard')
|
|
69
|
-
.description('Open Stripe Express dashboard')
|
|
70
|
-
.action(async () => {
|
|
71
|
-
const resolved = await (0, config_1.getResolvedConfig)();
|
|
72
|
-
try {
|
|
73
|
-
const response = await (0, api_1.getSellerDashboardLink)(resolved);
|
|
74
|
-
// Open in browser
|
|
75
|
-
process.stdout.write('\nOpening Stripe dashboard...\n\n');
|
|
76
|
-
await (0, open_1.default)(response.dashboard_url);
|
|
77
|
-
process.stdout.write(chalk_1.default.gray(`If browser doesn't open, visit:\n${response.dashboard_url}\n`));
|
|
78
|
-
}
|
|
79
|
-
catch (err) {
|
|
80
|
-
if (err instanceof api_2.ApiError && (err.status === 404 || err.status === 403)) {
|
|
81
|
-
process.stdout.write(chalk_1.default.yellow('\nNo monetization account found\n\n'));
|
|
82
|
-
process.stdout.write('Complete onboarding: orch seller onboard\n');
|
|
83
|
-
process.exit(errors_1.ExitCodes.NOT_FOUND);
|
|
84
|
-
}
|
|
85
|
-
throw err;
|
|
86
|
-
}
|
|
87
|
-
});
|
|
88
|
-
// orch seller earnings
|
|
89
|
-
seller
|
|
90
|
-
.command('earnings')
|
|
91
|
-
.description('Show earnings from your agents')
|
|
92
|
-
.option('--json', 'Output as JSON')
|
|
93
|
-
.action(async (options) => {
|
|
94
|
-
const resolved = await (0, config_1.getResolvedConfig)();
|
|
95
|
-
const earnings = await (0, api_1.getSellerEarnings)(resolved);
|
|
96
|
-
if (options.json) {
|
|
97
|
-
(0, output_1.printJson)(earnings);
|
|
98
|
-
return;
|
|
99
|
-
}
|
|
100
|
-
// Show total earnings
|
|
101
|
-
const total = earnings.total_earnings_cents / 100;
|
|
102
|
-
process.stdout.write(chalk_1.default.bold(`\nTotal Earnings: ${chalk_1.default.green(`$${total.toFixed(2)} USD`)}\n\n`));
|
|
103
|
-
// Show earnings by agent
|
|
104
|
-
if (earnings.by_agent && earnings.by_agent.length > 0) {
|
|
105
|
-
process.stdout.write(chalk_1.default.bold('Earnings by Agent:\n'));
|
|
106
|
-
const table = new cli_table3_1.default({
|
|
107
|
-
head: [
|
|
108
|
-
chalk_1.default.bold('Agent'),
|
|
109
|
-
chalk_1.default.bold('Calls'),
|
|
110
|
-
chalk_1.default.bold('Earnings'),
|
|
111
|
-
],
|
|
112
|
-
});
|
|
113
|
-
earnings.by_agent.forEach((item) => {
|
|
114
|
-
const earningsStr = `$${(item.earnings_cents / 100).toFixed(2)}`;
|
|
115
|
-
table.push([item.agent_name, item.calls.toString(), earningsStr]);
|
|
116
|
-
});
|
|
117
|
-
process.stdout.write(`${table.toString()}\n\n`);
|
|
118
|
-
}
|
|
119
|
-
// Show recent transactions
|
|
120
|
-
if (earnings.recent_transactions && earnings.recent_transactions.length > 0) {
|
|
121
|
-
process.stdout.write(chalk_1.default.bold('Recent Transactions:\n'));
|
|
122
|
-
const table = new cli_table3_1.default({
|
|
123
|
-
head: [
|
|
124
|
-
chalk_1.default.bold('Date'),
|
|
125
|
-
chalk_1.default.bold('Agent'),
|
|
126
|
-
chalk_1.default.bold('Sale'),
|
|
127
|
-
chalk_1.default.bold('Your Cut'),
|
|
128
|
-
chalk_1.default.bold('Fee'),
|
|
129
|
-
],
|
|
130
|
-
});
|
|
131
|
-
earnings.recent_transactions.forEach((tx) => {
|
|
132
|
-
const date = new Date(tx.created_at).toLocaleDateString();
|
|
133
|
-
const sale = `$${(tx.sale_amount_cents / 100).toFixed(2)}`;
|
|
134
|
-
const cut = `$${(tx.earnings_cents / 100).toFixed(2)}`;
|
|
135
|
-
const fee = `$${(tx.fee_cents / 100).toFixed(2)}`;
|
|
136
|
-
table.push([date, tx.agent_name, sale, cut, fee]);
|
|
137
|
-
});
|
|
138
|
-
process.stdout.write(`${table.toString()}\n\n`);
|
|
139
|
-
}
|
|
140
|
-
process.stdout.write(chalk_1.default.gray('Manage payouts: orch seller dashboard\n'));
|
|
141
|
-
});
|
|
142
|
-
}
|
package/dist/commands/star.js
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.registerStarCommand = registerStarCommand;
|
|
4
|
-
const config_1 = require("../lib/config");
|
|
5
|
-
const api_1 = require("../lib/api");
|
|
6
|
-
const errors_1 = require("../lib/errors");
|
|
7
|
-
const analytics_1 = require("../lib/analytics");
|
|
8
|
-
function parseAgentRef(ref) {
|
|
9
|
-
// Format: org/agent/version or org/agent (defaults to v1)
|
|
10
|
-
const parts = ref.split('/');
|
|
11
|
-
if (parts.length < 2 || parts.length > 3) {
|
|
12
|
-
throw new errors_1.CliError('Invalid agent reference. Use: org/agent or org/agent/version');
|
|
13
|
-
}
|
|
14
|
-
return {
|
|
15
|
-
org: parts[0],
|
|
16
|
-
name: parts[1],
|
|
17
|
-
version: parts[2] || 'v1',
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
function registerStarCommand(program) {
|
|
21
|
-
program
|
|
22
|
-
.command('star')
|
|
23
|
-
.description('Star an agent')
|
|
24
|
-
.argument('<agent>', 'Agent reference (org/name or org/name/version)')
|
|
25
|
-
.option('--remove', 'Remove star instead of adding')
|
|
26
|
-
.action(async (agent, options) => {
|
|
27
|
-
const config = await (0, config_1.getResolvedConfig)();
|
|
28
|
-
const { org, name, version } = parseAgentRef(agent);
|
|
29
|
-
// Get the agent to get its ID
|
|
30
|
-
const agentInfo = await (0, api_1.getPublicAgent)(config, org, name, version);
|
|
31
|
-
if (options.remove) {
|
|
32
|
-
await (0, api_1.unstarAgent)(config, agentInfo.id);
|
|
33
|
-
process.stdout.write(`Removed star from ${org}/${name}/${version}\n`);
|
|
34
|
-
}
|
|
35
|
-
else {
|
|
36
|
-
const result = await (0, api_1.starAgent)(config, agentInfo.id);
|
|
37
|
-
if (result.starred) {
|
|
38
|
-
await (0, analytics_1.track)('cli_star', { agent: `${org}/${name}/${version}` });
|
|
39
|
-
process.stdout.write(`Starred ${org}/${name}/${version}\n`);
|
|
40
|
-
}
|
|
41
|
-
else {
|
|
42
|
-
// Already starred — toggle off
|
|
43
|
-
await (0, api_1.unstarAgent)(config, agentInfo.id);
|
|
44
|
-
process.stdout.write(`Unstarred ${org}/${name}/${version}\n`);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
}
|