oneie 5.7.3 → 5.7.5
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 +14 -0
- package/dist/package.json +2 -2
- package/dist/src/banner.js +2 -1
- package/dist/src/index.js +3 -0
- package/dist/src/init.js +1 -1
- package/dist/src/join.js +1 -1
- package/dist/src/lib/journey-words.d.ts +33 -0
- package/dist/src/lib/journey-words.js +221 -0
- package/dist/src/lib/journey.js +3 -3
- package/dist/src/lib/swap-core.d.ts +163 -0
- package/dist/src/lib/swap-core.js +405 -0
- package/dist/src/secrets-give.d.ts +2 -2
- package/dist/src/secrets-give.js +2 -2
- package/dist/src/secrets-list.d.ts +27 -0
- package/dist/src/secrets-list.js +84 -0
- package/dist/src/secrets.d.ts +3 -2
- package/dist/src/secrets.js +6 -3
- package/dist/src/start.js +23 -32
- package/dist/src/swap.d.ts +93 -0
- package/dist/src/swap.js +622 -0
- package/dist/src/wallet.d.ts +21 -0
- package/dist/src/wallet.js +76 -0
- package/dist/src/write.js +7 -1
- package/package.json +2 -2
package/dist/src/wallet.js
CHANGED
|
@@ -145,6 +145,53 @@ export function walletCmd() {
|
|
|
145
145
|
const result = await ask(base, key, 'wallet:get', { workspace, actor: opts.actor });
|
|
146
146
|
out(cmd, okWrap(result));
|
|
147
147
|
});
|
|
148
|
+
// list — every wallet in the workspace with the words it wears (treasury · agent · person ·
|
|
149
|
+
// limit · paused · no-limit · sweep · vault · no-address). The tags are wallet:get's own,
|
|
150
|
+
// derived on the server from the rows, the caps and the signed sweep rules.
|
|
151
|
+
cmd.command('list')
|
|
152
|
+
.description('Every wallet in the workspace with its tags, limit and sweep rule')
|
|
153
|
+
.option('--workspace <slug>', 'Workspace (defaults to AGENCY_SLUG)')
|
|
154
|
+
.option('--api <url>', 'API base URL', DEFAULT_API)
|
|
155
|
+
.option('--key <key>', 'API key (overrides ONEIE_API_KEY env)')
|
|
156
|
+
.action(async (opts) => {
|
|
157
|
+
const { base, key } = resolveAuth(opts);
|
|
158
|
+
const workspace = resolveWorkspace(opts.workspace);
|
|
159
|
+
const result = await ask(base, key, 'wallet:get', { workspace });
|
|
160
|
+
const wallets = Array.isArray(result.wallets) ? result.wallets : [];
|
|
161
|
+
const rows = wallets.map(walletLine);
|
|
162
|
+
if (cmd.parent?.opts().json) {
|
|
163
|
+
process.stdout.write(JSON.stringify({ ok: !result.error, workspace, wallets: rows, ...(result.error ? { error: result.error } : {}) }) + '\n');
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
if (result.error)
|
|
167
|
+
return out(cmd, okWrap(result));
|
|
168
|
+
if (!rows.length)
|
|
169
|
+
return console.log(`no wallets in ${workspace} yet`);
|
|
170
|
+
for (const r of rows)
|
|
171
|
+
console.log(formatWalletLine(r));
|
|
172
|
+
});
|
|
173
|
+
// limit — the owner's one number for an agent: credits a month, 0 pauses it. Lowering is
|
|
174
|
+
// open to anyone who controls the workspace; raising needs a person (this CLI's own human
|
|
175
|
+
// key counts, an agent key never does). The server decides — this only sends the number.
|
|
176
|
+
cmd.command('limit <agent> <credits>')
|
|
177
|
+
.description('Set an agent\'s spending limit in credits a month (1000 = $1). 0 pauses it')
|
|
178
|
+
.option('--workspace <slug>', 'Workspace (defaults to AGENCY_SLUG)')
|
|
179
|
+
.option('--api <url>', 'API base URL', DEFAULT_API)
|
|
180
|
+
.option('--key <key>', 'API key (overrides ONEIE_API_KEY env)')
|
|
181
|
+
.action(async (agent, raw, opts) => {
|
|
182
|
+
const credits = parseCredits(raw);
|
|
183
|
+
if (credits === null) {
|
|
184
|
+
out(cmd, { ok: false, error: 'credits must be a whole number from 0 to 10000000' });
|
|
185
|
+
process.exitCode = 1;
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
const { base, key } = resolveAuth(opts);
|
|
189
|
+
const workspace = resolveWorkspace(opts.workspace);
|
|
190
|
+
const result = await ask(base, key, 'wallet:update', { workspace, actor: agent, limit: credits });
|
|
191
|
+
if (!result.ok)
|
|
192
|
+
process.exitCode = 1;
|
|
193
|
+
out(cmd, okWrap(result));
|
|
194
|
+
});
|
|
148
195
|
cmd.command('create')
|
|
149
196
|
.description('Provision a wallet row for an actor (idempotent)')
|
|
150
197
|
.option('--workspace <slug>', 'Workspace (defaults to AGENCY_SLUG)')
|
|
@@ -632,3 +679,32 @@ export async function unlock(dir, io = terminalIO()) {
|
|
|
632
679
|
const wallet = await openedWallet(blob, mnemonic);
|
|
633
680
|
return { blob, mnemonic, addresses: Object.fromEntries(wallet.keys.map((k) => [k.chain, k.address])), keys: wallet.keys };
|
|
634
681
|
}
|
|
682
|
+
/** "5000" → 5000; anything that is not a whole number in 0..10M → null (the server checks again). */
|
|
683
|
+
export function parseCredits(raw) {
|
|
684
|
+
if (!/^\d{1,8}$/.test(raw.trim()))
|
|
685
|
+
return null;
|
|
686
|
+
const n = Number(raw.trim());
|
|
687
|
+
return n <= 10_000_000 ? n : null;
|
|
688
|
+
}
|
|
689
|
+
/** One wallet:get row reduced to what a person reads: who, the tags, the first address, the limit, the sweep. */
|
|
690
|
+
export function walletLine(w) {
|
|
691
|
+
const address = ['sui_address', 'evm_address', 'solana_address', 'btc_address', 'asi_address']
|
|
692
|
+
.map((k) => w[k]).find((v) => typeof v === 'string' && v.length > 0) ?? null;
|
|
693
|
+
return {
|
|
694
|
+
actor: String(w.actor ?? ''),
|
|
695
|
+
tags: Array.isArray(w.tags) ? w.tags.map(String) : [],
|
|
696
|
+
address,
|
|
697
|
+
limit: w.limit ?? null,
|
|
698
|
+
sweep: w.sweep ?? null,
|
|
699
|
+
};
|
|
700
|
+
}
|
|
701
|
+
export function formatWalletLine(r) {
|
|
702
|
+
const parts = [r.actor.padEnd(24), `[${r.tags.join(' ')}]`];
|
|
703
|
+
if (r.limit)
|
|
704
|
+
parts.push(r.limit.paused ? 'paused' : `limit ${r.limit.spentCredits}/${r.limit.monthlyCredits} credits`);
|
|
705
|
+
if (r.sweep)
|
|
706
|
+
parts.push(`sweeps ${r.sweep.chain} above ${r.sweep.thresholdUnits} keeping ${r.sweep.floatUnits}`);
|
|
707
|
+
if (r.address)
|
|
708
|
+
parts.push(r.address);
|
|
709
|
+
return parts.join(' ');
|
|
710
|
+
}
|
package/dist/src/write.js
CHANGED
|
@@ -64,9 +64,11 @@ export async function sealNote(note, locks) {
|
|
|
64
64
|
}
|
|
65
65
|
/** Post an ALREADY SEALED block. Its inputs carry no plaintext, by signature. */
|
|
66
66
|
export async function postSealed(base, ws, sealed, from, fetchImpl = fetch) {
|
|
67
|
+
// The door reads `name` (writerLabel → "Sam (not verified)") and ignores `from`; sending
|
|
68
|
+
// `from` made every CLI note arrive as "Someone with your lock".
|
|
67
69
|
const body = { ws, sealed };
|
|
68
70
|
if (from)
|
|
69
|
-
body.
|
|
71
|
+
body.name = from;
|
|
70
72
|
const ctl = new AbortController();
|
|
71
73
|
const timer = setTimeout(() => ctl.abort(), DEADLINE_MS);
|
|
72
74
|
let res;
|
|
@@ -91,6 +93,8 @@ export async function postSealed(base, ws, sealed, from, fetchImpl = fetch) {
|
|
|
91
93
|
catch {
|
|
92
94
|
/* a non-JSON body is reported by status below */
|
|
93
95
|
}
|
|
96
|
+
if (res.status === 429 && j.error === 'inbox_busy')
|
|
97
|
+
return { ok: false, error: 'this inbox is busy — it has taken its 60 notes for these ten minutes; wait a minute and try again', code: 'inbox_busy' };
|
|
94
98
|
if (res.status === 429)
|
|
95
99
|
return { ok: false, error: 'too many notes from this address — the door takes ten a minute; wait and try again', code: 'rate_limited' };
|
|
96
100
|
if (res.ok && j.ok)
|
|
@@ -100,6 +104,8 @@ export async function postSealed(base, ws, sealed, from, fetchImpl = fetch) {
|
|
|
100
104
|
return { ok: false, error: `"${ws}" is not a workspace name`, code: 'bad_workspace' };
|
|
101
105
|
case 'unknown_workspace':
|
|
102
106
|
return { ok: false, error: `there is no workspace called "${ws}" on ${base}`, code: 'unknown_workspace' };
|
|
107
|
+
case 'too_large':
|
|
108
|
+
return { ok: false, error: 'the door refused it — the sealed note is over its size cap', code: 'too_large' };
|
|
103
109
|
case 'not_sealed':
|
|
104
110
|
return { ok: false, error: 'the door refused it — it is not one armored age block', code: 'not_sealed' };
|
|
105
111
|
default:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oneie",
|
|
3
|
-
"version": "5.7.
|
|
3
|
+
"version": "5.7.5",
|
|
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.17.
|
|
23
|
+
"@oneie/sdk": "^0.17.6"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@oneie/evals": "^0.2.0",
|