@oneie/cli 5.8.0 → 5.8.1

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.
Files changed (268) hide show
  1. package/dist/package.json +7 -8
  2. package/dist/src/age-yefbe8pe.js +1 -0
  3. package/dist/src/evm-tx-ee2q0e3w.js +1 -0
  4. package/dist/src/hl-run-tgrkrk69.js +1 -0
  5. package/dist/src/index-0rj9wdk9.js +4 -0
  6. package/dist/src/index-91y484c2.js +2052 -0
  7. package/dist/src/index-940y3rnv.js +12 -0
  8. package/dist/src/index.js +1047 -134
  9. package/dist/src/message-key-db1xjdkw.js +1 -0
  10. package/dist/src/message-lock-5vr8079x.js +5 -0
  11. package/dist/src/sweep-order-c2p6rk8c.js +1 -0
  12. package/dist/src/sweep-runner-t68xe7vx.js +1 -0
  13. package/package.json +7 -8
  14. package/dist/src/agent.d.ts +0 -75
  15. package/dist/src/agent.js +0 -1334
  16. package/dist/src/agentverse.d.ts +0 -26
  17. package/dist/src/agentverse.js +0 -171
  18. package/dist/src/args.d.ts +0 -9
  19. package/dist/src/args.js +0 -61
  20. package/dist/src/auth.d.ts +0 -6
  21. package/dist/src/auth.js +0 -121
  22. package/dist/src/balances.d.ts +0 -89
  23. package/dist/src/balances.js +0 -202
  24. package/dist/src/banner.d.ts +0 -1
  25. package/dist/src/banner.js +0 -17
  26. package/dist/src/broadcast.d.ts +0 -8
  27. package/dist/src/broadcast.js +0 -175
  28. package/dist/src/catalog.d.ts +0 -12
  29. package/dist/src/catalog.js +0 -76
  30. package/dist/src/ceiling.d.ts +0 -36
  31. package/dist/src/ceiling.js +0 -189
  32. package/dist/src/chat.d.ts +0 -2
  33. package/dist/src/chat.js +0 -92
  34. package/dist/src/check.d.ts +0 -11
  35. package/dist/src/check.js +0 -53
  36. package/dist/src/client.d.ts +0 -5
  37. package/dist/src/client.js +0 -157
  38. package/dist/src/compiler.d.ts +0 -36
  39. package/dist/src/compiler.js +0 -366
  40. package/dist/src/config.d.ts +0 -24
  41. package/dist/src/config.js +0 -70
  42. package/dist/src/connect.d.ts +0 -2
  43. package/dist/src/connect.js +0 -64
  44. package/dist/src/coordinate.d.ts +0 -3
  45. package/dist/src/coordinate.js +0 -58
  46. package/dist/src/create.d.ts +0 -2
  47. package/dist/src/create.js +0 -113
  48. package/dist/src/credits.d.ts +0 -29
  49. package/dist/src/credits.js +0 -88
  50. package/dist/src/deploy.d.ts +0 -2
  51. package/dist/src/deploy.js +0 -19
  52. package/dist/src/dev.d.ts +0 -2
  53. package/dist/src/dev.js +0 -75
  54. package/dist/src/device-flow.d.ts +0 -57
  55. package/dist/src/device-flow.js +0 -173
  56. package/dist/src/doctor.d.ts +0 -26
  57. package/dist/src/doctor.js +0 -146
  58. package/dist/src/draw.d.ts +0 -18
  59. package/dist/src/draw.js +0 -156
  60. package/dist/src/endpoint.d.ts +0 -2
  61. package/dist/src/endpoint.js +0 -250
  62. package/dist/src/env.d.ts +0 -3
  63. package/dist/src/env.js +0 -37
  64. package/dist/src/eval.d.ts +0 -2
  65. package/dist/src/eval.js +0 -43
  66. package/dist/src/fn.d.ts +0 -2
  67. package/dist/src/fn.js +0 -70
  68. package/dist/src/group.d.ts +0 -2
  69. package/dist/src/group.js +0 -117
  70. package/dist/src/hl-run.d.ts +0 -119
  71. package/dist/src/hl-run.js +0 -480
  72. package/dist/src/hl.d.ts +0 -17
  73. package/dist/src/hl.js +0 -148
  74. package/dist/src/index.d.ts +0 -2
  75. package/dist/src/init.d.ts +0 -76
  76. package/dist/src/init.js +0 -278
  77. package/dist/src/join.d.ts +0 -11
  78. package/dist/src/join.js +0 -297
  79. package/dist/src/key-publish.d.ts +0 -40
  80. package/dist/src/key-publish.js +0 -232
  81. package/dist/src/key-seal.d.ts +0 -21
  82. package/dist/src/key-seal.js +0 -142
  83. package/dist/src/key-sweep.d.ts +0 -93
  84. package/dist/src/key-sweep.js +0 -270
  85. package/dist/src/key.d.ts +0 -26
  86. package/dist/src/key.js +0 -338
  87. package/dist/src/lib/age-plugin.d.ts +0 -51
  88. package/dist/src/lib/age-plugin.js +0 -130
  89. package/dist/src/lib/agent-env.d.ts +0 -12
  90. package/dist/src/lib/agent-env.js +0 -48
  91. package/dist/src/lib/api-path.d.ts +0 -2
  92. package/dist/src/lib/api-path.js +0 -40
  93. package/dist/src/lib/asker.d.ts +0 -34
  94. package/dist/src/lib/asker.js +0 -126
  95. package/dist/src/lib/check-words.d.ts +0 -57
  96. package/dist/src/lib/check-words.js +0 -144
  97. package/dist/src/lib/client.d.ts +0 -20
  98. package/dist/src/lib/client.js +0 -71
  99. package/dist/src/lib/env-sealed.d.ts +0 -53
  100. package/dist/src/lib/env-sealed.js +0 -184
  101. package/dist/src/lib/flow-tag.d.ts +0 -86
  102. package/dist/src/lib/flow-tag.js +0 -230
  103. package/dist/src/lib/hl-core/actions.d.ts +0 -99
  104. package/dist/src/lib/hl-core/actions.js +0 -69
  105. package/dist/src/lib/hl-core/eip712.d.ts +0 -33
  106. package/dist/src/lib/hl-core/eip712.js +0 -107
  107. package/dist/src/lib/hl-core/errors.d.ts +0 -10
  108. package/dist/src/lib/hl-core/errors.js +0 -15
  109. package/dist/src/lib/hl-core/exchange.d.ts +0 -24
  110. package/dist/src/lib/hl-core/exchange.js +0 -47
  111. package/dist/src/lib/hl-core/index.d.ts +0 -13
  112. package/dist/src/lib/hl-core/index.js +0 -14
  113. package/dist/src/lib/hl-core/meta.d.ts +0 -57
  114. package/dist/src/lib/hl-core/meta.js +0 -110
  115. package/dist/src/lib/hl-core/msgpack.d.ts +0 -18
  116. package/dist/src/lib/hl-core/msgpack.js +0 -136
  117. package/dist/src/lib/hl-core/net.d.ts +0 -2
  118. package/dist/src/lib/hl-core/net.js +0 -7
  119. package/dist/src/lib/hl-core/signing.d.ts +0 -103
  120. package/dist/src/lib/hl-core/signing.js +0 -295
  121. package/dist/src/lib/hl-core/wire.d.ts +0 -34
  122. package/dist/src/lib/hl-core/wire.js +0 -81
  123. package/dist/src/lib/invoked-as.d.ts +0 -2
  124. package/dist/src/lib/invoked-as.js +0 -24
  125. package/dist/src/lib/journey-words.d.ts +0 -84
  126. package/dist/src/lib/journey-words.js +0 -363
  127. package/dist/src/lib/journey.d.ts +0 -150
  128. package/dist/src/lib/journey.js +0 -264
  129. package/dist/src/lib/key-receipt.d.ts +0 -48
  130. package/dist/src/lib/key-receipt.js +0 -116
  131. package/dist/src/lib/key-source.d.ts +0 -9
  132. package/dist/src/lib/key-source.js +0 -33
  133. package/dist/src/lib/keyfile.d.ts +0 -136
  134. package/dist/src/lib/keyfile.js +0 -397
  135. package/dist/src/lib/launch-claude.d.ts +0 -5
  136. package/dist/src/lib/launch-claude.js +0 -45
  137. package/dist/src/lib/lock-lookup.d.ts +0 -40
  138. package/dist/src/lib/lock-lookup.js +0 -92
  139. package/dist/src/lib/message-seal.d.ts +0 -63
  140. package/dist/src/lib/message-seal.js +0 -150
  141. package/dist/src/lib/net-choice.d.ts +0 -28
  142. package/dist/src/lib/net-choice.js +0 -72
  143. package/dist/src/lib/network.d.ts +0 -22
  144. package/dist/src/lib/network.js +0 -50
  145. package/dist/src/lib/next-words.d.ts +0 -105
  146. package/dist/src/lib/next-words.js +0 -298
  147. package/dist/src/lib/paths.d.ts +0 -41
  148. package/dist/src/lib/paths.js +0 -91
  149. package/dist/src/lib/plan-draw.d.ts +0 -56
  150. package/dist/src/lib/plan-draw.js +0 -219
  151. package/dist/src/lib/plan-live.d.ts +0 -20
  152. package/dist/src/lib/plan-live.js +0 -192
  153. package/dist/src/lib/qr.d.ts +0 -21
  154. package/dist/src/lib/qr.js +0 -402
  155. package/dist/src/lib/roster.d.ts +0 -20
  156. package/dist/src/lib/roster.js +0 -79
  157. package/dist/src/lib/sale-card.d.ts +0 -117
  158. package/dist/src/lib/sale-card.js +0 -261
  159. package/dist/src/lib/shop-init.d.ts +0 -62
  160. package/dist/src/lib/shop-init.js +0 -63
  161. package/dist/src/lib/sui-grpc-send.d.ts +0 -90
  162. package/dist/src/lib/sui-grpc-send.js +0 -128
  163. package/dist/src/lib/swap-core.d.ts +0 -163
  164. package/dist/src/lib/swap-core.js +0 -405
  165. package/dist/src/lib/tasks-digest.d.ts +0 -66
  166. package/dist/src/lib/tasks-digest.js +0 -200
  167. package/dist/src/lib/tasks-graph.d.ts +0 -79
  168. package/dist/src/lib/tasks-graph.js +0 -463
  169. package/dist/src/lib/tasks-lens.d.ts +0 -31
  170. package/dist/src/lib/tasks-lens.js +0 -47
  171. package/dist/src/lib/tasks-next.d.ts +0 -25
  172. package/dist/src/lib/tasks-next.js +0 -103
  173. package/dist/src/lib/tasks-prove.d.ts +0 -15
  174. package/dist/src/lib/tasks-prove.js +0 -68
  175. package/dist/src/lib/tasks-route.d.ts +0 -29
  176. package/dist/src/lib/tasks-route.js +0 -151
  177. package/dist/src/lib/tasks-score.d.ts +0 -36
  178. package/dist/src/lib/tasks-score.js +0 -152
  179. package/dist/src/lib/tasks-workspace.d.ts +0 -18
  180. package/dist/src/lib/tasks-workspace.js +0 -73
  181. package/dist/src/lib/timed-fetch.d.ts +0 -33
  182. package/dist/src/lib/timed-fetch.js +0 -59
  183. package/dist/src/lib/vault-read.d.ts +0 -24
  184. package/dist/src/lib/vault-read.js +0 -77
  185. package/dist/src/lib/vaultfile.d.ts +0 -103
  186. package/dist/src/lib/vaultfile.js +0 -249
  187. package/dist/src/lib/wallet-money.d.ts +0 -222
  188. package/dist/src/lib/wallet-money.js +0 -578
  189. package/dist/src/lib/wallet-request.d.ts +0 -50
  190. package/dist/src/lib/wallet-request.js +0 -86
  191. package/dist/src/links.d.ts +0 -5
  192. package/dist/src/links.js +0 -45
  193. package/dist/src/media.d.ts +0 -29
  194. package/dist/src/media.js +0 -487
  195. package/dist/src/message-receipt.d.ts +0 -25
  196. package/dist/src/message-receipt.js +0 -71
  197. package/dist/src/message.d.ts +0 -13
  198. package/dist/src/message.js +0 -92
  199. package/dist/src/move.d.ts +0 -36
  200. package/dist/src/move.js +0 -152
  201. package/dist/src/network-cmd.d.ts +0 -17
  202. package/dist/src/network-cmd.js +0 -74
  203. package/dist/src/next.d.ts +0 -12
  204. package/dist/src/next.js +0 -67
  205. package/dist/src/onboard.d.ts +0 -16
  206. package/dist/src/onboard.js +0 -149
  207. package/dist/src/plugin.d.ts +0 -2
  208. package/dist/src/plugin.js +0 -193
  209. package/dist/src/push.d.ts +0 -2
  210. package/dist/src/push.js +0 -115
  211. package/dist/src/render.d.ts +0 -21
  212. package/dist/src/render.js +0 -32
  213. package/dist/src/secrets-device.d.ts +0 -32
  214. package/dist/src/secrets-device.js +0 -127
  215. package/dist/src/secrets-give.d.ts +0 -125
  216. package/dist/src/secrets-give.js +0 -236
  217. package/dist/src/secrets-list.d.ts +0 -27
  218. package/dist/src/secrets-list.js +0 -84
  219. package/dist/src/secrets-run.d.ts +0 -31
  220. package/dist/src/secrets-run.js +0 -182
  221. package/dist/src/secrets.d.ts +0 -33
  222. package/dist/src/secrets.js +0 -200
  223. package/dist/src/setup.d.ts +0 -6
  224. package/dist/src/setup.js +0 -127
  225. package/dist/src/ship.d.ts +0 -2
  226. package/dist/src/ship.js +0 -18
  227. package/dist/src/shop-buy.d.ts +0 -16
  228. package/dist/src/shop-buy.js +0 -101
  229. package/dist/src/shop.d.ts +0 -10
  230. package/dist/src/shop.js +0 -112
  231. package/dist/src/skill-parser.d.ts +0 -14
  232. package/dist/src/skill-parser.js +0 -113
  233. package/dist/src/skill.d.ts +0 -2
  234. package/dist/src/skill.js +0 -493
  235. package/dist/src/slug.d.ts +0 -2
  236. package/dist/src/slug.js +0 -6
  237. package/dist/src/social.d.ts +0 -2
  238. package/dist/src/social.js +0 -106
  239. package/dist/src/staff.d.ts +0 -2
  240. package/dist/src/staff.js +0 -104
  241. package/dist/src/start.d.ts +0 -27
  242. package/dist/src/start.js +0 -225
  243. package/dist/src/status.d.ts +0 -2
  244. package/dist/src/status.js +0 -52
  245. package/dist/src/substrate.d.ts +0 -2
  246. package/dist/src/substrate.js +0 -258
  247. package/dist/src/swap.d.ts +0 -93
  248. package/dist/src/swap.js +0 -622
  249. package/dist/src/tasks.d.ts +0 -2
  250. package/dist/src/tasks.js +0 -743
  251. package/dist/src/templates.d.ts +0 -1
  252. package/dist/src/templates.js +0 -213
  253. package/dist/src/thread.d.ts +0 -2
  254. package/dist/src/thread.js +0 -52
  255. package/dist/src/trade.d.ts +0 -2
  256. package/dist/src/trade.js +0 -91
  257. package/dist/src/trail.d.ts +0 -2
  258. package/dist/src/trail.js +0 -41
  259. package/dist/src/validate.d.ts +0 -13
  260. package/dist/src/validate.js +0 -35
  261. package/dist/src/wallet-money.d.ts +0 -158
  262. package/dist/src/wallet-money.js +0 -664
  263. package/dist/src/wallet.d.ts +0 -169
  264. package/dist/src/wallet.js +0 -973
  265. package/dist/src/workflow.d.ts +0 -2
  266. package/dist/src/workflow.js +0 -169
  267. package/dist/src/write.d.ts +0 -43
  268. package/dist/src/write.js +0 -180
