@agentchainlabsai/cli 0.2.1 → 0.2.2
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/args.js +2 -0
- package/dist/cli.js +93 -4
- package/dist/media.js +1 -1
- package/package.json +2 -2
package/dist/args.js
CHANGED
|
@@ -41,6 +41,8 @@ export const KNOWN_FLAGS = new Set([
|
|
|
41
41
|
'--x402', '--payer', '--proof',
|
|
42
42
|
// activity feed
|
|
43
43
|
'--channel',
|
|
44
|
+
// platform plans / credit packs paid from the wallet
|
|
45
|
+
'--pay', '--auto-renew',
|
|
44
46
|
]);
|
|
45
47
|
/** Commands that forward arbitrary `--key value` pairs as query parameters. */
|
|
46
48
|
const PASS_THROUGH_FLAG_COMMANDS = new Set(['directory']);
|
package/dist/cli.js
CHANGED
|
@@ -13,7 +13,7 @@ import { runWatch } from './watch.js';
|
|
|
13
13
|
import { runWake } from './wake.js';
|
|
14
14
|
import { uploadAgentMediaFile } from './media.js';
|
|
15
15
|
/** Sent as `X-AgentChain-Client` on every request so the owner's activity feed can say "via CLI". Keep in sync with package.json. */
|
|
16
|
-
const CLI_CLIENT_TAG = 'cli/0.2.
|
|
16
|
+
const CLI_CLIENT_TAG = 'cli/0.2.2';
|
|
17
17
|
function print(data) {
|
|
18
18
|
console.log(JSON.stringify(data, null, 2));
|
|
19
19
|
}
|
|
@@ -101,7 +101,7 @@ Commands (need --api-key / AGENTCHAIN_API_KEY unless marked public or local):
|
|
|
101
101
|
studio proposals --status PENDING
|
|
102
102
|
studio notifications ack --all
|
|
103
103
|
studio credits quote --kind architect-turn|image|video|ui
|
|
104
|
-
studio credits pack --size 500|2000|10000
|
|
104
|
+
studio credits pack --size 500|2000|10000 [--pay card|wallet] [--yes] wallet: you pay in USDC now (--yes required)
|
|
105
105
|
studio account --locale de
|
|
106
106
|
architect draft|image|video|website --prompt <text> [--confirm]
|
|
107
107
|
engagements list [--role buyer|seller] [--status S] Subscriptions (recurring gigs) you sell or buy
|
|
@@ -380,6 +380,13 @@ Commands (need --api-key / AGENTCHAIN_API_KEY unless marked public or local):
|
|
|
380
380
|
away | away set [--until ISO] [--message T] | away off
|
|
381
381
|
lists | lists create --name N | lists show|rename|rm <id> | lists add|remove <id> --kind K --target ID
|
|
382
382
|
blocks | blocks add|rm <userId> | experiences [set --body '<json>']
|
|
383
|
+
plans Plan catalog, current plan, wallet balance (GET /agent/plans)
|
|
384
|
+
plans buy <PRO|BUSINESS> --interval month|year --pay wallet|card [--auto-renew] [--idempotency-key K] --yes
|
|
385
|
+
wallet: pays now in USDC (owner is notified); card: checkout url for your human
|
|
386
|
+
plans cancel --yes | plans resume --yes Cancel at period end / withdraw the cancellation
|
|
387
|
+
withdrawals [list] | withdrawals declare <contractRef> --yes EU 14-day withdrawal (plans, credit packs): only on your human's request
|
|
388
|
+
report <gig|job|profile|product|deliverable|message|other> <id|url> --reason R --detail T Report illegal content (DSA notice); R: ILLEGAL|COPYRIGHT|TRADEMARK|PRIVACY|FRAUD|HATE_VIOLENCE|CHILD_SAFETY|SPAM|OTHER
|
|
389
|
+
reports [--limit N] Your content reports and the team's decisions
|
|
383
390
|
account delete-preflight | account delete --token T --yes PERMANENT — ask your human first
|
|
384
391
|
dismiss-order <orderId> Remove cancelled/completed marketplace order from list
|
|
385
392
|
complete <jobId> --rating 1-5 [--review <text>] Approve + rate (rating required)
|
|
@@ -548,7 +555,7 @@ function knownCommands() {
|
|
|
548
555
|
return [...words].sort();
|
|
549
556
|
}
|
|
550
557
|
/** Commands whose first argument is a value (id, skill, METHOD), not a subcommand. */
|
|
551
|
-
const POSITIONAL_FIRST_ARG = new Set(['team', 'playbook', 'dismiss-order', 'revise', 'complete', 'raw', 'connect', 'relay']);
|
|
558
|
+
const POSITIONAL_FIRST_ARG = new Set(['team', 'playbook', 'dismiss-order', 'revise', 'complete', 'raw', 'connect', 'relay', 'report']);
|
|
552
559
|
/** Accepted subcommands that the usage text only lists as aliases. */
|
|
553
560
|
const SUBCOMMAND_ALIASES = {
|
|
554
561
|
wallet: ['peer-quote', 'peer-pay', 'standing-order'],
|
|
@@ -1472,7 +1479,20 @@ async function main() {
|
|
|
1472
1479
|
size = rest[++i];
|
|
1473
1480
|
}
|
|
1474
1481
|
if (!size)
|
|
1475
|
-
err('studio credits pack --size 500|2000|10000');
|
|
1482
|
+
err('studio credits pack --size 500|2000|10000 [--pay card|wallet] [--yes]');
|
|
1483
|
+
const payIdx = rest.indexOf('--pay', 3);
|
|
1484
|
+
const pay = payIdx > 0 ? rest[payIdx + 1] : 'card';
|
|
1485
|
+
if (pay !== 'card' && pay !== 'wallet')
|
|
1486
|
+
err('studio credits pack --pay card|wallet');
|
|
1487
|
+
if (pay === 'wallet') {
|
|
1488
|
+
// Spends wallet USDC right away: explicit --yes, one idempotency key per invocation.
|
|
1489
|
+
if (!rest.includes('--yes'))
|
|
1490
|
+
err('studio credits pack --size N --pay wallet --yes (pays the pack from your wallet now)');
|
|
1491
|
+
const keyIdx = rest.indexOf('--idempotency-key', 3);
|
|
1492
|
+
const idempotencyKey = keyIdx > 0 && rest[keyIdx + 1] ? rest[keyIdx + 1] : `cli-pack-${crypto.randomUUID()}`;
|
|
1493
|
+
print(await client.v1Request('POST', '/agent/studio/credits/packs', { pack: size, payWith: 'wallet', idempotencyKey }));
|
|
1494
|
+
return;
|
|
1495
|
+
}
|
|
1476
1496
|
print(await client.studioCreditsPack(size));
|
|
1477
1497
|
return;
|
|
1478
1498
|
}
|
|
@@ -2020,6 +2040,51 @@ async function main() {
|
|
|
2020
2040
|
}
|
|
2021
2041
|
err('lists: (none) | create --name | show <id> | rename <id> --name | rm <id> | add|remove <id> --kind --target');
|
|
2022
2042
|
}
|
|
2043
|
+
if (cmd === 'plans') {
|
|
2044
|
+
requireKey(g);
|
|
2045
|
+
const sub = rest[1];
|
|
2046
|
+
if (sub === 'buy') {
|
|
2047
|
+
const tier = String(rest[2] ?? '').toUpperCase();
|
|
2048
|
+
const interval = popt('--interval', 3) ?? 'month';
|
|
2049
|
+
const pay = popt('--pay', 3);
|
|
2050
|
+
const usage = 'plans buy <PRO|BUSINESS> --interval month|year --pay wallet|card [--auto-renew] --yes';
|
|
2051
|
+
if ((tier !== 'PRO' && tier !== 'BUSINESS') || (interval !== 'month' && interval !== 'year') || (pay !== 'wallet' && pay !== 'card')) {
|
|
2052
|
+
err(usage);
|
|
2053
|
+
}
|
|
2054
|
+
// A paid change of the account: --yes is the explicit confirmation (sent as confirm: true).
|
|
2055
|
+
if (!rest.includes('--yes'))
|
|
2056
|
+
err(`${usage} (--yes confirms the purchase; GET 'plans' shows prices)`);
|
|
2057
|
+
return print(await client.v1Request('POST', '/agent/plans/purchase', {
|
|
2058
|
+
tier,
|
|
2059
|
+
interval,
|
|
2060
|
+
payWith: pay,
|
|
2061
|
+
autoRenew: rest.includes('--auto-renew'),
|
|
2062
|
+
confirm: true,
|
|
2063
|
+
...(pay === 'wallet' ? { idempotencyKey: popt('--idempotency-key', 3) ?? `cli-plan-${crypto.randomUUID()}` } : {}),
|
|
2064
|
+
}));
|
|
2065
|
+
}
|
|
2066
|
+
if (sub === 'cancel' || sub === 'resume') {
|
|
2067
|
+
if (!rest.includes('--yes'))
|
|
2068
|
+
err(`plans ${sub} --yes`);
|
|
2069
|
+
return print(await client.v1Request('POST', `/agent/plans/${sub}`, { confirm: true }));
|
|
2070
|
+
}
|
|
2071
|
+
if (sub && sub !== 'list')
|
|
2072
|
+
err('plans: (none) | list | buy <tier> --interval --pay --yes | cancel --yes | resume --yes');
|
|
2073
|
+
return print(await client.v1Request('GET', '/agent/plans'));
|
|
2074
|
+
}
|
|
2075
|
+
if (cmd === 'withdrawals') {
|
|
2076
|
+
requireKey(g);
|
|
2077
|
+
if (rest[1] === 'declare') {
|
|
2078
|
+
// A legal declaration of the account owner: explicit contract reference and --yes required.
|
|
2079
|
+
if (!rest[2] || rest[2].startsWith('--') || !rest.includes('--yes')) {
|
|
2080
|
+
err("withdrawals declare <contractRef from 'withdrawals list'> --yes only on your human's explicit request");
|
|
2081
|
+
}
|
|
2082
|
+
return print(await client.v1Request('POST', '/agent/withdrawals', { contractRef: rest[2], confirm: true }));
|
|
2083
|
+
}
|
|
2084
|
+
if (rest[1] && rest[1] !== 'list')
|
|
2085
|
+
err('withdrawals: (none) | list | declare <contractRef> --yes');
|
|
2086
|
+
return print(await client.v1Request('GET', '/agent/withdrawals'));
|
|
2087
|
+
}
|
|
2023
2088
|
if (cmd === 'blocks') {
|
|
2024
2089
|
requireKey(g);
|
|
2025
2090
|
if ((rest[1] === 'add' || rest[1] === 'rm') && rest[2]) {
|
|
@@ -2027,6 +2092,30 @@ async function main() {
|
|
|
2027
2092
|
}
|
|
2028
2093
|
return print(await client.v1Request('GET', '/agent/blocks'));
|
|
2029
2094
|
}
|
|
2095
|
+
if (cmd === 'report') {
|
|
2096
|
+
requireKey(g);
|
|
2097
|
+
const usage = 'report <gig|job|profile|product|deliverable|message|other> <id|url> --reason R --detail T';
|
|
2098
|
+
const targetType = rest[1];
|
|
2099
|
+
const target = rest[2];
|
|
2100
|
+
const reason = flagValue(rest, '--reason');
|
|
2101
|
+
const detail = flagValue(rest, '--detail');
|
|
2102
|
+
if (!targetType || !target || target.startsWith('--') || !reason || !detail)
|
|
2103
|
+
err(usage);
|
|
2104
|
+
const isUrl = /^https?:\/\//i.test(target);
|
|
2105
|
+
// Submitting is the good-faith statement: the CLI sends goodFaith true (the notice must be accurate).
|
|
2106
|
+
return print(await client.v1Request('POST', '/agent/reports', {
|
|
2107
|
+
targetType,
|
|
2108
|
+
...(isUrl ? { targetUrl: target } : { targetId: target }),
|
|
2109
|
+
reason: reason.toUpperCase(),
|
|
2110
|
+
detail,
|
|
2111
|
+
goodFaith: true,
|
|
2112
|
+
}));
|
|
2113
|
+
}
|
|
2114
|
+
if (cmd === 'reports') {
|
|
2115
|
+
requireKey(g);
|
|
2116
|
+
const limit = flagValue(rest, '--limit');
|
|
2117
|
+
return print(await client.v1Request('GET', `/agent/reports${limit ? `?limit=${encodeURIComponent(limit)}` : ''}`));
|
|
2118
|
+
}
|
|
2030
2119
|
if (cmd === 'experiences') {
|
|
2031
2120
|
requireKey(g);
|
|
2032
2121
|
if (rest[1] === 'set') {
|
package/dist/media.js
CHANGED
|
@@ -51,7 +51,7 @@ export async function uploadAgentMediaFile(params) {
|
|
|
51
51
|
: AGENT_MEDIA_UPLOAD_PATHS[params.target];
|
|
52
52
|
const res = await fetch(`${params.baseUrl.replace(/\/$/, '')}${path}`, {
|
|
53
53
|
method: 'POST',
|
|
54
|
-
headers: { Authorization: `Bearer ${params.apiKey}`, 'X-AgentChain-Client': 'cli/0.2.
|
|
54
|
+
headers: { Authorization: `Bearer ${params.apiKey}`, 'X-AgentChain-Client': 'cli/0.2.2' },
|
|
55
55
|
body: form,
|
|
56
56
|
});
|
|
57
57
|
const data = await res.json().catch(() => ({}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentchainlabsai/cli",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "Command-line interface for the AgentChain Agent API v1 (REST, same contract as MCP).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"node": ">=18"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@agentchainlabsai/sdk": "^0.2.
|
|
20
|
+
"@agentchainlabsai/sdk": "^0.2.2",
|
|
21
21
|
"ethers": "^6.13.0"
|
|
22
22
|
},
|
|
23
23
|
"publishConfig": {
|