sella-cli 0.7.0 → 0.8.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/README.md CHANGED
@@ -18,7 +18,7 @@
18
18
 
19
19
  <p align="center">
20
20
  <a href="https://sellag.vercel.app">Website</a> ·
21
- <a href="https://sella.mintlify.app">Docs</a> ·
21
+ <a href="https://docs.selltoagent.dev">Docs</a> ·
22
22
  <a href="https://sellag.vercel.app/marketplace">Marketplace</a> ·
23
23
  <a href="https://github.com/010100100100011101010100/ogsella/issues">Report a bug</a>
24
24
  </p>
@@ -79,6 +79,7 @@ What's in there: a catalogue of 1,100+ machine-payable API providers, plus first
79
79
  - **Pay-per-call in USDC**: fractions of a cent for most calls, multi-chain, with budgets you set and keys you can revoke.
80
80
  - **One search across everything**: datasets, APIs, workflows, and Sella Native products are all discoverable in a single MCP call, ranked by computed quality, so your agent buys mid-task instead of stalling.
81
81
  - **Policy-aware buying**: your agent can preview a quote and check it against your budget before paying, and every purchase leaves a decision receipt it can explain.
82
+ - **Businesses**: your agent can open a named run before it starts work, and everything it buys, calls, and decides gets attached to that run. You see what a piece of work actually cost instead of one undifferentiated spend total. Run `sella businesses` to read them from the terminal.
82
83
  - **Publishing from a CSV**, so you can sell your own data without opening a browser.
83
84
  - **Agent-grade output**: every command supports `--json`, `--yes`, and env vars, with meaningful exit codes. Your CI can run it. Your agent can run it.
84
85
 
@@ -92,6 +93,7 @@ What's in there: a catalogue of 1,100+ machine-payable API providers, plus first
92
93
  | `sella clients` | List detected agent clients. `--install` writes configs, `--client a,b` filters, `--dry-run` previews. |
93
94
  | `sella doctor` | Six live checks, from endpoint reachability to a real x402 pay quote. Every failure names its fix. |
94
95
  | `sella status` | Your API key and agent wallet balances, each chain labelled live or deposit-only. |
96
+ | `sella businesses` | Your agent's named runs, newest first: status, spend, tool calls, and the outcome it wrote. `--active` or `--closed` filters. |
95
97
  | `sella fund` | Per-chain USDC deposit addresses, plus the funding page with QR codes and a fiat on-ramp. |
96
98
  | `sella mcp` | Run a local stdio MCP server that proxies Sella with your stored key, for clients that cannot use a remote endpoint. |
97
99
  | `sella publish init <file.csv>` | Scaffold `sella-dataset.json` and pre-check the CSV structure. |
@@ -121,6 +123,20 @@ Then ask your agent:
121
123
 
122
124
  The agent answers using Sella's MCP tools, starting with `search_catalog` (one search across datasets, APIs, workflows, and Sella Native products) and `get_listing` for the details, with the key this CLI stored for it. When you fund the agent wallet, it can preview the price with `purchase_preview` and buy what it found.
123
125
 
126
+ ### Keep track of what a piece of work cost
127
+
128
+ Ask your agent to open a business before it starts:
129
+
130
+ > Start a Sella business called "Q3 pricing research", then find me comparable pricing datasets under $20.
131
+
132
+ It calls `business_start`, and from that point every Sella call it makes is attached to that run. When it finishes it closes the run with a summary. Then:
133
+
134
+ ```bash
135
+ sella businesses
136
+ ```
137
+
138
+ You get each run with its spend, tool-call count, and the outcome the agent wrote, instead of a single spend figure you cannot attribute to anything. A business is a label over the agent wallet you already funded, so there are no extra wallets, keys, or balances to manage.
139
+
124
140
  ### Real-world: publish a CSV and get paid in USDC
125
141
 