@@ -1,26 +0,0 @@
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;
@@ -1,171 +0,0 @@
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
- }
@@ -1,9 +0,0 @@
1
- export interface ParsedArgs {
2
- receiver?: string;
3
- positional: string[];
4
- body: Record<string, unknown>;
5
- dryRun: boolean;
6
- simulate: boolean;
7
- flags: Record<string, string | boolean>;
8
- }
9
- export declare function parseArgs(rest: string[]): ParsedArgs;
package/dist/src/args.js DELETED
@@ -1,61 +0,0 @@
1
- function coerce(v) {
2
- if (v === 'true')
3
- return true;
4
- if (v === 'false')
5
- return false;
6
- if (v !== '' && !Number.isNaN(Number(v)))
7
- return Number(v);
8
- return v;
9
- }
10
- export function parseArgs(rest) {
11
- const positional = [];
12
- const flags = {};
13
- const fromFlags = {};
14
- let body = {};
15
- let dryRun = false;
16
- let simulate = false;
17
- for (let i = 0; i < rest.length; i++) {
18
- const tok = rest[i];
19
- if (tok.startsWith('--')) {
20
- const eq = tok.indexOf('=');
21
- const key = (eq === -1 ? tok.slice(2) : tok.slice(2, eq));
22
- if (key === 'dry-run') {
23
- dryRun = true;
24
- flags[key] = true;
25
- continue;
26
- }
27
- if (key === 'simulate') {
28
- simulate = true;
29
- flags[key] = true;
30
- continue;
31
- }
32
- let val;
33
- if (eq !== -1)
34
- val = tok.slice(eq + 1);
35
- else if (i + 1 < rest.length && !rest[i + 1].startsWith('--'))
36
- val = rest[++i];
37
- else
38
- val = true;
39
- flags[key] = val;
40
- fromFlags[key] = typeof val === 'string' ? coerce(val) : val;
41
- }
42
- else if (tok.trimStart().startsWith('{')) {
43
- try {
44
- const parsed = JSON.parse(tok);
45
- if (parsed && typeof parsed === 'object')
46
- body = { ...body, ...parsed };
47
- }
48
- catch {
49
- throw new Error(`invalid JSON payload: ${tok}`);
50
- }
51
- }
52
- else {
53
- positional.push(tok);
54
- }
55
- }
56
- body = { ...body, ...fromFlags };
57
- simulate = simulate || dryRun;
58
- if (simulate)
59
- body.simulate = true;
60
- return { receiver: positional[0], positional, body, dryRun, simulate, flags };
61
- }
@@ -1,6 +0,0 @@
1
- import { Command } from 'commander';
2
- /** Shared by `auth login` (nested) and the top-level `login` alias — same
3
- * Command shape, same action, registered under two parents (contract #11). */
4
- export declare function buildLoginCommand(): Command;
5
- export declare function authCmd(): Command;
6
- export declare function loadKey(): string | null;
package/dist/src/auth.js DELETED
@@ -1,121 +0,0 @@
1
- import { Command } from 'commander';
2
- import { CONFIG_DIR } from './lib/paths.js';
3
- import { writeFileSync, readFileSync, existsSync, mkdirSync, chmodSync, unlinkSync, renameSync, } from 'node:fs';
4
- import { resolve, join } from 'node:path';
5
- import { requestDeviceCode, openBrowser, pollForToken } from './device-flow.js';
6
- const KEY_FILE = resolve(CONFIG_DIR, 'key');
7
- const DEFAULT_API = process.env.ONEIE_BASE_URL ?? 'https://one.ie';
8
- const CLI_CLIENT_ID = 'oneie-cli';
9
- const CLI_SCOPE = 'read write';
10
- /** Shared by `auth login` (nested) and the top-level `login` alias — same
11
- * Command shape, same action, registered under two parents (contract #11). */
12
- export function buildLoginCommand() {
13
- const cmd = new Command('login')
14
- .description('Sign in via browser and persist token to ~/.config/one/key')
15
- .option('--key <key>', 'Skip browser flow — store API key directly (or set ONEIE_API_KEY)')
16
- .option('--api <url>', 'API base URL', DEFAULT_API)
17
- .action(async (opts) => {
18
- // Fast path: explicit --key or ONEIE_API_KEY env var (legacy / CI)
19
- const envKey = opts.key ?? process.env.ONEIE_API_KEY;
20
- if (envKey) {
21
- writeKey(envKey);
22
- out(cmd, { ok: true, stored: KEY_FILE, permissions: '0600', method: 'key' });
23
- return;
24
- }
25
- // Device-flow path
26
- const base = opts.api.replace(/\/$/, '');
27
- try {
28
- // (a) Request device code
29
- process.stderr.write('Requesting device authorization…\n');
30
- const dc = await requestDeviceCode(base, CLI_CLIENT_ID, CLI_SCOPE);
31
- // (b) Open browser — include user_code as a hint in the verification URL
32
- const sep = dc.verification_uri.includes('?') ? '&' : '?';
33
- const verifyUrl = `${dc.verification_uri}${sep}user_code=${encodeURIComponent(dc.user_code)}`;
34
- process.stderr.write(`\nOpen this URL in your browser to sign in:\n ${verifyUrl}\n`);
35
- process.stderr.write(`\nYour one-time code: ${dc.user_code}\n`);
36
- process.stderr.write('(The browser should open automatically)\n\n');
37
- await openBrowser(verifyUrl);
38
- // (c) Poll until token or expiry
39
- process.stderr.write(`Waiting for sign-in (expires in ${dc.expires_in}s)…\n`);
40
- const token = await pollForToken(base, CLI_CLIENT_ID, dc.device_code, dc.interval, dc.expires_in);
41
- // (d) Write token to ~/.config/one/key mode 0600
42
- writeKey(token.access_token);
43
- // (e) Print success — emit userId if server returned it
44
- const userId = token.userId ?? 'unknown';
45
- out(cmd, {
46
- ok: true,
47
- stored: KEY_FILE,
48
- permissions: '0600',
49
- method: 'device-flow',
50
- userId,
51
- });
52
- }
53
- catch (err) {
54
- const msg = err.message;
55
- if (process.env.DEBUG) {
56
- process.stderr.write(`${err.stack ?? msg}\n`);
57
- }
58
- else {
59
- process.stderr.write(`Login failed: ${msg}\n`);
60
- }
61
- process.exit(1);
62
- }
63
- });
64
- return cmd;
65
- }
66
- export function authCmd() {
67
- const cmd = new Command('auth').description('Authentication');
68
- cmd.addCommand(buildLoginCommand());
69
- cmd.command('logout')
70
- .description('Remove stored API key')
71
- .action(() => {
72
- if (existsSync(KEY_FILE)) {
73
- unlinkSync(KEY_FILE);
74
- out(cmd, { ok: true, cleared: KEY_FILE });
75
- }
76
- else {
77
- out(cmd, { ok: true, cleared: null, note: 'no key was stored' });
78
- }
79
- });
80
- return cmd;
81
- }
82
- export function loadKey() {
83
- if (process.env.ONEIE_API_KEY)
84
- return process.env.ONEIE_API_KEY;
85
- if (existsSync(KEY_FILE)) {
86
- const val = readFileSync(KEY_FILE, 'utf8').trim();
87
- return val || null;
88
- }
89
- return null;
90
- }
91
- // ---------------------------------------------------------------------------
92
- // Internal helpers
93
- // ---------------------------------------------------------------------------
94
- /**
95
- * Atomically write `value` to KEY_FILE with mode 0600.
96
- * Write to a temp file first, then rename — avoids a race where a concurrent
97
- * reader sees a half-written key file.
98
- */
99
- function writeKey(value) {
100
- mkdirSync(CONFIG_DIR, { recursive: true });
101
- const tmp = join(CONFIG_DIR, '.key.tmp');
102
- writeFileSync(tmp, value, { mode: 0o600 });
103
- chmodSync(tmp, 0o600);
104
- renameSync(tmp, KEY_FILE);
105
- }
106
- function out(cmd, data) {
107
- const isJson = cmd.parent?.opts().json;
108
- if (isJson) {
109
- process.stdout.write(JSON.stringify(data) + '\n');
110
- }
111
- else if (data.ok) {
112
- const pairs = Object.entries(data)
113
- .filter(([k]) => k !== 'ok')
114
- .map(([k, v]) => `${k}=${JSON.stringify(v)}`)
115
- .join(' ');
116
- console.log('✓', pairs);
117
- }
118
- else {
119
- console.error('✗', String(data.error));
120
- }
121
- }
@@ -1,89 +0,0 @@
1
- /**
2
- * `one wallet balances [address]` — what is REALLY at the wallet you loaded, on mainnet.
3
- *
4
- * `wallet get` reads ONE's own ledger, which for most chains is test money: it printed
5
- * 0.000000 for an address that held real ETH and USDC (measured 2026-11-09). This reads the
6
- * chains themselves, through public read-only endpoints, with no key and nothing signed:
7
- * EVM ETH, USDC, USDT on Ethereum, Base and Arbitrum
8
- * Sui SUI on mainnet
9
- * Hyperliquid perps and spot, never summed (HyperCore keeps them apart)
10
- *
11
- * A read that FAILS is `unavailable`, never 0: a short answer must say it is short.
12
- */
13
- import { Command } from 'commander';
14
- export type Obj = Record<string, unknown>;
15
- export type Fetch = (url: string, init?: {
16
- method?: string;
17
- headers?: Record<string, string>;
18
- body?: string;
19
- }) => Promise<{
20
- ok: boolean;
21
- json(): Promise<unknown>;
22
- }>;
23
- export declare const isEvmAddress: (s: string) => boolean;
24
- export declare const isSuiAddress: (s: string) => boolean;
25
- interface Token {
26
- symbol: string;
27
- contract: string;
28
- decimals: number;
29
- }
30
- interface EvmChain {
31
- name: string;
32
- rpc: string;
33
- tokens: Token[];
34
- }
35
- export declare const EVM_CHAINS: EvmChain[];
36
- /** Sui's public JSON-RPC was switched off; GraphQL is the supported public read (measured 2026-11-09). */
37
- export declare const SUI_GRAPHQL = "https://graphql.mainnet.sui.io/graphql";
38
- export declare const HL_INFO = "https://api.hyperliquid.xyz/info";
39
- export interface BalanceRow {
40
- chain: string;
41
- asset: string;
42
- amount: string | null;
43
- unavailable?: string;
44
- }
45
- /** Base units → a plain decimal, no float. */
46
- export declare function formatUnits(raw: bigint, decimals: number): string;
47
- export declare function readEvm(address: string, f: Fetch): Promise<BalanceRow[]>;
48
- export declare function readSui(address: string, f: Fetch): Promise<BalanceRow[]>;
49
- export interface HlRead {
50
- perps: string | null;
51
- withdrawable: string | null;
52
- spot: {
53
- coin: string;
54
- total: string;
55
- }[] | null;
56
- unavailable?: string;
57
- }
58
- export declare function readHyperliquid(address: string, f: Fetch): Promise<HlRead>;
59
- export interface BalancesResult {
60
- ok: true;
61
- network: 'mainnet';
62
- rows: BalanceRow[];
63
- hyperliquid?: HlRead;
64
- /** Plain words for the person: every empty row is real, every `unavailable` row is not a zero. */
65
- note: string;
66
- }
67
- export declare function readBalances(addresses: {
68
- evm?: string;
69
- sui?: string;
70
- }, f: Fetch): Promise<BalancesResult>;
71
- export declare function balanceLines(r: BalancesResult, addresses: {
72
- evm?: string;
73
- sui?: string;
74
- }): string[];
75
- export interface BalancesDeps {
76
- fetch: Fetch;
77
- /** The addresses of the loaded wallet — the workspace's own — when none is typed. */
78
- addresses(opts: {
79
- workspace?: string;
80
- actor?: string;
81
- api: string;
82
- key?: string;
83
- }): Promise<{
84
- evm?: string;
85
- sui?: string;
86
- }>;
87
- }
88
- export declare function balancesCmd(deps: BalancesDeps, defaultApi: string): Command;
89
- export {};