oneie 5.7.6 → 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 (245) hide show
  1. package/README.md +19 -1
  2. package/dist/package.json +7 -8
  3. package/dist/src/age-yefbe8pe.js +1 -0
  4. package/dist/src/evm-tx-ee2q0e3w.js +1 -0
  5. package/dist/src/hl-run-tgrkrk69.js +1 -0
  6. package/dist/src/index-0rj9wdk9.js +4 -0
  7. package/dist/src/index-91y484c2.js +2052 -0
  8. package/dist/src/index-940y3rnv.js +12 -0
  9. package/dist/src/index.js +1047 -121
  10. package/dist/src/message-key-db1xjdkw.js +1 -0
  11. package/dist/src/message-lock-5vr8079x.js +5 -0
  12. package/dist/src/sweep-order-c2p6rk8c.js +1 -0
  13. package/dist/src/sweep-runner-t68xe7vx.js +1 -0
  14. package/package.json +7 -8
  15. package/dist/src/agent.d.ts +0 -75
  16. package/dist/src/agent.js +0 -1334
  17. package/dist/src/agentverse.d.ts +0 -26
  18. package/dist/src/agentverse.js +0 -171
  19. package/dist/src/args.d.ts +0 -9
  20. package/dist/src/args.js +0 -61
  21. package/dist/src/auth.d.ts +0 -6
  22. package/dist/src/auth.js +0 -121
  23. package/dist/src/balances.d.ts +0 -89
  24. package/dist/src/balances.js +0 -202
  25. package/dist/src/banner.d.ts +0 -1
  26. package/dist/src/banner.js +0 -17
  27. package/dist/src/broadcast.d.ts +0 -8
  28. package/dist/src/broadcast.js +0 -175
  29. package/dist/src/catalog.d.ts +0 -12
  30. package/dist/src/catalog.js +0 -76
  31. package/dist/src/chat.d.ts +0 -2
  32. package/dist/src/chat.js +0 -92
  33. package/dist/src/client.d.ts +0 -5
  34. package/dist/src/client.js +0 -157
  35. package/dist/src/compiler.d.ts +0 -36
  36. package/dist/src/compiler.js +0 -366
  37. package/dist/src/config.d.ts +0 -24
  38. package/dist/src/config.js +0 -70
  39. package/dist/src/connect.d.ts +0 -2
  40. package/dist/src/connect.js +0 -64
  41. package/dist/src/coordinate.d.ts +0 -3
  42. package/dist/src/coordinate.js +0 -58
  43. package/dist/src/create.d.ts +0 -2
  44. package/dist/src/create.js +0 -113
  45. package/dist/src/deploy.d.ts +0 -2
  46. package/dist/src/deploy.js +0 -19
  47. package/dist/src/dev.d.ts +0 -2
  48. package/dist/src/dev.js +0 -75
  49. package/dist/src/device-flow.d.ts +0 -57
  50. package/dist/src/device-flow.js +0 -173
  51. package/dist/src/doctor.d.ts +0 -26
  52. package/dist/src/doctor.js +0 -146
  53. package/dist/src/draw.d.ts +0 -18
  54. package/dist/src/draw.js +0 -156
  55. package/dist/src/endpoint.d.ts +0 -2
  56. package/dist/src/endpoint.js +0 -250
  57. package/dist/src/env.d.ts +0 -3
  58. package/dist/src/env.js +0 -37
  59. package/dist/src/eval.d.ts +0 -2
  60. package/dist/src/eval.js +0 -43
  61. package/dist/src/fn.d.ts +0 -2
  62. package/dist/src/fn.js +0 -70
  63. package/dist/src/group.d.ts +0 -2
  64. package/dist/src/group.js +0 -117
  65. package/dist/src/hl-run.d.ts +0 -119
  66. package/dist/src/hl-run.js +0 -480
  67. package/dist/src/hl.d.ts +0 -17
  68. package/dist/src/hl.js +0 -148
  69. package/dist/src/index.d.ts +0 -2
  70. package/dist/src/init.d.ts +0 -76
  71. package/dist/src/init.js +0 -278
  72. package/dist/src/join.d.ts +0 -11
  73. package/dist/src/join.js +0 -293
  74. package/dist/src/key-publish.d.ts +0 -40
  75. package/dist/src/key-publish.js +0 -232
  76. package/dist/src/key-seal.d.ts +0 -21
  77. package/dist/src/key-seal.js +0 -142
  78. package/dist/src/key-sweep.d.ts +0 -93
  79. package/dist/src/key-sweep.js +0 -263
  80. package/dist/src/key.d.ts +0 -26
  81. package/dist/src/key.js +0 -338
  82. package/dist/src/lib/age-plugin.d.ts +0 -51
  83. package/dist/src/lib/age-plugin.js +0 -130
  84. package/dist/src/lib/agent-env.d.ts +0 -12
  85. package/dist/src/lib/agent-env.js +0 -48
  86. package/dist/src/lib/api-path.d.ts +0 -2
  87. package/dist/src/lib/api-path.js +0 -40
  88. package/dist/src/lib/asker.d.ts +0 -34
  89. package/dist/src/lib/asker.js +0 -126
  90. package/dist/src/lib/client.d.ts +0 -20
  91. package/dist/src/lib/client.js +0 -71
  92. package/dist/src/lib/env-sealed.d.ts +0 -53
  93. package/dist/src/lib/env-sealed.js +0 -184
  94. package/dist/src/lib/flow-tag.d.ts +0 -86
  95. package/dist/src/lib/flow-tag.js +0 -230
  96. package/dist/src/lib/hl-core/actions.d.ts +0 -99
  97. package/dist/src/lib/hl-core/actions.js +0 -69
  98. package/dist/src/lib/hl-core/eip712.d.ts +0 -33
  99. package/dist/src/lib/hl-core/eip712.js +0 -107
  100. package/dist/src/lib/hl-core/errors.d.ts +0 -10
  101. package/dist/src/lib/hl-core/errors.js +0 -15
  102. package/dist/src/lib/hl-core/exchange.d.ts +0 -24
  103. package/dist/src/lib/hl-core/exchange.js +0 -47
  104. package/dist/src/lib/hl-core/index.d.ts +0 -13
  105. package/dist/src/lib/hl-core/index.js +0 -14
  106. package/dist/src/lib/hl-core/meta.d.ts +0 -57
  107. package/dist/src/lib/hl-core/meta.js +0 -110
  108. package/dist/src/lib/hl-core/msgpack.d.ts +0 -18
  109. package/dist/src/lib/hl-core/msgpack.js +0 -136
  110. package/dist/src/lib/hl-core/net.d.ts +0 -2
  111. package/dist/src/lib/hl-core/net.js +0 -7
  112. package/dist/src/lib/hl-core/signing.d.ts +0 -103
  113. package/dist/src/lib/hl-core/signing.js +0 -295
  114. package/dist/src/lib/hl-core/wire.d.ts +0 -34
  115. package/dist/src/lib/hl-core/wire.js +0 -81
  116. package/dist/src/lib/invoked-as.d.ts +0 -2
  117. package/dist/src/lib/invoked-as.js +0 -24
  118. package/dist/src/lib/journey-words.d.ts +0 -84
  119. package/dist/src/lib/journey-words.js +0 -360
  120. package/dist/src/lib/journey.d.ts +0 -148
  121. package/dist/src/lib/journey.js +0 -245
  122. package/dist/src/lib/key-receipt.d.ts +0 -48
  123. package/dist/src/lib/key-receipt.js +0 -116
  124. package/dist/src/lib/key-source.d.ts +0 -9
  125. package/dist/src/lib/key-source.js +0 -33
  126. package/dist/src/lib/keyfile.d.ts +0 -136
  127. package/dist/src/lib/keyfile.js +0 -397
  128. package/dist/src/lib/launch-claude.d.ts +0 -5
  129. package/dist/src/lib/launch-claude.js +0 -45
  130. package/dist/src/lib/lock-lookup.d.ts +0 -40
  131. package/dist/src/lib/lock-lookup.js +0 -92
  132. package/dist/src/lib/message-seal.d.ts +0 -63
  133. package/dist/src/lib/message-seal.js +0 -150
  134. package/dist/src/lib/network.d.ts +0 -15
  135. package/dist/src/lib/network.js +0 -41
  136. package/dist/src/lib/paths.d.ts +0 -41
  137. package/dist/src/lib/paths.js +0 -91
  138. package/dist/src/lib/plan-draw.d.ts +0 -56
  139. package/dist/src/lib/plan-draw.js +0 -219
  140. package/dist/src/lib/plan-live.d.ts +0 -20
  141. package/dist/src/lib/plan-live.js +0 -192
  142. package/dist/src/lib/qr.d.ts +0 -21
  143. package/dist/src/lib/qr.js +0 -402
  144. package/dist/src/lib/roster.d.ts +0 -20
  145. package/dist/src/lib/roster.js +0 -79
  146. package/dist/src/lib/sale-card.d.ts +0 -117
  147. package/dist/src/lib/sale-card.js +0 -261
  148. package/dist/src/lib/shop-init.d.ts +0 -62
  149. package/dist/src/lib/shop-init.js +0 -63
  150. package/dist/src/lib/sui-grpc-send.d.ts +0 -50
  151. package/dist/src/lib/sui-grpc-send.js +0 -89
  152. package/dist/src/lib/swap-core.d.ts +0 -163
  153. package/dist/src/lib/swap-core.js +0 -405
  154. package/dist/src/lib/tasks-digest.d.ts +0 -66
  155. package/dist/src/lib/tasks-digest.js +0 -200
  156. package/dist/src/lib/tasks-graph.d.ts +0 -79
  157. package/dist/src/lib/tasks-graph.js +0 -463
  158. package/dist/src/lib/tasks-lens.d.ts +0 -31
  159. package/dist/src/lib/tasks-lens.js +0 -47
  160. package/dist/src/lib/tasks-next.d.ts +0 -25
  161. package/dist/src/lib/tasks-next.js +0 -103
  162. package/dist/src/lib/tasks-prove.d.ts +0 -15
  163. package/dist/src/lib/tasks-prove.js +0 -68
  164. package/dist/src/lib/tasks-route.d.ts +0 -29
  165. package/dist/src/lib/tasks-route.js +0 -151
  166. package/dist/src/lib/tasks-score.d.ts +0 -36
  167. package/dist/src/lib/tasks-score.js +0 -152
  168. package/dist/src/lib/tasks-workspace.d.ts +0 -18
  169. package/dist/src/lib/tasks-workspace.js +0 -73
  170. package/dist/src/lib/vault-read.d.ts +0 -24
  171. package/dist/src/lib/vault-read.js +0 -77
  172. package/dist/src/lib/vaultfile.d.ts +0 -88
  173. package/dist/src/lib/vaultfile.js +0 -222
  174. package/dist/src/lib/wallet-money.d.ts +0 -222
  175. package/dist/src/lib/wallet-money.js +0 -578
  176. package/dist/src/lib/wallet-request.d.ts +0 -50
  177. package/dist/src/lib/wallet-request.js +0 -86
  178. package/dist/src/links.d.ts +0 -5
  179. package/dist/src/links.js +0 -45
  180. package/dist/src/media.d.ts +0 -29
  181. package/dist/src/media.js +0 -487
  182. package/dist/src/message-receipt.d.ts +0 -25
  183. package/dist/src/message-receipt.js +0 -71
  184. package/dist/src/message.d.ts +0 -13
  185. package/dist/src/message.js +0 -92
  186. package/dist/src/onboard.d.ts +0 -16
  187. package/dist/src/onboard.js +0 -149
  188. package/dist/src/plugin.d.ts +0 -2
  189. package/dist/src/plugin.js +0 -193
  190. package/dist/src/push.d.ts +0 -2
  191. package/dist/src/push.js +0 -115
  192. package/dist/src/render.d.ts +0 -21
  193. package/dist/src/render.js +0 -32
  194. package/dist/src/secrets-device.d.ts +0 -32
  195. package/dist/src/secrets-device.js +0 -127
  196. package/dist/src/secrets-give.d.ts +0 -125
  197. package/dist/src/secrets-give.js +0 -236
  198. package/dist/src/secrets-list.d.ts +0 -27
  199. package/dist/src/secrets-list.js +0 -84
  200. package/dist/src/secrets-run.d.ts +0 -31
  201. package/dist/src/secrets-run.js +0 -182
  202. package/dist/src/secrets.d.ts +0 -33
  203. package/dist/src/secrets.js +0 -200
  204. package/dist/src/setup.d.ts +0 -6
  205. package/dist/src/setup.js +0 -127
  206. package/dist/src/ship.d.ts +0 -2
  207. package/dist/src/ship.js +0 -18
  208. package/dist/src/shop.d.ts +0 -10
  209. package/dist/src/shop.js +0 -110
  210. package/dist/src/skill-parser.d.ts +0 -14
  211. package/dist/src/skill-parser.js +0 -113
  212. package/dist/src/skill.d.ts +0 -2
  213. package/dist/src/skill.js +0 -493
  214. package/dist/src/slug.d.ts +0 -2
  215. package/dist/src/slug.js +0 -6
  216. package/dist/src/social.d.ts +0 -2
  217. package/dist/src/social.js +0 -106
  218. package/dist/src/staff.d.ts +0 -2
  219. package/dist/src/staff.js +0 -104
  220. package/dist/src/start.d.ts +0 -15
  221. package/dist/src/start.js +0 -203
  222. package/dist/src/status.d.ts +0 -2
  223. package/dist/src/status.js +0 -52
  224. package/dist/src/substrate.d.ts +0 -2
  225. package/dist/src/substrate.js +0 -258
  226. package/dist/src/swap.d.ts +0 -93
  227. package/dist/src/swap.js +0 -622
  228. package/dist/src/tasks.d.ts +0 -2
  229. package/dist/src/tasks.js +0 -743
  230. package/dist/src/templates.d.ts +0 -1
  231. package/dist/src/templates.js +0 -213
  232. package/dist/src/trade.d.ts +0 -2
  233. package/dist/src/trade.js +0 -91
  234. package/dist/src/trail.d.ts +0 -2
  235. package/dist/src/trail.js +0 -41
  236. package/dist/src/validate.d.ts +0 -13
  237. package/dist/src/validate.js +0 -35
  238. package/dist/src/wallet-money.d.ts +0 -152
  239. package/dist/src/wallet-money.js +0 -564
  240. package/dist/src/wallet.d.ts +0 -167
  241. package/dist/src/wallet.js +0 -855
  242. package/dist/src/workflow.d.ts +0 -2
  243. package/dist/src/workflow.js +0 -166
  244. package/dist/src/write.d.ts +0 -43
  245. package/dist/src/write.js +0 -180