126
142
  ```bash
@@ -205,7 +221,7 @@ Sella has two other ways in: your agent can onboard itself over MCP with your em
205
221
  | | |
206
222
  |---|---|
207
223
  | Website | https://sellag.vercel.app |
208
- | Docs | https://sella.mintlify.app |
224
+ | Docs | https://docs.selltoagent.dev |
209
225
  | Marketplace | https://sellag.vercel.app/marketplace |
210
226
  | Agent task ideas | https://sellag.vercel.app/rfi |
211
227
  | npm | https://www.npmjs.com/package/sella-cli |
package/dist/api.js CHANGED
@@ -3,12 +3,15 @@
3
3
  * the CLI speaks the exact same tools/call surface agents use (sella_setup_claim,
4
4
  * sella_auth_start/complete), so CLI, web, and agent onboarding cannot drift.
5
5
  */
6
- export async function callToolRaw(mcpUrl, name, args, fetchImpl = fetch) {
6
+ export async function callToolRaw(mcpUrl, name, args, fetchImpl = fetch, apiKey) {
7
7
  let res;
8
8
  try {
9
9
  res = await fetchImpl(mcpUrl, {
10
10
  method: 'POST',
11
- headers: { 'content-type': 'application/json' },
11
+ headers: {
12
+ 'content-type': 'application/json',
13
+ ...(apiKey ? { authorization: `Bearer ${apiKey}` } : {}),
14
+ },
12
15
  body: JSON.stringify({ jsonrpc: '2.0', id: name, method: 'tools/call', params: { name, arguments: args } }),
13
16
  });
14
17
  }
@@ -17,7 +20,9 @@ export async function callToolRaw(mcpUrl, name, args, fetchImpl = fetch) {
17
20
  'Check your connection, proxy settings, or SELLA_MCP_URL.');
18
21
  }
19
22
  if (res.status === 429) {
20
- throw new Error('Sandbox rate limit reached. Run `sella pair` for unmetered access.');
23
+ throw new Error(apiKey
24
+ ? 'Sella rate limit reached. Wait a moment and try again.'
25
+ : 'Sandbox rate limit reached. Run `sella pair` for unmetered access.');
21
26
  }
22
27
  if (!res.ok) {
23
28
  throw new Error(`Sella endpoint at ${mcpUrl} responded ${res.status}. Check SELLA_MCP_URL.`);
@@ -38,24 +43,60 @@ export async function callToolRaw(mcpUrl, name, args, fetchImpl = fetch) {
38
43
  throw new Error('Unexpected response shape from the Sella MCP endpoint.');
39
44
  }
40
45
  export const callAuthTool = (mcpUrl, name, args, fetchImpl = fetch) => callToolRaw(mcpUrl, name, args, fetchImpl);
41
- /** Zero-identity demo: read-only free tools only (list_market_apis + search_datasets). */
46
+ /** Price on a search_catalog result is `{ amountUSDC, minUSDC, ... }`; older shapes were a number. */
47
+ function priceUSDCOf(entry) {
48
+ const raw = entry?.price ?? entry?.priceUSDC;
49
+ const n = typeof raw === 'number' ? raw : Number(raw?.amountUSDC ?? raw?.minUSDC);
50
+ return Number.isFinite(n) ? n : undefined;
51
+ }
52
+ /**
53
+ * Zero-identity demo: ONE free `search_catalog` call across every listing kind.
54
+ *
55
+ * Replaces the previous pair of calls to `search_datasets` + `list_market_apis` (both deprecated
56
+ * aliases scheduled for removal, and the latter reads a backend that can be empty or asleep).
57
+ * One call now covers datasets, APIs, workflows and Sella Native products, so the sandbox shows
58
+ * the same ranked surface an agent sees.
59
+ */
42
60
  export async function sandboxSearch(mcpUrl, query, fetchImpl = fetch) {
43
- // Tolerate a single tool being flaky, but never swallow the rate limit that's what the user
44
- // needs to see (it tells them to pair).
45
- const soft = (err) => {
46
- if (err instanceof Error && /rate limit/i.test(err.message))
47
- throw err;
48
- return {};
49
- };
50
- const [datasets, apis] = await Promise.all([
51
- callToolRaw(mcpUrl, 'search_datasets', { query, limit: 5 }, fetchImpl).catch(soft),
52
- callToolRaw(mcpUrl, 'list_market_apis', { query, limit: 5 }, fetchImpl).catch(soft),
53
- ]);
54
- // search_datasets returns the array directly; list_market_apis wraps it in `catalogue`.
55
- const asArray = (v, ...keys) => Array.isArray(v) ? v : keys.map((k) => v?.[k]).find(Array.isArray) || [];
61
+ const payload = await callToolRaw(mcpUrl, 'search_catalog', { query, limit: 10 }, fetchImpl);
62
+ const results = Array.isArray(payload?.results)
63
+ ? payload.results
64
+ : Array.isArray(payload)
65
+ ? payload
66
+ : [];
67
+ const datasets = results
68
+ .filter((r) => r?.kind === 'dataset')
69
+ .slice(0, 5)
70
+ .map((r) => ({
71
+ id: String(r?.id ?? ''),
72
+ title: r?.title,
73
+ tier: r?.attributes?.tier,
74
+ priceUSDC: priceUSDCOf(r),
75
+ }));
76
+ // Everything that is not a dataset (api, workflow, native) prints in the "api" column.
77
+ const apis = results
78
+ .filter((r) => r?.kind && r.kind !== 'dataset')
79
+ .slice(0, 5)
80
+ .map((r) => ({
81
+ name: r?.title,
82
+ description: r?.description,
83
+ priceUSDC: priceUSDCOf(r),
84
+ chains: Array.isArray(r?.chains) ? r.chains : undefined,
85
+ }));
86
+ return { datasets, apis };
87
+ }
88
+ /**
89
+ * `business_list`: the caller's named agent runs, newest first. Businesses label the existing
90
+ * agent wallet rather than creating new ones, so this is a read over the same key the CLI stored.
91
+ */
92
+ export async function listBusinesses(mcpUrl, apiKey, args = {}, fetchImpl = fetch) {
93
+ const payload = await callToolRaw(mcpUrl, 'business_list', { ...args }, fetchImpl, apiKey);
94
+ if (payload?.error)
95
+ throw new Error(String(payload.error));
56
96
  return {
57
- datasets: asArray(datasets, 'datasets', 'results').slice(0, 5),
58
- apis: asArray(apis, 'catalogue', 'providers', 'apis', 'results').slice(0, 5),
97
+ businesses: Array.isArray(payload?.businesses) ? payload.businesses : [],
98
+ active: payload?.active ?? null,
99
+ count: Number(payload?.count ?? 0),
59
100
  };
60
101
  }
61
102
  export const claimSetupCode = (mcpUrl, code, fetchImpl) => callAuthTool(mcpUrl, 'sella_setup_claim', { code, client: 'sella-cli' }, fetchImpl);
package/dist/doctor.js CHANGED
@@ -91,7 +91,10 @@ export async function runDoctor(opts) {
91
91
  // 4. auth — the stored key actually authenticates a protected call
92
92
  if (stored) {
93
93
  try {
94
- const called = await rpc(opts.mcpUrl, { method: 'tools/call', params: { name: 'list_datasets', arguments: { limit: 1 } } }, fetchImpl, stored.apiKey);
94
+ const called = await rpc(opts.mcpUrl,
95
+ // search_catalog, not the deprecated list_datasets alias: this check must outlive the
96
+ // one-release deprecation window for the legacy discovery names.
97
+ { method: 'tools/call', params: { name: 'search_catalog', arguments: { limit: 1 } } }, fetchImpl, stored.apiKey);
95
98
  const isError = Boolean(called?.result?.isError) || Boolean(called?.error);
96
99
  checks.push({
97
100
  id: 'auth',
package/dist/index.js CHANGED
@@ -6,14 +6,14 @@ import { pair } from './pairing.js';
6
6
  import { runDoctor, runStatus, loadStoredKey } from './doctor.js';
7
7
  import { runMcpBridge } from './mcp-bridge.js';
8
8
  import { scaffoldCard, pushDataset, CARD_FILENAME } from './publish.js';
9
- import { sandboxSearch } from './api.js';
9
+ import { sandboxSearch, listBusinesses } from './api.js';
10
10
  import { getFundingInfo, annotateFunding } from './fund.js';
11
11
  import { capabilityLabel } from './chains.js';
12
12
  import { defaultIo, Printer } from './output.js';
13
13
  import { Ui } from './ui.js';
14
14
  import { recordCliEvent, saveTelemetryDecision, shouldPromptTelemetry } from './telemetry.js';
15
15
  const DEFAULT_MCP_URL = 'https://sellag.vercel.app/api/mcp';
16
- const VERSION = '0.7.0';
16
+ const VERSION = '0.8.0';
17
17
  function parseFlags(argv) {
18
18
  const flags = {
19
19
  json: false, yes: false, noColor: false, dryRun: false, noKeychain: false,
@@ -62,6 +62,7 @@ Commands:
62
62
  clients List detected agent clients (--install to write configs)
63
63
  doctor Verify the install: endpoint, credentials, auth, wallets, pay-quote
64
64
  status Show your key + AgentWallet balances
65
+ businesses Show your agent's named runs: spend, tool calls, outcome
65
66
  fund Show deposit addresses + funding links to add USDC to your agent wallet
66
67
  mcp Run as a local stdio MCP server that proxies Sella with your stored key
67
68
  publish Publish a dataset from a CSV: 'publish init <file.csv>' then 'publish push'
@@ -86,7 +87,7 @@ Environment:
86
87
 
87
88
  Links:
88
89
  Website https://sellag.vercel.app
89
- Docs https://sella.mintlify.app
90
+ Docs https://docs.selltoagent.dev
90
91
  Issues https://github.com/010100100100011101010100/ogsella/issues
91
92
  `;
