@oneie/cli 4.0.2 → 4.0.4

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
@@ -27,6 +27,9 @@ one client add <slug> # provision a managed client (workspace + credits
27
27
  one push [clients/<slug>] # compile ai/ + data/ → agents, skills, context, lifecycles, types, workflows
28
28
  one status # P&L — funded · burned · margin · balance
29
29
  one deploy # wrangler deploy the node's site/
30
+ one whoami # who am I, which workspace — proves the key is live
31
+ one doctor # config / key / reachability check — exit 0/1 for CI
32
+ one ship "<message>" # git add + commit + push in one step
30
33
  ```
31
34
 
32
35
  `one push` understands TOML array-of-tables (`[[stages]]`, `[[fields]]`), compiles
@@ -52,17 +55,27 @@ one mark | warn | fade | follow | select # the verbs
52
55
  one agent new <name> --profile core|commerce|asi
53
56
  one agent validate | lint | compile --target mcp|a2a|web|skillmd
54
57
  one agent publish # sync to your ONE workspace
58
+ one agent eval # run frontmatter evals (also: one skill eval)
55
59
  one skill new | import <ref> | publish
56
60
  one init --name N --email E # zero-to-live: register + workspace + agent + skills
61
+ one dev # boot the local CF stack: build → D1 migrate → wrangler dev
62
+ one connect telegram --token T # connect a channel by pasting its credential
63
+ one trail <tag,tag> # ranked next-best tasks for a tag combination
57
64
  ```
58
65
 
59
66
  ## Auth
60
67
 
61
68
  ```bash
62
- one login --key <key> # stored at ~/.config/oneie/key (0600)
69
+ one login # browser device flow (RFC 8628) → human-class key
70
+ one login --key <key> # or paste a key directly
71
+ # either way: stored at ~/.config/oneie/key (0600)
63
72
  # or set ONEIE_API_KEY in the environment
64
73
  ```
65
74
 
75
+ `one login` with no `--key` prints a short code, opens `https://one.ie/device`, and waits while you sign in and Approve. The key it stores is **human-class** — bound to your own slug, revocable at Profile › API keys.
76
+
77
+ **When the class matters:** keys minted by `one init`/`onboard`/`setup` are *agent-class* and are categorically blocked from the human-management receivers (`manage_actors`, `manage_lifecycle`, `manage_members`, …) — the error is `forbidden` with `callerRole: "agent"`. If you hit that wall, `one login` is the fix. Full model: `text/api-keys-docs.md § Two key classes`.
78
+
66
79
  Workspace operations use a Bearer token `<slug>:<key>`. Override the API base per command with `--api` (default `https://api.one.ie`, the gateway).
67
80
 
68
81
  ## Wallets
@@ -79,6 +92,26 @@ one wallet send <to> --chain SUI --amount 5 --payment-tx <hash> --workspace <slu
79
92
 
80
93
  `send` never signs — sign and broadcast the transfer yourself first (`agent-wallet-client.ts` for an agent, `/w` for a human), then pass the resulting transaction hash. The private key never crosses this command. `faucet` talks to `pay.one.ie` directly (its own protocol, not the `/ask` gateway) and needs no credential — funding any address is public by design, funding ≠ ownership.
81
94
 
95
+ ## Operate the business
96
+
97
+ ```bash
98
+ one trade market | hire | bounty | earn | usage # marketplace: browse, hire peer agents, post bounties, check metering
99
+ one workflow list --slug S # list workflows for a workspace
100
+ one workflow pull <id> --slug S [--out D] # round-trip a workflow's step graph to a local file
101
+ one workflow push <id> <file> --slug S [--commit] # apply a diff — simulates first, --commit persists
102
+ one workflow run <id> --slug S # start a run
103
+ one plugin list | add <name> | buy <name> | grant <name> --to <slug> # browse, install, buy, or resell a plugin
104
+ one staff invite [email] | add-agent <name> # invite a human or create an agent staff member
105
+ one links create <actorId> --to <path> # mint a personalised, actor-bound tracked link
106
+ one broadcast list | send <id> # blasts to a workspace audience
107
+ one segment list | preview <id> # audience segments — live count + sample
108
+ one newsletter pull <id> | push <id> <file> # round-trip newsletter content as a local file
109
+ one social list --group G | create --group G ... # draft/publish/list social posts
110
+ one fn run <name> '{json}' | list # call an allowlisted analytics/routing RPC
111
+ one coordinate recall [about] | reputation [uid] # cross-session memory and reputation
112
+ one group bulk-create --csv # idempotent batch client provisioning
113
+ ```
114
+
82
115
  ## Chat — fan in · fan out