@@ -1,202 +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
- const EVM_ADDRESS = /^0x[0-9a-fA-F]{40}$/;
15
- const SUI_ADDRESS = /^0x[0-9a-fA-F]{64}$/;
16
- export const isEvmAddress = (s) => EVM_ADDRESS.test(s);
17
- export const isSuiAddress = (s) => SUI_ADDRESS.test(s);
18
- export const EVM_CHAINS = [
19
- {
20
- name: 'ethereum', rpc: 'https://ethereum-rpc.publicnode.com',
21
- tokens: [
22
- { symbol: 'USDC', contract: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', decimals: 6 },
23
- { symbol: 'USDT', contract: '0xdac17f958d2ee523a2206206994597c13d831ec7', decimals: 6 },
24
- ],
25
- },
26
- { name: 'base', rpc: 'https://base-rpc.publicnode.com', tokens: [{ symbol: 'USDC', contract: '0x833589fcd6edb6e08f4c7c32d4f71b54bda02913', decimals: 6 }] },
27
- {
28
- name: 'arbitrum', rpc: 'https://arbitrum-one-rpc.publicnode.com',
29
- tokens: [
30
- { symbol: 'USDC', contract: '0xaf88d065e77c8cc2239327c5edb3a432268e5831', decimals: 6 },
31
- { symbol: 'USDT', contract: '0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9', decimals: 6 },
32
- ],
33
- },
34
- ];
35
- /** Sui's public JSON-RPC was switched off; GraphQL is the supported public read (measured 2026-11-09). */
36
- export const SUI_GRAPHQL = 'https://graphql.mainnet.sui.io/graphql';
37
- export const HL_INFO = 'https://api.hyperliquid.xyz/info';
38
- /** Base units → a plain decimal, no float. */
39
- export function formatUnits(raw, decimals) {
40
- const neg = raw < 0n;
41
- const s = (neg ? -raw : raw).toString().padStart(decimals + 1, '0');
42
- const whole = s.slice(0, s.length - decimals);
43
- const frac = s.slice(s.length - decimals).replace(/0+$/, '');
44
- return `${neg ? '-' : ''}${whole}${frac ? `.${frac}` : ''}`;
45
- }
46
- async function post(f, url, body) {
47
- const res = await f(url, { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify(body) });
48
- if (!res.ok)
49
- throw new Error('http_error');
50
- return res.json();
51
- }
52
- const row = (chain, asset, read, decimals) => read().then((raw) => ({ chain, asset, amount: formatUnits(raw, decimals) }), (e) => ({ chain, asset, amount: null, unavailable: e instanceof Error ? e.message : 'read_failed' }));
53
- const rpcHex = async (f, url, method, params) => {
54
- const r = (await post(f, url, { jsonrpc: '2.0', id: 1, method, params }));
55
- if (typeof r.result !== 'string' || !/^0x[0-9a-fA-F]*$/.test(r.result))
56
- throw new Error('bad_answer');
57
- return r.result === '0x' ? 0n : BigInt(r.result);
58
- };
59
- export async function readEvm(address, f) {
60
- const pad = address.slice(2).toLowerCase().padStart(64, '0');
61
- const reads = [];
62
- for (const c of EVM_CHAINS) {
63
- reads.push(row(c.name, 'ETH', () => rpcHex(f, c.rpc, 'eth_getBalance', [address, 'latest']), 18));
64
- for (const t of c.tokens) {
65
- reads.push(row(c.name, t.symbol, () => rpcHex(f, c.rpc, 'eth_call', [{ to: t.contract, data: `0x70a08231${pad}` }, 'latest']), t.decimals));
66
- }
67
- }
68
- return Promise.all(reads);
69
- }
70
- export async function readSui(address, f) {
71
- return [
72
- await row('sui', 'SUI', async () => {
73
- const r = (await post(f, SUI_GRAPHQL, {
74
- query: 'query($a: SuiAddress!) { address(address: $a) { balance(coinType: "0x2::sui::SUI") { totalBalance } } }',
75
- variables: { a: address },
76
- }));
77
- const b = r.data?.address?.balance?.totalBalance;
78
- // An address that never held SUI has a null balance object: that is a real zero only when the
79
- // address itself answered.
80
- if (r.data?.address && r.data.address.balance === null)
81
- return 0n;
82
- if (typeof b !== 'string' || !/^\d+$/.test(b))
83
- throw new Error('bad_answer');
84
- return BigInt(b);
85
- }, 9),
86
- ];
87
- }
88
- export async function readHyperliquid(address, f) {
89
- try {
90
- const [p, s] = await Promise.all([
91
- post(f, HL_INFO, { type: 'clearinghouseState', user: address }),
92
- post(f, HL_INFO, { type: 'spotClearinghouseState', user: address }),
93
- ]);
94
- return {
95
- perps: p.marginSummary?.accountValue ?? null,
96
- withdrawable: p.withdrawable ?? null,
97
- spot: (s.balances ?? []).map((b) => ({ coin: b.coin, total: b.total })),
98
- };
99
- }
100
- catch (e) {
101
- return { perps: null, withdrawable: null, spot: null, unavailable: e instanceof Error ? e.message : 'read_failed' };
102
- }
103
- }
104
- export async function readBalances(addresses, f) {
105
- const [evm, sui, hl] = await Promise.all([
106
- addresses.evm ? readEvm(addresses.evm, f) : Promise.resolve([]),
107
- addresses.sui ? readSui(addresses.sui, f) : Promise.resolve([]),
108
- addresses.evm ? readHyperliquid(addresses.evm, f) : Promise.resolve(undefined),
109
- ]);
110
- return {
111
- ok: true,
112
- network: 'mainnet',
113
- rows: [...evm, ...sui],
114
- ...(hl ? { hyperliquid: hl } : {}),
115
- note: 'Mainnet, read from the chains themselves. `wallet get` shows ONE\'s own ledger, which is test money for most chains. A row that says unavailable was not read; it is not zero.',
116
- };
117
- }
118
- export function balanceLines(r, addresses) {
119
- const lines = [];
120
- const pad = (s, n) => s.padEnd(n);
121
- if (addresses.evm)
122
- lines.push(`evm ${addresses.evm}`);
123
- if (addresses.sui)
124
- lines.push(`sui ${addresses.sui}`);
125
- for (const x of r.rows) {
126
- const v = x.amount === null ? `unavailable (${x.unavailable ?? 'read_failed'})` : x.amount;
127
- if (x.amount === '0')
128
- continue;
129
- lines.push(`${pad(x.chain, 10)}${pad(x.asset, 6)}${v}`);
130
- }
131
- const nonzero = r.rows.filter((x) => x.amount !== '0').length;
132
- if (nonzero === 0)
133
- lines.push('(every chain read answered: nothing here)');
134
- if (r.hyperliquid) {
135
- const h = r.hyperliquid;
136
- if (h.unavailable)
137
- lines.push(`hyperliquid unavailable (${h.unavailable})`);
138
- else {
139
- lines.push(`hyperliquid perps ${h.perps ?? '0'} (withdrawable ${h.withdrawable ?? '0'})`);
140
- lines.push(`hyperliquid spot ${h.spot && h.spot.length ? h.spot.map((b) => `${b.total} ${b.coin}`).join(', ') : 'none'}`);
141
- lines.push('perps and spot are separate balances; they are not summed');
142
- }
143
- }
144
- return lines;
145
- }
146
- export function balancesCmd(deps, defaultApi) {
147
- return new Command('balances')
148
- .description('What is really in your wallet on mainnet: ETH, USDC, USDT on Ethereum, Base and Arbitrum; SUI; Hyperliquid perps and spot. No key, nothing signed. No address = your workspace wallet')
149
- .argument('[address]', 'a 0x EVM address (40 hex) or a Sui address (64 hex)')
150
- .option('--workspace <slug>', 'Workspace (defaults to AGENCY_SLUG)')
151
- .option('--actor <id>', 'Actor within the workspace (defaults to workspace)')
152
- .option('--api <url>', 'API base URL', defaultApi)
153
- .option('--key <key>', 'API key (needed only without an address)')
154
- .action(async function (address, opts) {
155
- const json = Boolean(this.optsWithGlobals().json);
156
- let addrs;
157
- if (address) {
158
- const a = address.trim();
159
- if (isEvmAddress(a))
160
- addrs = { evm: a };
161
- else if (isSuiAddress(a))
162
- addrs = { sui: a };
163
- else {
164
- const err = { ok: false, error: 'bad_address', next: 'Pass a 0x EVM address (40 hex characters) or a Sui address (64).' };
165
- if (json)
166
- process.stdout.write(JSON.stringify(err) + '\n');
167
- else
168
- console.error('✗', err.next);
169
- process.exit(1);
170
- return;
171
- }
172
- }
173
- else {
174
- try {
175
- addrs = await deps.addresses(opts);
176
- }
177
- catch (e) {
178
- const msg = e instanceof Error ? e.message : 'wallet_read_failed';
179
- if (json)
180
- process.stdout.write(JSON.stringify({ ok: false, error: 'wallet_read_failed', detail: msg, next: 'Pass an address: one wallet balances 0x…' }) + '\n');
181
- else
182
- console.error('✗', msg, '\n Pass an address: one wallet balances 0x…');
183
- process.exit(1);
184
- return;
185
- }
186
- if (!addrs.evm && !addrs.sui) {
187
- const err = { ok: false, error: 'no_address', next: 'Your workspace has no wallet address registered. Pass one: one wallet balances 0x…' };
188
- if (json)
189
- process.stdout.write(JSON.stringify(err) + '\n');
190
- else
191
- console.error('✗', err.next);
192
- process.exit(1);
193
- return;
194
- }
195
- }
196
- const r = await readBalances(addrs, deps.fetch);
197
- if (json)
198
- process.stdout.write(JSON.stringify({ ...r, addresses: addrs }) + '\n');
199
- else
200
- console.log(balanceLines(r, addrs).join('\n'));
201
- });
202
- }
@@ -1 +0,0 @@
1
- export declare function displayBanner(): void;
@@ -1,17 +0,0 @@
1
- // The ONE wordmark — ported from legacy 3.8.3's banner.js, plain stdout
2
- // (no chalk: the current CLI stays dependency-lean). Shown only on the
3
- // human-TTY paths (bare invocation, `create`) — never for an agent shell,
4
- // which wants signal, not decoration.
5
- export function displayBanner() {
6
- process.stdout.write(`
7
- ██████╗ ███╗ ██╗███████╗
8
- ██╔═══██╗████╗ ██║██╔════╝
9
- ██║ ██║██╔██╗ ██║█████╗
10
- ██║ ██║██║╚██╗██║██╔══╝
11
- ╚██████╔╝██║ ╚████║███████╗
12
- ╚═════╝ ╚═╝ ╚═══╝╚══════╝
13
- Give your agents financial superpowers.
14
- https://one.ie
15
-
16
- `);
17
- }
@@ -1,8 +0,0 @@
1
- import { Command } from 'commander';
2
- /** `one broadcast` — operate newsletters from the terminal.
3
- * Two verbs: list + send. Both hit broadcast:* receivers via ask(); no new route. */
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;
7
- /** `one newsletter` — pull/push newsletter block trees from the terminal. */
8
- export declare function newsletterCmd(): Command;
@@ -1,175 +0,0 @@
1
- import { Command } from 'commander';
2
- import { authHeaders, resolveBase } from './lib/client.js';
3
- import { askPath } from './lib/api-path.js';
4
- const DEFAULT_API = resolveBase({}, 'https://api.one.ie');
5
- async function ask(api, receiver, data) {
6
- const res = await fetch(askPath(api.replace(/\/$/, ''), receiver), {
7
- method: 'POST',
8
- headers: authHeaders(),
9
- body: JSON.stringify({ data }),
10
- });
11
- if (!res.ok) {
12
- process.stderr.write(`POST /api/ask/${receiver} → ${res.status}\n`);
13
- process.exit(1);
14
- }
15
- return res.json();
16
- }
17
- function out(data) {
18
- process.stdout.write(JSON.stringify(data, null, 2) + '\n');
19
- }
20
- /** `one broadcast` — operate newsletters from the terminal.
21
- * Two verbs: list + send. Both hit broadcast:* receivers via ask(); no new route. */
22
- export function broadcastCmd() {
23
- const cmd = new Command('broadcast').description('Operate email broadcasts (newsletters)');
24
- cmd
25
- .command('list')
26
- .description('List broadcasts for the workspace')
27
- .option('--limit <n>', 'Max results', '20')
28
- .option('--api <url>', 'API base URL', DEFAULT_API)
29
- .action(async (opts) => {
30
- out(await ask(opts.api, 'broadcast:list', { limit: Number(opts.limit) }));
31
- });
32
- cmd
33
- .command('send <id>')
34
- .description('Send a broadcast now (inline drain, suppression-checked)')
35
- .option('--api <url>', 'API base URL', DEFAULT_API)
36
- .action(async (id, opts) => {
37
- out(await ask(opts.api, 'broadcast:send', { broadcastId: id }));
38
- });
39
- return cmd;
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
- }
65
- // ---------------------------------------------------------------------------
66
- // Inline block serialization — mirrors serialize.ts; no Zod dep (CLI rule)
67
- // ---------------------------------------------------------------------------
68
- function serializeBlocksMd(blocks) {
69
- return blocks.map(({ kind, ...rest }) => '```block ' + kind + '\n' + JSON.stringify(rest) + '\n```').join('\n\n');
70
- }
71
- function parseBlocksMd(md) {
72
- const blocks = [];
73
- const fence = /^```block ([a-z]+)\n([\s\S]*?)\n```$/gm;
74
- let m;
75
- while ((m = fence.exec(md)) !== null) {
76
- const lineNo = md.slice(0, m.index).split('\n').length;
77
- try {
78
- const body = JSON.parse(m[2]);
79
- blocks.push({ kind: m[1], ...body });
80
- }
81
- catch (e) {
82
- throw new Error(`parseBlocks: invalid JSON at line ${lineNo}: ${e instanceof Error ? e.message : e}`);
83
- }
84
- }
85
- return blocks;
86
- }
87
- function diffBlocks(before, after) {
88
- const diffs = [];
89
- const beforeById = new Map(before.map(b => [b.id, b]));
90
- const afterById = new Map(after.map(b => [b.id, b]));
91
- for (const [id, b] of beforeById) {
92
- if (!afterById.has(id)) {
93
- diffs.push({ op: '-', kind: b.kind, id });
94
- }
95
- }
96
- for (const [id, a] of afterById) {
97
- if (!beforeById.has(id)) {
98
- diffs.push({ op: '+', kind: a.kind, id });
99
- }
100
- else {
101
- const b = beforeById.get(id);
102
- if (JSON.stringify(b) !== JSON.stringify(a)) {
103
- diffs.push({ op: '~', kind: a.kind, id });
104
- }
105
- }
106
- }
107
- return diffs;
108
- }
109
- /** `one newsletter` — pull/push newsletter block trees from the terminal. */
110
- export function newsletterCmd() {
111
- const cmd = new Command('newsletter').description('Pull and push newsletter component trees');
112
- cmd
113
- .command('pull <broadcastId>')
114
- .description('Fetch a broadcast and print its blocks as markdown')
115
- .option('--api <url>', 'API base URL', DEFAULT_API)
116
- .action(async (broadcastId, opts) => {
117
- const res = await ask(opts.api, 'broadcast:get', { broadcastId });
118
- const b = res.broadcast;
119
- if (!b) {
120
- process.stderr.write(`broadcast:get returned no broadcast\n`);
121
- process.exit(1);
122
- }
123
- if (b.components && Array.isArray(b.components) && b.components.length > 0) {
124
- process.stdout.write(serializeBlocksMd(b.components) + '\n');
125
- }
126
- else if (b.body_md) {
127
- process.stdout.write(b.body_md + '\n');
128
- }
129
- else {
130
- process.stdout.write('');
131
- }
132
- });
133
- cmd
134
- .command('push <broadcastId> <file>')
135
- .description('Parse a markdown file and update broadcast components')
136
- .option('--api <url>', 'API base URL', DEFAULT_API)
137
- .option('--test', 'Dry-run: mark update as test_send')
138
- .action(async (broadcastId, file, opts) => {
139
- const { readFileSync } = await import('node:fs');
140
- let md;
141
- try {
142
- md = readFileSync(file, 'utf8');
143
- }
144
- catch (e) {
145
- process.stderr.write(`Cannot read ${file}: ${e instanceof Error ? e.message : e}\n`);
146
- process.exit(1);
147
- }
148
- let components;
149
- try {
150
- components = parseBlocksMd(md);
151
- }
152
- catch (e) {
153
- process.stderr.write(`${e instanceof Error ? e.message : e}\n`);
154
- process.exit(1);
155
- }
156
- // Fetch current state for diff display
157
- const current = await ask(opts.api, 'broadcast:get', { broadcastId });
158
- const prev = (current.broadcast?.components ?? []);
159
- const version = current.broadcast?.version;
160
- const diffs = diffBlocks(prev, components);
161
- for (const d of diffs) {
162
- process.stdout.write(`${d.op} ${d.kind} (${d.id})\n`);
163
- }
164
- if (diffs.length === 0) {
165
- process.stdout.write('(no changes)\n');
166
- }
167
- const payload = { broadcastId, components };
168
- if (version !== undefined)
169
- payload['version'] = version;
170
- if (opts.test)
171
- payload['test_send'] = true;
172
- out(await ask(opts.api, 'broadcast:update', payload));
173
- });
174
- return cmd;
175
- }
@@ -1,12 +0,0 @@
1
- import { Command } from 'commander';
2
- interface CatalogItem {
3
- receiver: string;
4
- summary?: string;
5
- effect?: string;
6
- cost?: unknown;
7
- reversible?: boolean;
8
- settles?: string;
9
- }
10
- export declare function catalogItems(data: Record<string, unknown>): CatalogItem[];
11
- export declare function catalogCommands(program: Command): void;
12
- export {};
@@ -1,76 +0,0 @@
1
- import { askPath } from './lib/api-path.js';
2
- import { authHeaders } from './lib/client.js';
3
- const DEFAULT_API = process.env.ONEIE_BASE_URL ?? process.env.ONE_API_URL ?? 'https://api.one.ie';
4
- function base(opts) {
5
- return (opts.api ?? DEFAULT_API).replace(/\/$/, '');
6
- }
7
- const RECIPE_BLURB = {
8
- spine: 'onboard — become an actor, mint a key, declare capability',
9
- build: 'build a world — workspace, group, actor, thing',
10
- trade: 'discover peers, hire, get paid',
11
- transact: 'post a bounty, settle onchain',
12
- };
13
- function formatItem(it) {
14
- const meta = [];
15
- if (it.cost != null)
16
- meta.push(`cost: ${typeof it.cost === 'object' ? JSON.stringify(it.cost) : it.cost}`);
17
- if (it.settles && it.settles !== 'none')
18
- meta.push(`settles: ${it.settles}`);
19
- if (it.reversible === false)
20
- meta.push('reversible: false');
21
- const tail = meta.length ? ` · ${meta.join(' · ')}` : '';
22
- return ` ${it.receiver.padEnd(28)}${it.summary ?? ''}${tail}`;
23
- }
24
- function formatCatalog(items, goal) {
25
- if (goal) {
26
- const match = items.filter((it) => it.receiver.toLowerCase().includes(goal.toLowerCase()));
27
- if (!match.length)
28
- return ` (no receivers matching "${goal}")`;
29
- return `GOAL: ${goal}\n\n` + match.map(formatItem).join('\n');
30
- }
31
- const grouped = {};
32
- for (const it of items) {
33
- const group = it.receiver.split(':')[0] ?? 'other';
34
- (grouped[group] ??= []).push(it);
35
- }
36
- const out = [];
37
- for (const [group, groupItems] of Object.entries(grouped)) {
38
- out.push(`${group.toUpperCase()} — ${RECIPE_BLURB[group] ?? ''}`);
39
- groupItems.forEach((it) => out.push(formatItem(it)));
40
- out.push('');
41
- }
42
- return out.join('\n');
43
- }
44
- // The door answers { outcome, result: CatalogItem[] }; older shapes put the list at
45
- // items / receivers. Reading only those two printed an empty catalog.
46
- export function catalogItems(data) {
47
- const r = data.result;
48
- const list = Array.isArray(r) ? r : r?.items ?? data.items ?? data.receivers ?? [];
49
- return Array.isArray(list) ? list : [];
50
- }
51
- export function catalogCommands(program) {
52
- program
53
- .command('catalog')
54
- .description('Browse receiver surface by recipe')
55
- .option('--goal <text>', 'Filter by receiver group or keyword')
56
- .option('--api <url>', 'API base URL', DEFAULT_API)
57
- .option('--json', 'Output raw JSON')
58
- .action(async (opts) => {
59
- const res = await fetch(askPath(base(opts), 'meta:catalog'), {
60
- method: 'POST',
61
- headers: authHeaders(),
62
- body: JSON.stringify({ data: opts.goal ? { goal: opts.goal } : {} }),
63
- });
64
- if (!res.ok) {
65
- process.stderr.write(`meta:catalog → ${res.status}\n`);
66
- process.exit(1);
67
- }
68
- const data = await res.json();
69
- if (opts.json) {
70
- process.stdout.write(JSON.stringify(data, null, 2) + '\n');
71
- return;
72
- }
73
- const items = catalogItems(data);
74
- process.stdout.write(formatCatalog(items, opts.goal) + '\n');
75
- });
76
- }
@@ -1,2 +0,0 @@
1
- import { Command } from 'commander';
2
- export declare function chatCmd(): Command;
package/dist/src/chat.js DELETED
@@ -1,92 +0,0 @@
1
- import { Command } from 'commander';
2
- import { authHeaders, resolveBase, resolveKey } from './lib/client.js';
3
- const DEFAULT_API = resolveBase({}, 'https://one.ie');
4
- const DEFAULT_CHANNELS = process.env.CHANNELS_URL ?? 'https://channels.one.ie';
5
- const DEFAULT_SPACES = ['vespio', 'elitemoversca', 'world'];
6
- async function spacePost(api, space, content) {
7
- const res = await fetch(`${api.replace(/\/$/, '')}/api/ask/space:post`, {
8
- method: 'POST',
9
- headers: authHeaders(),
10
- body: JSON.stringify({ data: { space, content } }),
11
- });
12
- if (!res.ok)
13
- return { ok: false, error: `HTTP ${res.status}` };
14
- const j = await res.json();
15
- return j.result ?? { ok: j.outcome === 'result', error: j.error };
16
- }
17
- export function chatCmd() {
18
- const cmd = new Command('chat')
19
- .description('Send messages to Spaces (fan-out) or listen for incoming messages (fan-in)');
20
- // one chat "text" [--to space] [--broadcast]
21
- cmd
22
- .command('send <text>', { isDefault: true })
23
- .description('Send a message to a Space (default: broadcast to all)')
24
- .option('--to <space>', 'Target space slug (default: broadcast to vespio + elitemoversca + world)')
25
- .option('--api <url>', 'API base URL', DEFAULT_API)
26
- .action(async (text, opts) => {
27
- if (opts.to) {
28
- const r = await spacePost(opts.api, opts.to, text);
29
- process.stdout.write(JSON.stringify(r, null, 2) + '\n');
30
- }
31
- else {
32
- const results = await Promise.all(DEFAULT_SPACES.map(s => spacePost(opts.api, s, text)));
33
- results.forEach((r, i) => process.stdout.write(`→ space:${DEFAULT_SPACES[i]} ${r.ok ? r.id : r.error}\n`));
34
- process.stdout.write(`ok broadcast to ${DEFAULT_SPACES.length} spaces\n`);
35
- }
36
- });
37
- // one chat broadcast "text"
38
- cmd
39
- .command('broadcast <text>')
40
- .description('Fan-out to all default spaces (vespio + elitemoversca + world)')
41
- .option('--spaces <list>', 'Comma-separated space slugs', DEFAULT_SPACES.join(','))
42
- .option('--api <url>', 'API base URL', DEFAULT_API)
43
- .action(async (text, opts) => {
44
- const spaces = opts.spaces.split(',').map(s => s.trim()).filter(Boolean);
45
- const results = await Promise.all(spaces.map(s => spacePost(opts.api, s, text)));
46
- results.forEach((r, i) => process.stdout.write(`→ space:${spaces[i]} ${r.ok ? r.id : r.error}\n`));
47
- process.stdout.write(`ok broadcast to ${spaces.length} spaces\n`);
48
- });
49
- // one chat listen <space>
50
- cmd
51
- .command('listen <space>')
52
- .description('Stream incoming messages from a Space via SSE (Ctrl+C to stop)')
53
- .option('--channels <url>', 'Channels base URL', DEFAULT_CHANNELS)
54
- .action(async (space, opts) => {
55
- const group = space.startsWith('space:') ? space : `space:${space}`;
56
- const url = `${opts.channels.replace(/\/$/, '')}/stream/${encodeURIComponent(group)}`;
57
- process.stderr.write(`Listening on ${group} — Ctrl+C to stop\n`);
58
- const key = resolveKey();
59
- const h = { Accept: 'text/event-stream' };
60
- if (key)
61
- h['Authorization'] = `Bearer ${key}`;
62
- const res = await fetch(url, { headers: h });
63
- if (!res.ok || !res.body) {
64
- process.stderr.write(`stream error: ${res.status}\n`);
65
- process.exit(1);
66
- }
67
- const reader = res.body.getReader();
68
- const dec = new TextDecoder();
69
- while (true) {
70
- const { done, value } = await reader.read();
71
- if (done)
72
- break;
73
- const chunk = dec.decode(value);
74
- for (const line of chunk.split('\n')) {
75
- if (!line.startsWith('data:'))
76
- continue;
77
- const raw = line.slice(5).trim();
78
- if (!raw || raw === '[DONE]')
79
- continue;
80
- try {
81
- const msg = JSON.parse(raw);
82
- const t = msg.ts ? new Date(msg.ts).toISOString().slice(11, 19) : '';
83
- process.stdout.write(`[${t}] ${msg.sender ?? '?'}: ${msg.content ?? raw}\n`);
84
- }
85
- catch {
86
- process.stdout.write(raw + '\n');
87
- }
88
- }
89
- }
90
- });
91
- return cmd;
92
- }
@@ -1,5 +0,0 @@
1
- import { Command } from 'commander';
2
- /** `clients/<slug>.toml` — the scaffold `client add` reads. Optional keys are
3
- * commented so `readClient()`'s defaults apply until the operator opts in. */
4
- export declare function clientToml(name: string, slug: string): string;
5
- export declare function clientCmd(): Command;