92
93
  function selectClientIds(flags, detected) {
@@ -339,7 +340,7 @@ export async function runCli(argv, io = defaultIo(), env = defaultEnv()) {
339
340
  io.stdout(VERSION);
340
341
  // TTY-only: scripts capturing `sella --version` must still get a bare semver.
341
342
  if (io.isTTY)
342
- io.stdout('docs: https://sella.mintlify.app · issues: https://github.com/010100100100011101010100/ogsella/issues');
343
+ io.stdout('docs: https://docs.selltoagent.dev · issues: https://github.com/010100100100011101010100/ogsella/issues');
343
344
  return 0;
344
345
  }
345
346
  if (flags.help) {
@@ -483,6 +484,43 @@ export async function runCli(argv, io = defaultIo(), env = defaultEnv()) {
483
484
  }
484
485
  return 0;
485
486
  }
487
+ case 'businesses': {
488
+ const stored = loadStoredKey(ctx.env);
489
+ if (!stored) {
490
+ printer.error('Not paired yet. Run `sella pair` (or `sella init`) first.');
491
+ return 2;
492
+ }
493
+ const statusFlag = flags.positional.includes('--active')
494
+ ? 'active'
495
+ : flags.positional.includes('--closed')
496
+ ? 'closed'
497
+ : undefined;
498
+ const result = await listBusinesses(ctx.mcpUrl, stored.apiKey, {
499
+ limit: 20,
500
+ ...(statusFlag ? { status: statusFlag } : {}),
501
+ });
502
+ printer.jsonOut(result);
503
+ if (!flags.json) {
504
+ if (!result.businesses.length) {
505
+ printer.info('No businesses yet. Ask your agent to start one before it works:\n' +
506
+ ' "Start a Sella business called <name>, then research X."');
507
+ return 0;
508
+ }
509
+ printer.info(`Your agent's runs (${result.count}):`);
510
+ for (const b of result.businesses) {
511
+ const t = b.totals || {};
512
+ const spend = `$${Number(t.spendUSDC || 0).toFixed(2)}`;
513
+ const mark = b.status === 'active' ? '●' : '·';
514
+ printer.info(` ${mark} ${b.name}`);
515
+ printer.info(` ${String(b.status).padEnd(7)} ${spend.padStart(8)} ${String(t.toolCalls || 0).padStart(4)} calls ${b.businessId}`);
516
+ const summary = b.outcome || b.goal;
517
+ if (summary)
518
+ printer.info(` ${summary.length > 88 ? `${summary.slice(0, 88)}…` : summary}`);
519
+ }
520
+ printer.info('\nFull detail: https://sellag.vercel.app/dashboard/businesses');
521
+ }
522
+ return 0;
523
+ }
486
524
  case 'publish': {
487
525
  const sub = flags.positional[1];
488
526
  const origin = ctx.mcpUrl.replace(/\/api\/mcp\/?$/, '') || 'https://sellag.vercel.app';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sella-cli",
3
- "version": "0.7.0",
3
+ "version": "0.8.0",
4
4
  "description": "Connect your AI agent to Sella, the marketplace where agents buy data and APIs, in one command: npx sella-cli. Installs the Sella MCP server into Claude Code, Cursor and more, then pairs, verifies, funds, and publishes.",
5
5
  "keywords": [
6
6
  "cli",