83
116
 
84
117
  Send to a space, broadcast to all, or stream incoming messages:
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oneie/cli",
3
- "version": "4.0.2",
3
+ "version": "4.0.4",
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.14.6"
23
+ "@oneie/sdk": "^0.14.11"
24
24
  },
25
25
  "devDependencies": {
26
26
  "@oneie/evals": "workspace:*",
@@ -2,5 +2,7 @@ import { Command } from 'commander';
2
2
  /** `one broadcast` — operate newsletters from the terminal.
3
3
  * Two verbs: list + send. Both hit broadcast:* receivers via ask(); no new route. */
4
4
  export declare function broadcastCmd(): Command;
5
+ /** `one segment` — read-only v1: list + preview audience segments from the terminal. */
6
+ export declare function segmentCmd(): Command;
5
7
  /** `one newsletter` — pull/push newsletter block trees from the terminal. */
6
8
  export declare function newsletterCmd(): Command;
@@ -38,6 +38,30 @@ export function broadcastCmd() {
38
38
  });
39
39
  return cmd;
40
40
  }
41
+ /** `one segment` — read-only v1: list + preview audience segments from the terminal. */
42
+ export function segmentCmd() {
43
+ const cmd = new Command('segment').description('List and preview audience segments');
44
+ cmd
45
+ .command('list')
46
+ .description('List audience segments for the workspace')
47
+ .option('--api <url>', 'API base URL', DEFAULT_API)
48
+ .action(async (opts) => {
49
+ out(await ask(opts.api, 'segment:list', {}));
50
+ });
51
+ cmd
52
+ .command('preview <id>')
53
+ .description('Preview an audience segment by id — live count + up to 10 sample addresses')
54
+ .option('--api <url>', 'API base URL', DEFAULT_API)
55
+ .action(async (id, opts) => {
56
+ const got = await ask(opts.api, 'segment:get', { id });
57
+ if (!got.segment) {
58
+ process.stderr.write(`segment:get returned no segment for id=${id}\n`);
59
+ process.exit(1);
60
+ }
61
+ out(await ask(opts.api, 'segment:preview', { definition: got.segment.definition }));
62
+ });
63
+ return cmd;
64
+ }
41
65
  // ---------------------------------------------------------------------------
42
66
  // Inline block serialization — mirrors serialize.ts; no Zod dep (CLI rule)
43
67
  // ---------------------------------------------------------------------------
@@ -180,7 +180,10 @@ export async function compileNode(dir, agencySlug, opts) {
180
180
  errors.push({ path: f, message: String(e) });
181
181
  }
182
182
  }
