@oneie/cli 5.3.5 → 5.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.
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oneie/cli",
3
- "version": "5.3.5",
3
+ "version": "5.5.0",
4
4
  "description": "ONE agent CLI",
5
5
  "type": "module",
6
6
  "bin": {
@@ -20,7 +20,7 @@
20
20
  },
21
21
  "dependencies": {
22
22
  "commander": "^12.0.0",
23
- "@oneie/sdk": "^0.16.6"
23
+ "@oneie/sdk": "^0.17.0"
24
24
  },
25
25
  "devDependencies": {
26
26
  "@oneie/evals": "^0.2.0",
package/dist/src/agent.js CHANGED
@@ -5,6 +5,7 @@ import { TEMPLATES } from './templates.js';
5
5
  import { compileAgent, parseAgentMd } from '@oneie/sdk/compile';
6
6
  import { resolveKey } from './lib/client.js';
7
7
  import { askPath } from './lib/api-path.js';
8
+ import { agentverseCmd, publishEndpoint } from './agentverse.js';
8
9
  import { watch } from 'fs';
9
10
  const DEFAULT_API = 'https://one.ie';
10
11
  /**
@@ -95,18 +96,19 @@ export function agentCmd() {
95
96
  out(cmd, { ok: true, path, port: Number(opts.port), status: 'listening' });
96
97
  });
97
98
  cmd.command('publish <path>')
98
- .description('Upload agent.md to your workspace at one.ie, or deploy to Agentverse with --target agentverse')
99
- .option('--slug <slug>', 'Workspace slug to publish into (one.ie target)')
99
+ .description('Upload agent.md to your workspace at one.ie, or publish it to Agentverse / ASI:One with --target agentverse')
100
+ .option('--slug <slug>', 'Workspace slug to publish into (one.ie target; agentverse defaults to the key\'s own)')
100
101
  .option('--api <url>', 'API base URL', DEFAULT_API)
101
102
  .option('--name <name>', 'Override agent name (defaults to frontmatter name:)')
102
103
  .option('--target <t>', 'Publish target: oneie (default) | agentverse', 'oneie')
103
- .option('--agentverse-key <key>', 'Agentverse API key (or set AGENTVERSE_API_KEY)')
104
- .option('--skills <dir>', 'Directory holding the skill markdown declared in the agent frontmatter (agentverse target)')
104
+ .option('--hosted', 'agentverse target: deploy compiled Python to Agentverse HOSTING (needs a paid plan and an Agentverse key) instead of serving it from one.ie')
105
+ .option('--agentverse-key <key>', 'Agentverse API key for --hosted (or set AGENTVERSE_API_KEY)')
106
+ .option('--skills <dir>', 'Directory holding the skill markdown declared in the agent frontmatter (--hosted)')
105
107
  .option('--live', 'Set lifecycle: active before publishing (skip the draft step)')
106
108
  // The override for the Agentverse readiness refusal below. It is a flag, not a
107
109
  // prompt, so the decision to deploy a non-deterministic identity is explicit and
108
110
  // lands in the shell history of whoever made it.
109
- .option('--force', 'Deploy to Agentverse even when the agent is not Agentverse-ready (no seed: — a new address every deploy)')
111
+ .option('--force', '--hosted only: deploy even when the agent is not Agentverse-ready (no seed: — a new address every deploy)')
110
112
  .action(async (path, opts) => {
111
113
  if (!existsSync(path)) {
112
114
  out(cmd, { ok: false, error: `not found: ${path}` });
@@ -127,7 +129,17 @@ export function agentCmd() {
127
129
  content = content.replace(/^lifecycle:\s*draft/m, 'lifecycle: active');
128
130
  const frontmatterName = /^name:\s*(\S+)/m.exec(content)?.[1];
129
131
  const agentName = opts.name ?? frontmatterName ?? basename(path, '.md');
130
- // ── Agentverse deploy path ────────────────────────────────────────────
132
+ // ── Agentverse, endpoint mode (default) ──────────────────────────────
133
+ //
134
+ // one.ie serves the agent at https://one.ie/api/uagents under an address it
135
+ // derives, and registers it in the almanac. No Agentverse key, no hosting
136
+ // plan, no seed: — the address is stable because one.ie derives it from
137
+ // (workspace, actor), not from the file.
138
+ if (opts.target === 'agentverse' && !opts.hosted) {
139
+ await publishEndpoint(cmd, { actor: agentName, slug: opts.slug, api: opts.api });
140
+ return;
141
+ }
142
+ // ── Agentverse HOSTING (--hosted) ─────────────────────────────────────
131
143
  if (opts.target === 'agentverse') {
132
144
  const avKey = opts.agentverseKey ?? process.env.AGENTVERSE_API_KEY;
133
145
  if (!avKey) {
@@ -343,6 +355,7 @@ export function agentCmd() {
343
355
  out(cmd, { ok: false, error: err.message });
344
356
  }
345
357
  });
358
+ cmd.addCommand(agentverseCmd());
346
359
  cmd.command('pull <name>')
347
360
  .description('Download a published agent.md from your workspace into the current directory')
348
361
  .option('--slug <slug>', 'Workspace slug (required)')
@@ -0,0 +1,26 @@
1
+ import { Command } from 'commander';
2
+ export type AskResult = {
3
+ ok: true;
4
+ result: Record<string, unknown>;
5
+ } | {
6
+ ok: false;
7
+ error: string;
8
+ result?: Record<string, unknown>;
9
+ };
10
+ /**
11
+ * POST /api/ask/<receiver>. The ask door answers HTTP 200 on a refusal, so
12
+ * success is `outcome === 'result'` AND `result.ok !== false` — never the status.
13
+ */
14
+ export declare function askReceiver(api: string, receiver: string, data: Record<string, unknown>, key: string): Promise<AskResult>;
15
+ /** What to type into ASI:One today. By-name search needs a paid Agentverse plan; the @address form does not. */
16
+ export declare function asiOneLine(address: string): string;
17
+ /**
18
+ * Endpoint mode: enroll the actor, print where it answers. The workspace is the
19
+ * key's own unless --slug names another the key controls.
20
+ */
21
+ export declare function publishEndpoint(cmd: Command, opts: {
22
+ actor: string;
23
+ slug?: string;
24
+ api?: string;
25
+ }): Promise<void>;
26
+ export declare function agentverseCmd(): Command;
@@ -0,0 +1,171 @@
1
+ import { Command } from 'commander';
2
+ import { out, resolveBase, resolveKey } from './lib/client.js';
3
+ import { askPath } from './lib/api-path.js';
4
+ // `oneie agent agentverse …` and the endpoint half of `oneie agent publish
5
+ // --target agentverse`. Every verb here is a thin wrapper over an agentverse:*
6
+ // receiver on one.ie — no Agentverse key, no hosting plan.
7
+ //
8
+ // WHY ENDPOINT MODE IS THE DEFAULT. Agentverse HOSTING (POST /v1/hosting/agents)
9
+ // answers 403 "User plan has expired" on ONE's account (asi1.astro). Endpoint
10
+ // mode needs no plan: one.ie derives the agent's uAgents address, serves it at
11
+ // https://one.ie/api/uagents and registers it in the almanac — free, signed, and
12
+ // answered by the workspace's own agent. Hosted stays behind --hosted.
13
+ const DEFAULT_API = 'https://one.ie';
14
+ const NO_KEY = 'no API key — run `oneie auth login` or set ONE_API_KEY (legacy: ONEIE_API_KEY)';
15
+ /**
16
+ * POST /api/ask/<receiver>. The ask door answers HTTP 200 on a refusal, so
17
+ * success is `outcome === 'result'` AND `result.ok !== false` — never the status.
18
+ */
19
+ export async function askReceiver(api, receiver, data, key) {
20
+ const res = await fetch(askPath(resolveBase({ api }, DEFAULT_API), receiver), {
21
+ method: 'POST',
22
+ headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${key}` },
23
+ body: JSON.stringify({ data }),
24
+ });
25
+ const text = await res.text();
26
+ let env;
27
+ try {
28
+ env = text ? JSON.parse(text) : {};
29
+ }
30
+ catch {
31
+ return { ok: false, error: `${receiver} → ${res.status} ${text.slice(0, 200)}` };
32
+ }
33
+ const result = env.result && typeof env.result === 'object' ? env.result : undefined;
34
+ if (env.outcome === 'result' && result && result.ok !== false)
35
+ return { ok: true, result };
36
+ const error = String(result?.error ?? env.error ?? env.outcome ?? `${receiver} → ${res.status}`);
37
+ return { ok: false, error, ...(result ? { result } : {}) };
38
+ }
39
+ /** What to type into ASI:One today. By-name search needs a paid Agentverse plan; the @address form does not. */
40
+ export function asiOneLine(address) {
41
+ return `at https://asi1.ai type: @${address} <your question>`;
42
+ }
43
+ /**
44
+ * Endpoint mode: enroll the actor, print where it answers. The workspace is the
45
+ * key's own unless --slug names another the key controls.
46
+ */
47
+ export async function publishEndpoint(cmd, opts) {
48
+ const key = resolveKey();
49
+ if (!key) {
50
+ out(cmd, { ok: false, error: NO_KEY });
51
+ return;
52
+ }
53
+ try {
54
+ const r = await askReceiver(opts.api ?? DEFAULT_API, 'agentverse:enroll', { actor: opts.actor, ...(opts.slug ? { workspace: opts.slug } : {}) }, key);
55
+ const res = r.result ?? {};
56
+ const address = typeof res.address === 'string' ? res.address : undefined;
57
+ if (!r.ok) {
58
+ // An almanac refusal leaves the row enabled with a real address, and the
59
+ // daily tick retries it — say both, so the operator is not told "nothing happened".
60
+ out(cmd, {
61
+ ok: false,
62
+ error: address ? `${r.error} — the agent is enabled at ${address}; the daily re-registration retries the almanac` : r.error,
63
+ ...(address ? { address, registered: false } : {}),
64
+ });
65
+ return;
66
+ }
67
+ const until = typeof res.registeredUntil === 'number' ? new Date(res.registeredUntil).toISOString() : null;
68
+ out(cmd, {
69
+ ok: true,
70
+ target: 'agentverse',
71
+ mode: 'endpoint',
72
+ workspace: res.workspace,
73
+ actor: res.actor,
74
+ address,
75
+ endpoint: res.endpoint,
76
+ almanac: res.registered ? `registered until ${until ?? 'unknown'}` : 'not registered',
77
+ ...(Array.isArray(res.protocols) ? { protocols: res.protocols } : {}),
78
+ asi1: address ? asiOneLine(address) : undefined,
79
+ });
80
+ }
81
+ catch (err) {
82
+ out(cmd, { ok: false, error: err.message });
83
+ }
84
+ }
85
+ export function agentverseCmd() {
86
+ const cmd = new Command('agentverse').description('Your agents on Fetch.ai Agentverse / ASI:One — status, search, send');
87
+ cmd.command('status')
88
+ .description('Which of the workspace\'s agents are published to Agentverse, their addresses and almanac expiry')
89
+ .option('--slug <slug>', 'Workspace slug (defaults to the key\'s own)')
90
+ .option('--actor <id>', 'Only this agent')
91
+ .option('--api <url>', 'API base URL', DEFAULT_API)
92
+ .action(async (opts) => {
93
+ const key = resolveKey();
94
+ if (!key) {
95
+ out(cmd, { ok: false, error: NO_KEY });
96
+ return;
97
+ }
98
+ try {
99
+ const r = await askReceiver(opts.api, 'agentverse:status', { ...(opts.slug ? { workspace: opts.slug } : {}), ...(opts.actor ? { actor: opts.actor } : {}) }, key);
100
+ if (!r.ok) {
101
+ out(cmd, { ok: false, error: r.error });
102
+ return;
103
+ }
104
+ const agents = Array.isArray(r.result.agents) ? r.result.agents : [];
105
+ out(cmd, { ok: true, workspace: r.result.workspace, endpoint: r.result.endpoint, count: agents.length, agents });
106
+ }
107
+ catch (err) {
108
+ out(cmd, { ok: false, error: err.message });
109
+ }
110
+ });
111
+ cmd.command('search <query...>')
112
+ .description('Search the Agentverse index for agents to talk to (chat-protocol agents by default)')
113
+ .option('--protocol <p>', '`chat` (default), `any`, or a proto:<digest>')
114
+ .option('--limit <n>', 'How many (default 10, max 30)')
115
+ .option('--api <url>', 'API base URL', DEFAULT_API)
116
+ .action(async (query, opts) => {
117
+ const key = resolveKey();
118
+ if (!key) {
119
+ out(cmd, { ok: false, error: NO_KEY });
120
+ return;
121
+ }
122
+ try {
123
+ const r = await askReceiver(opts.api, 'agentverse:search', {
124
+ query: query.join(' '),
125
+ ...(opts.protocol ? { protocol: opts.protocol } : {}),
126
+ ...(opts.limit ? { limit: Number(opts.limit) } : {}),
127
+ }, key);
128
+ if (!r.ok) {
129
+ out(cmd, { ok: false, error: r.error });
130
+ return;
131
+ }
132
+ const { ok: _ok, ...rest } = r.result;
133
+ out(cmd, { ok: true, ...rest });
134
+ }
135
+ catch (err) {
136
+ out(cmd, { ok: false, error: err.message });
137
+ }
138
+ });
139
+ cmd.command('send <address> <text...>')
140
+ .description('Message an Agentverse agent as one of your published agents and wait for its reply')
141
+ .requiredOption('--as <actor>', 'Your published agent to speak as, e.g. ceo')
142
+ .option('--slug <slug>', 'Workspace slug (defaults to the key\'s own)')
143
+ .option('--timeout <s>', 'Seconds to wait for the reply (default 20, max 40; 0 = return pending at once)')
144
+ .option('--api <url>', 'API base URL', DEFAULT_API)
145
+ .action(async (address, text, opts) => {
146
+ const key = resolveKey();
147
+ if (!key) {
148
+ out(cmd, { ok: false, error: NO_KEY });
149
+ return;
150
+ }
151
+ try {
152
+ const r = await askReceiver(opts.api, 'agentverse:send', {
153
+ from_actor: opts.as,
154
+ to_address: address,
155
+ text: text.join(' '),
156
+ ...(opts.slug ? { workspace: opts.slug } : {}),
157
+ ...(opts.timeout !== undefined ? { timeout_s: Number(opts.timeout) } : {}),
158
+ }, key);
159
+ if (!r.ok) {
160
+ out(cmd, { ok: false, error: r.error });
161
+ return;
162
+ }
163
+ const { ok: _ok, ...rest } = r.result;
164
+ out(cmd, { ok: true, ...rest });
165
+ }
166
+ catch (err) {
167
+ out(cmd, { ok: false, error: err.message });
168
+ }
169
+ });
170
+ return cmd;
171
+ }
package/dist/src/key.js CHANGED
@@ -44,10 +44,12 @@ function labelFor(d) {
44
44
  ? 'v2 — standard paths (BIP-44 / SLIP-0010). Any BIP-39 wallet recovers these.'
45
45
  : 'v1 — original ONE derivation (HKDF labels). Only one.ie and @oneie/recover derive these.';
46
46
  }
47
- /** Field by field from the four chains — a private key has no route into the value. */
47
+ /** Field by field from the known chains — a private key has no route into the value.
48
+ * `asi` exists only under v2; a v1 key gets no key for it, not an empty line. */
48
49
  function addressesOf(w) {
49
50
  const pick = (c) => w.keys.find((k) => k.chain === c)?.address ?? '';
50
- return { sui: pick('sui'), evm: pick('evm'), sol: pick('sol'), btc: pick('btc') };
51
+ const asi = pick('asi');
52
+ return { sui: pick('sui'), evm: pick('evm'), sol: pick('sol'), btc: pick('btc'), ...(asi ? { asi } : {}) };
51
53
  }
52
54
  function fail(cmd, error) {
53
55
  if (jsonMode(cmd))
@@ -161,7 +161,8 @@ function otherWallets(restore) {
161
161
  if (restore.derivation === 'v2') {
162
162
  return [
163
163
  'These words also open in: MetaMask (Ethereum), Phantom (Solana), Sui Wallet / Slush (Sui),',
164
- ' Sparrow or BlueWallet (Bitcoin, native SegWit). The first account in each is the address above.',
164
+ ' Sparrow or BlueWallet (Bitcoin, native SegWit), ASI Alliance Wallet (ASI).',
165
+ ' The first account in each is the address above.',
165
166
  ];
166
167
  }
167
168
  return [
@@ -267,7 +267,7 @@ export function walletCmd() {
267
267
  out(cmd, okWrap(result));
268
268
  });
269
269
  cmd.command('keygen')
270
- .description('Generate or recover a self-hosted wallet locally — 4 chains (Sui/EVM/Sol/BTC), fully offline, never touches the network or a server. Prints once by default; use --out for scripted bulk provisioning')
270
+ .description('Generate or recover a self-hosted wallet locally — Sui/EVM/Sol/BTC, plus ASI under v2, fully offline, never touches the network or a server. Prints once by default; use --out for scripted bulk provisioning')
271
271
  .option('--recover', 'Recover from a 24-word BIP-39 mnemonic (ONE_WALLET_MNEMONIC env or stdin) instead of generating a fresh one')
272
272
  .option('--derivation <v>', 'v2 (default for a fresh key — what one.ie mints) or v1. With --recover the default is v1: the words carry no marker, and a v1 key recovers its v1 addresses forever')
273
273
  .option('--out <file>', 'Write the mnemonic + keys to a file at mode 0600 instead of printing once')
@@ -286,7 +286,7 @@ export function walletCmd() {
286
286
  });
287
287
  // ── the encrypted wallet folder ────────────────────────────────────────────
288
288
  cmd.command('new')
289
- .description('Create an encrypted wallet in this folder — 24 words sealed with a passphrase, four chains, fully offline')
289
+ .description('Create an encrypted wallet in this folder — 24 words sealed with a passphrase, four chains (five under v2, with ASI), fully offline')
290
290
  .option('--dir <path>', 'Project directory', '.')
291
291
  .option('--recover', 'Seal an EXISTING 24-word phrase instead of generating a new one (ONE_WALLET_MNEMONIC or stdin)')
292
292
  .option('--derivation <v>', 'v2 (default for a fresh wallet — what one.ie mints) or v1. With --recover the default is v1: the words carry no marker, and a v1 key recovers its v1 addresses forever')
@@ -464,12 +464,14 @@ export function signingKeys(source) {
464
464
  const keys = (source && typeof source === 'object' ? source['keys'] : undefined);
465
465
  return (Array.isArray(keys) ? keys : []).filter((k) => !!k && typeof k.chain === 'string' && typeof k.address === 'string' && typeof k.privateKeyHex === 'string');
466
466
  }
467
- // Chain-name spellings a keygen output may use -> the four columns wallet:create
467
+ // Chain-name spellings a keygen output may use -> the five columns wallet:create
468
468
  // declares. `eth`/`sol` are the SDK's WalletChain spellings; `evm`/`solana` are the
469
- // server's.
469
+ // server's. Must cover every chain proveAddresses signs, or the confirm screen
470
+ // shows fewer addresses than the agent registration sends.
470
471
  const REGISTER_CHAINS = {
471
472
  sui: 'sui', evm: 'evm', eth: 'evm', ethereum: 'evm',
472
473
  sol: 'solana', solana: 'solana', btc: 'btc', bitcoin: 'btc',
474
+ asi: 'asi', fetch: 'asi',
473
475
  };
474
476
  /**
475
477
  * Reduce ANY keygen-shaped object to public receiving addresses. This is a
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oneie/cli",
3
- "version": "5.3.5",
3
+ "version": "5.5.0",
4
4
  "description": "ONE agent CLI",
5
5
  "type": "module",
6
6
  "bin": {
@@ -20,7 +20,7 @@
20
20
  },
21
21
  "dependencies": {
22
22
  "commander": "^12.0.0",
23
- "@oneie/sdk": "^0.16.6"
23
+ "@oneie/sdk": "^0.17.0"
24
24
  },
25
25
  "devDependencies": {
26
26
  "@oneie/evals": "^0.2.0",