183
- // ai/skills/*/SKILL.md → world:create-thing (skill)
183
+ // ai/skills/*/SKILL.md → world:create-thing (catalog listing) + skill:save (runnable
184
+ // body in the workspace R2 catalog — the store skill:run reads, bare name). Without
185
+ // the second item a pushed skill exists only as a world_things row and skill:run
186
+ // returns skill_not_found (verified live 2026-07-12).
184
187
  for (const f of walk(join(dir, 'ai', 'skills'), 'SKILL.md')) {
185
188
  try {
186
189
  const md = readFileSync(f, 'utf8');
@@ -190,6 +193,7 @@ export async function compileNode(dir, agencySlug, opts) {
190
193
  continue;
191
194
  }
192
195
  compiled.push({ path: f, receiver: 'world:create-thing', payload: { name: namespaced(agencySlug, fm.name), type: 'skill', md } });
196
+ compiled.push({ path: f, receiver: 'skill:save', payload: { slug: safeSlug(agencySlug), name: safeSlug(fm.name), content: md } });
193
197
  }
194
198
  catch (e) {
195
199
  errors.push({ path: f, message: String(e) });
@@ -251,7 +255,13 @@ export async function compileNode(dir, agencySlug, opts) {
251
255
  // human bits {id,label,tags,description,[[stages]]}; the rest is derived deterministically:
252
256
  // stage.slot numeric order (the wall loads ORDER BY slot) → the stage index
253
257
  // stage.tag full namespaced tag lifecycle:<id>:<stageId> (LifecycleStage.tag)
254
- // stage.subSteps / enter_when empty / null (no sub-steps or auto-enter rule by default)
258
+ // stage.subSteps / enter_when empty / null (no sub-steps or auto-enter rule by default —
259
+ // the compiler cannot express an auto-enter rule from static TOML; patch
260
+ // lifecycle_stages.enter_when directly after push if you need one)
261
+ // stage.goal / principle / band plain string fields, straight through if present
262
+ // stage.levers parseToml has no nested array-of-tables, so a lever is one string per
263
+ // entry in a bracket list: levers = ["page:/pricing", "agent:one"] —
264
+ // "<kind>:<id>", kind ∈ page|workflow|agent|human (LeverKind)
255
265
  for (const f of walk(join(dir, 'data', 'lifecycles'), '.toml')) {
256
266
  try {
257
267
  const toml = parseToml(readFileSync(f, 'utf8'));
@@ -259,6 +269,11 @@ export async function compileNode(dir, agencySlug, opts) {
259
269
  const rawStages = Array.isArray(toml.stages) ? toml.stages : [];
260
270
  const stages = rawStages.map((s, i) => {
261
271
  const stageId = String(s.id ?? '');
272
+ const rawLevers = Array.isArray(s.levers) ? s.levers : [];
273
+ const levers = rawLevers.map((l) => {
274
+ const [kind, ...rest] = l.split(':');
275
+ return { kind, id: rest.join(':') };
276
+ }).filter((l) => l.kind && l.id);
262
277
  return {
263
278
  id: stageId,
264
279
  label: String(s.label ?? stageId),
@@ -266,6 +281,10 @@ export async function compileNode(dir, agencySlug, opts) {
266
281
  slot: i,
267
282
  subSteps: [],
268
283
  enter_when: null,
284
+ ...(s.goal ? { goal: String(s.goal) } : {}),
285
+ ...(s.principle ? { principle: String(s.principle) } : {}),
286
+ ...(s.band ? { band: String(s.band) } : {}),
287
+ ...(levers.length > 0 ? { levers } : {}),
269
288
  };
270
289
  });
271
290
  const def = { id, name: String(toml.label ?? id), version: 1, stages, transitions: [], arcs: [], monotonic: true };
package/dist/src/index.js CHANGED
@@ -10,7 +10,7 @@ import { devCmd } from './dev.js';
10
10
  import { groupCmd } from './group.js';
11
11
  import { socialCmd } from './social.js';
12
12
  import { connectCmd } from './connect.js';
13
- import { broadcastCmd, newsletterCmd } from './broadcast.js';
13
+ import { broadcastCmd, newsletterCmd, segmentCmd } from './broadcast.js';
14
14
  import { chatCmd } from './chat.js';
15
15
  import { linksCmd } from './links.js';
16
16
  import { staffCmd } from './staff.js';
@@ -32,6 +32,7 @@ import { trailCmd } from './trail.js';
32
32
  import { initCmd } from './init.js';
33
33
  import { onboardCmd } from './onboard.js';
34
34
  import { pluginCmd } from './plugin.js';
35
+ import { workflowCmd } from './workflow.js';
35
36
  import { readFileSync } from 'node:fs';
36
37
  import { fileURLToPath } from 'node:url';
37
38
  import { resolve, dirname } from 'node:path';
@@ -50,6 +51,7 @@ program.addCommand(groupCmd());
50
51
  program.addCommand(socialCmd());
51
52
  program.addCommand(connectCmd());
52
53
  program.addCommand(broadcastCmd());
54
+ program.addCommand(segmentCmd());
53
55
  program.addCommand(chatCmd());
54
56
  program.addCommand(newsletterCmd());
55
57
  program.addCommand(linksCmd());
@@ -75,6 +77,7 @@ program.addCommand(trailCmd());
75
77
  program.addCommand(initCmd());
76
78
  program.addCommand(onboardCmd());
77
79
  program.addCommand(pluginCmd());
80
+ program.addCommand(workflowCmd());
78
81
  // Bare `oneie` (no args, no --help/--version): route the audience to its
79
82
  // journey instead of commander's default help dump. Never an interactive
80
83
  // prompt — agent env and human TTY both get a printed block (contract #10).
@@ -0,0 +1,2 @@
1
+ declare const _default: any;
2
+ export default _default;
@@ -0,0 +1,22 @@
1
+ // @ts-nocheck — template file; typechecked in the target Astro project, not the CLI
2
+ // Install: bun add @oneie/frontend
3
+ // After setup: copy ONE_API_KEY from .env.local into backend.apiKey
4
+ import { defineOne } from '@oneie/frontend';
5
+ // The only per-node configuration:
6
+ // - backend.apiKey: your workspace's scoped API key (from one setup)
7
+ // - brand.tokens: 6 color tokens to match your brand
8
+ export default defineOne({
9
+ backend: {
10
+ apiKey: process.env.ONE_API_KEY ?? '',
11
+ },
12
+ brand: {
13
+ tokens: {
14
+ primary: 'hsl(216 55% 25%)', // your brand primary
15
+ secondary: 'hsl(160 40% 45%)', // secondary / accent
16
+ tertiary: 'hsl(38 90% 55%)', // highlight / CTA
17
+ background: 'hsl(0 0% 100%)', // page background
18
+ foreground: 'hsl(220 20% 15%)', // body text
19
+ font: 'Inter, system-ui, sans-serif',
20
+ },
21
+ },
22
+ });
@@ -0,0 +1,2 @@
1
+ import { Command } from 'commander';
2
+ export declare function workflowCmd(): Command;
@@ -0,0 +1,125 @@
1
+ import { Command } from 'commander';
2
+ import { readFileSync, writeFileSync, mkdirSync, existsSync } from 'node:fs';
3
+ import { homedir } from 'node:os';
4
+ import { resolve } from 'node:path';
5
+ import { askPath } from './lib/api-path.js';
6
+ const DEFAULT_API = 'https://api.one.ie';
7
+ const KEY_FILE = resolve(homedir(), '.config', 'oneie', 'key');
8
+ function readApiKey() {
9
+ if (process.env.ONEIE_API_KEY)
10
+ return process.env.ONEIE_API_KEY;
11
+ if (existsSync(KEY_FILE))
12
+ return readFileSync(KEY_FILE, 'utf8').trim() || null;
13
+ return null;
14
+ }
15
+ // Every workspace op hits an EXISTING workflow:* receiver via the ask door — no new
16
+ // HTTP route (cli/CLAUDE.md no-new-endpoints). pull writes the workflow:get graph
17
+ // verbatim as <name>/workflow.json; push takes a diff-JSON file and applies it
18
+ // (simulate by default, --commit persists). Mirrors the agent group's file round-trip.
19
+ export function workflowCmd() {
20
+ const cmd = new Command('workflow').description('List, pull, push (diff), and run workflows');
21
+ const call = async (api, slug, receiver, data) => {
22
+ const key = readApiKey();
23
+ if (!key)
24
+ return { ok: false, error: 'no API key — run `oneie auth login --key <key>` or set ONEIE_API_KEY' };
25
+ const url = `${api.replace(/\/$/, '')}${askPath(api, receiver)}`;
26
+ const res = await fetch(url, {
27
+ method: 'POST',
28
+ headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${slug}:${key}` },
29
+ body: JSON.stringify({ data }),
30
+ });
31
+ const text = await res.text();
32
+ return text ? JSON.parse(text) : {};
33
+ };
34
+ cmd.command('list')
35
+ .description('List workflows in a workspace')
36
+ .requiredOption('--slug <slug>', 'Workspace slug')
37
+ .option('--api <url>', 'API base URL', DEFAULT_API)
38
+ .action(async (opts) => {
39
+ const r = await call(opts.api, opts.slug, 'workflow:list', {});
40
+ out(cmd, { ok: !r.error, ...r });
41
+ });
42
+ cmd.command('pull <id>')
43
+ .description('Download a workflow graph to <name>/workflow.json')
44
+ .requiredOption('--slug <slug>', 'Workspace slug')
45
+ .option('--out <dir>', 'Output directory (defaults to the workflow name)')
46
+ .option('--api <url>', 'API base URL', DEFAULT_API)
47
+ .action(async (id, opts) => {
48
+ const r = await call(opts.api, opts.slug, 'workflow:get', { workflowId: id });
49
+ if (r.error || !r.id) {
50
+ out(cmd, { ok: false, error: r.error ?? 'not_found' });
51
+ return;
52
+ }
53
+ const dir = opts.out ?? String(r.name ?? id).toLowerCase().replace(/[^a-z0-9]+/g, '-');
54
+ mkdirSync(dir, { recursive: true });
55
+ const path = `${dir}/workflow.json`;
56
+ writeFileSync(path, JSON.stringify(r, null, 2));
57
+ out(cmd, { ok: true, path, steps: (r.steps ?? []).length });
58
+ });
59
+ cmd.command('push <id> <file>')
60
+ .description('Apply a diff-JSON file to a workflow (simulate by default)')
61
+ .requiredOption('--slug <slug>', 'Workspace slug')
62
+ .option('--commit', 'Persist the diff (default simulates)')
63
+ .option('--api <url>', 'API base URL', DEFAULT_API)
64
+ .action(async (id, file, opts) => {
65
+ if (!existsSync(file)) {
66
+ out(cmd, { ok: false, error: `not found: ${file}` });
67
+ return;
68
+ }
69
+ const diff = JSON.parse(readFileSync(file, 'utf8'));
70
+ const r = await call(opts.api, opts.slug, 'workflow:apply-diff', { workflowId: id, diff, simulate: opts.commit !== true });
71
+ out(cmd, { ok: !!r.ok, simulated: opts.commit !== true, ...r });
72
+ });
73
+ cmd.command('run <id>')
74
+ .description('Start a run of a workflow')
75
+ .requiredOption('--slug <slug>', 'Workspace slug')
76
+ .option('--api <url>', 'API base URL', DEFAULT_API)
77
+ .action(async (id, opts) => {
78
+ const r = await call(opts.api, opts.slug, 'workflow:run', { workflowId: id });
79
+ out(cmd, { ok: !!r.runId, ...r });
80
+ });
81
+ cmd.command('validate <id> <file>')
82
+ .description('Validate a diff-JSON file against a workflow (§9 gate, never persists)')
83
+ .requiredOption('--slug <slug>', 'Workspace slug')
84
+ .option('--api <url>', 'API base URL', DEFAULT_API)
85
+ .action(async (id, file, opts) => {
86
+ if (!existsSync(file)) {
87
+ out(cmd, { ok: false, error: `not found: ${file}` });
88
+ return;
89
+ }
90
+ const diff = JSON.parse(readFileSync(file, 'utf8'));
91
+ const r = await call(opts.api, opts.slug, 'workflow:validate', { workflowId: id, diff });
92
+ out(cmd, { ok: !!r.ok, ...r });
93
+ });
94
+ cmd.command('resolve <runId> <stepId>')
95
+ .description('Resolve a suspended human step in a run (--decision approved|rejected)')
96
+ .requiredOption('--slug <slug>', 'Workspace slug')
97
+ .option('--decision <d>', 'approved | rejected')
98
+ .option('--api <url>', 'API base URL', DEFAULT_API)
99
+ .action(async (runId, stepId, opts) => {
100
+ const r = await call(opts.api, opts.slug, 'human:resolve', { runId, stepId, ...(opts.decision ? { decision: opts.decision } : {}) });
101
+ out(cmd, { ok: !!r.ok, ...r });
102
+ });
103
+ cmd.command('logs <id>')
104
+ .description("List recent runs of a workflow; --run <runId> for one run's step-event timeline")
105
+ .requiredOption('--slug <slug>', 'Workspace slug')
106
+ .option('--run <runId>', "Return this run's event timeline")
107
+ .option('--limit <n>', 'Max runs to list', (v) => parseInt(v, 10))
108
+ .option('--api <url>', 'API base URL', DEFAULT_API)
109
+ .action(async (id, opts) => {
110
+ const r = await call(opts.api, opts.slug, 'workflow:runs', { workflowId: id, ...(opts.run ? { runId: opts.run } : {}), ...(opts.limit ? { limit: opts.limit } : {}) });
111
+ out(cmd, { ok: !r.error, ...r });
112
+ });
113
+ return cmd;
114
+ }
115
+ // out() mirrors agent.ts — human `✓ k=v` or --json. W3: reuse the shared helper if
116
+ // one is exported; otherwise copy agent.ts's local out().
117
+ function out(cmd, data) {
118
+ const json = cmd.parent?.opts()?.json ?? false;
119
+ if (json) {
120
+ process.stdout.write(JSON.stringify(data) + '\n');
121
+ return;
122
+ }
123
+ const line = Object.entries(data).map(([k, v]) => `${k}=${typeof v === 'object' ? JSON.stringify(v) : v}`).join(' ');
124
+ process.stdout.write((data.ok ? '✓ ' : '✗ ') + line + '\n');
125
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oneie/cli",
3
- "version": "4.0.2",
3
+ "version": "4.0.4",
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.14.6"
23
+ "@oneie/sdk": "^0.14.11"
24
24
  },
25
25
  "devDependencies": {
26
26
  "@oneie/evals": "workspace:*",