oneie 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.
- package/dist/package.json +7 -8
- package/dist/src/age-yefbe8pe.js +1 -0
- package/dist/src/evm-tx-ee2q0e3w.js +1 -0
- package/dist/src/hl-run-tgrkrk69.js +1 -0
- package/dist/src/index-0rj9wdk9.js +4 -0
- package/dist/src/index-91y484c2.js +2052 -0
- package/dist/src/index-940y3rnv.js +12 -0
- package/dist/src/index.js +1047 -134
- package/dist/src/message-key-db1xjdkw.js +1 -0
- package/dist/src/message-lock-5vr8079x.js +5 -0
- package/dist/src/sweep-order-c2p6rk8c.js +1 -0
- package/dist/src/sweep-runner-t68xe7vx.js +1 -0
- package/package.json +7 -8
- package/dist/src/agent.d.ts +0 -75
- package/dist/src/agent.js +0 -1334
- package/dist/src/agentverse.d.ts +0 -26
- package/dist/src/agentverse.js +0 -171
- package/dist/src/args.d.ts +0 -9
- package/dist/src/args.js +0 -61
- package/dist/src/auth.d.ts +0 -6
- package/dist/src/auth.js +0 -121
- package/dist/src/balances.d.ts +0 -89
- package/dist/src/balances.js +0 -202
- package/dist/src/banner.d.ts +0 -1
- package/dist/src/banner.js +0 -17
- package/dist/src/broadcast.d.ts +0 -8
- package/dist/src/broadcast.js +0 -175
- package/dist/src/catalog.d.ts +0 -12
- package/dist/src/catalog.js +0 -76
- package/dist/src/ceiling.d.ts +0 -36
- package/dist/src/ceiling.js +0 -189
- package/dist/src/chat.d.ts +0 -2
- package/dist/src/chat.js +0 -92
- package/dist/src/check.d.ts +0 -11
- package/dist/src/check.js +0 -53
- package/dist/src/client.d.ts +0 -5
- package/dist/src/client.js +0 -157
- package/dist/src/compiler.d.ts +0 -36
- package/dist/src/compiler.js +0 -366
- package/dist/src/config.d.ts +0 -24
- package/dist/src/config.js +0 -70
- package/dist/src/connect.d.ts +0 -2
- package/dist/src/connect.js +0 -64
- package/dist/src/coordinate.d.ts +0 -3
- package/dist/src/coordinate.js +0 -58
- package/dist/src/create.d.ts +0 -2
- package/dist/src/create.js +0 -113
- package/dist/src/credits.d.ts +0 -29
- package/dist/src/credits.js +0 -88
- package/dist/src/deploy.d.ts +0 -2
- package/dist/src/deploy.js +0 -19
- package/dist/src/dev.d.ts +0 -2
- package/dist/src/dev.js +0 -75
- package/dist/src/device-flow.d.ts +0 -57
- package/dist/src/device-flow.js +0 -173
- package/dist/src/doctor.d.ts +0 -26
- package/dist/src/doctor.js +0 -146
- package/dist/src/draw.d.ts +0 -18
- package/dist/src/draw.js +0 -156
- package/dist/src/endpoint.d.ts +0 -2
- package/dist/src/endpoint.js +0 -250
- package/dist/src/env.d.ts +0 -3
- package/dist/src/env.js +0 -37
- package/dist/src/eval.d.ts +0 -2
- package/dist/src/eval.js +0 -43
- package/dist/src/fn.d.ts +0 -2
- package/dist/src/fn.js +0 -70
- package/dist/src/group.d.ts +0 -2
- package/dist/src/group.js +0 -117
- package/dist/src/hl-run.d.ts +0 -119
- package/dist/src/hl-run.js +0 -480
- package/dist/src/hl.d.ts +0 -17
- package/dist/src/hl.js +0 -148
- package/dist/src/index.d.ts +0 -2
- package/dist/src/init.d.ts +0 -76
- package/dist/src/init.js +0 -278
- package/dist/src/join.d.ts +0 -11
- package/dist/src/join.js +0 -297
- package/dist/src/key-publish.d.ts +0 -40
- package/dist/src/key-publish.js +0 -232
- package/dist/src/key-seal.d.ts +0 -21
- package/dist/src/key-seal.js +0 -142
- package/dist/src/key-sweep.d.ts +0 -93
- package/dist/src/key-sweep.js +0 -270
- package/dist/src/key.d.ts +0 -26
- package/dist/src/key.js +0 -338
- package/dist/src/lib/age-plugin.d.ts +0 -51
- package/dist/src/lib/age-plugin.js +0 -130
- package/dist/src/lib/agent-env.d.ts +0 -12
- package/dist/src/lib/agent-env.js +0 -48
- package/dist/src/lib/api-path.d.ts +0 -2
- package/dist/src/lib/api-path.js +0 -40
- package/dist/src/lib/asker.d.ts +0 -34
- package/dist/src/lib/asker.js +0 -126
- package/dist/src/lib/check-words.d.ts +0 -57
- package/dist/src/lib/check-words.js +0 -144
- package/dist/src/lib/client.d.ts +0 -20
- package/dist/src/lib/client.js +0 -71
- package/dist/src/lib/env-sealed.d.ts +0 -53
- package/dist/src/lib/env-sealed.js +0 -184
- package/dist/src/lib/flow-tag.d.ts +0 -86
- package/dist/src/lib/flow-tag.js +0 -230
- package/dist/src/lib/hl-core/actions.d.ts +0 -99
- package/dist/src/lib/hl-core/actions.js +0 -69
- package/dist/src/lib/hl-core/eip712.d.ts +0 -33
- package/dist/src/lib/hl-core/eip712.js +0 -107
- package/dist/src/lib/hl-core/errors.d.ts +0 -10
- package/dist/src/lib/hl-core/errors.js +0 -15
- package/dist/src/lib/hl-core/exchange.d.ts +0 -24
- package/dist/src/lib/hl-core/exchange.js +0 -47
- package/dist/src/lib/hl-core/index.d.ts +0 -13
- package/dist/src/lib/hl-core/index.js +0 -14
- package/dist/src/lib/hl-core/meta.d.ts +0 -57
- package/dist/src/lib/hl-core/meta.js +0 -110
- package/dist/src/lib/hl-core/msgpack.d.ts +0 -18
- package/dist/src/lib/hl-core/msgpack.js +0 -136
- package/dist/src/lib/hl-core/net.d.ts +0 -2
- package/dist/src/lib/hl-core/net.js +0 -7
- package/dist/src/lib/hl-core/signing.d.ts +0 -103
- package/dist/src/lib/hl-core/signing.js +0 -295
- package/dist/src/lib/hl-core/wire.d.ts +0 -34
- package/dist/src/lib/hl-core/wire.js +0 -81
- package/dist/src/lib/invoked-as.d.ts +0 -2
- package/dist/src/lib/invoked-as.js +0 -24
- package/dist/src/lib/journey-words.d.ts +0 -84
- package/dist/src/lib/journey-words.js +0 -363
- package/dist/src/lib/journey.d.ts +0 -150
- package/dist/src/lib/journey.js +0 -264
- package/dist/src/lib/key-receipt.d.ts +0 -48
- package/dist/src/lib/key-receipt.js +0 -116
- package/dist/src/lib/key-source.d.ts +0 -9
- package/dist/src/lib/key-source.js +0 -33
- package/dist/src/lib/keyfile.d.ts +0 -136
- package/dist/src/lib/keyfile.js +0 -397
- package/dist/src/lib/launch-claude.d.ts +0 -5
- package/dist/src/lib/launch-claude.js +0 -45
- package/dist/src/lib/lock-lookup.d.ts +0 -40
- package/dist/src/lib/lock-lookup.js +0 -92
- package/dist/src/lib/message-seal.d.ts +0 -63
- package/dist/src/lib/message-seal.js +0 -150
- package/dist/src/lib/net-choice.d.ts +0 -28
- package/dist/src/lib/net-choice.js +0 -72
- package/dist/src/lib/network.d.ts +0 -22
- package/dist/src/lib/network.js +0 -50
- package/dist/src/lib/next-words.d.ts +0 -105
- package/dist/src/lib/next-words.js +0 -298
- package/dist/src/lib/paths.d.ts +0 -41
- package/dist/src/lib/paths.js +0 -91
- package/dist/src/lib/plan-draw.d.ts +0 -56
- package/dist/src/lib/plan-draw.js +0 -219
- package/dist/src/lib/plan-live.d.ts +0 -20
- package/dist/src/lib/plan-live.js +0 -192
- package/dist/src/lib/qr.d.ts +0 -21
- package/dist/src/lib/qr.js +0 -402
- package/dist/src/lib/roster.d.ts +0 -20
- package/dist/src/lib/roster.js +0 -79
- package/dist/src/lib/sale-card.d.ts +0 -117
- package/dist/src/lib/sale-card.js +0 -261
- package/dist/src/lib/shop-init.d.ts +0 -62
- package/dist/src/lib/shop-init.js +0 -63
- package/dist/src/lib/sui-grpc-send.d.ts +0 -90
- package/dist/src/lib/sui-grpc-send.js +0 -128
- package/dist/src/lib/swap-core.d.ts +0 -163
- package/dist/src/lib/swap-core.js +0 -405
- package/dist/src/lib/tasks-digest.d.ts +0 -66
- package/dist/src/lib/tasks-digest.js +0 -200
- package/dist/src/lib/tasks-graph.d.ts +0 -79
- package/dist/src/lib/tasks-graph.js +0 -463
- package/dist/src/lib/tasks-lens.d.ts +0 -31
- package/dist/src/lib/tasks-lens.js +0 -47
- package/dist/src/lib/tasks-next.d.ts +0 -25
- package/dist/src/lib/tasks-next.js +0 -103
- package/dist/src/lib/tasks-prove.d.ts +0 -15
- package/dist/src/lib/tasks-prove.js +0 -68
- package/dist/src/lib/tasks-route.d.ts +0 -29
- package/dist/src/lib/tasks-route.js +0 -151
- package/dist/src/lib/tasks-score.d.ts +0 -36
- package/dist/src/lib/tasks-score.js +0 -152
- package/dist/src/lib/tasks-workspace.d.ts +0 -18
- package/dist/src/lib/tasks-workspace.js +0 -73
- package/dist/src/lib/timed-fetch.d.ts +0 -33
- package/dist/src/lib/timed-fetch.js +0 -59
- package/dist/src/lib/vault-read.d.ts +0 -24
- package/dist/src/lib/vault-read.js +0 -77
- package/dist/src/lib/vaultfile.d.ts +0 -103
- package/dist/src/lib/vaultfile.js +0 -249
- package/dist/src/lib/wallet-money.d.ts +0 -222
- package/dist/src/lib/wallet-money.js +0 -578
- package/dist/src/lib/wallet-request.d.ts +0 -50
- package/dist/src/lib/wallet-request.js +0 -86
- package/dist/src/links.d.ts +0 -5
- package/dist/src/links.js +0 -45
- package/dist/src/media.d.ts +0 -29
- package/dist/src/media.js +0 -487
- package/dist/src/message-receipt.d.ts +0 -25
- package/dist/src/message-receipt.js +0 -71
- package/dist/src/message.d.ts +0 -13
- package/dist/src/message.js +0 -92
- package/dist/src/move.d.ts +0 -36
- package/dist/src/move.js +0 -152
- package/dist/src/network-cmd.d.ts +0 -17
- package/dist/src/network-cmd.js +0 -74
- package/dist/src/next.d.ts +0 -12
- package/dist/src/next.js +0 -67
- package/dist/src/onboard.d.ts +0 -16
- package/dist/src/onboard.js +0 -149
- package/dist/src/plugin.d.ts +0 -2
- package/dist/src/plugin.js +0 -193
- package/dist/src/push.d.ts +0 -2
- package/dist/src/push.js +0 -115
- package/dist/src/render.d.ts +0 -21
- package/dist/src/render.js +0 -32
- package/dist/src/secrets-device.d.ts +0 -32
- package/dist/src/secrets-device.js +0 -127
- package/dist/src/secrets-give.d.ts +0 -125
- package/dist/src/secrets-give.js +0 -236
- package/dist/src/secrets-list.d.ts +0 -27
- package/dist/src/secrets-list.js +0 -84
- package/dist/src/secrets-run.d.ts +0 -31
- package/dist/src/secrets-run.js +0 -182
- package/dist/src/secrets.d.ts +0 -33
- package/dist/src/secrets.js +0 -200
- package/dist/src/setup.d.ts +0 -6
- package/dist/src/setup.js +0 -127
- package/dist/src/ship.d.ts +0 -2
- package/dist/src/ship.js +0 -18
- package/dist/src/shop-buy.d.ts +0 -16
- package/dist/src/shop-buy.js +0 -101
- package/dist/src/shop.d.ts +0 -10
- package/dist/src/shop.js +0 -112
- package/dist/src/skill-parser.d.ts +0 -14
- package/dist/src/skill-parser.js +0 -113
- package/dist/src/skill.d.ts +0 -2
- package/dist/src/skill.js +0 -493
- package/dist/src/slug.d.ts +0 -2
- package/dist/src/slug.js +0 -6
- package/dist/src/social.d.ts +0 -2
- package/dist/src/social.js +0 -106
- package/dist/src/staff.d.ts +0 -2
- package/dist/src/staff.js +0 -104
- package/dist/src/start.d.ts +0 -27
- package/dist/src/start.js +0 -225
- package/dist/src/status.d.ts +0 -2
- package/dist/src/status.js +0 -52
- package/dist/src/substrate.d.ts +0 -2
- package/dist/src/substrate.js +0 -258
- package/dist/src/swap.d.ts +0 -93
- package/dist/src/swap.js +0 -622
- package/dist/src/tasks.d.ts +0 -2
- package/dist/src/tasks.js +0 -743
- package/dist/src/templates.d.ts +0 -1
- package/dist/src/templates.js +0 -213
- package/dist/src/thread.d.ts +0 -2
- package/dist/src/thread.js +0 -52
- package/dist/src/trade.d.ts +0 -2
- package/dist/src/trade.js +0 -91
- package/dist/src/trail.d.ts +0 -2
- package/dist/src/trail.js +0 -41
- package/dist/src/validate.d.ts +0 -13
- package/dist/src/validate.js +0 -35
- package/dist/src/wallet-money.d.ts +0 -158
- package/dist/src/wallet-money.js +0 -664
- package/dist/src/wallet.d.ts +0 -169
- package/dist/src/wallet.js +0 -973
- package/dist/src/workflow.d.ts +0 -2
- package/dist/src/workflow.js +0 -169
- package/dist/src/write.d.ts +0 -43
- package/dist/src/write.js +0 -180
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* key-publish.ts — `one key publish-lock | lock-of`: put a lock under a name, and read one back
|
|
3
|
-
* with the check made HERE.
|
|
4
|
-
*
|
|
5
|
-
* publish-lock derive this key's lock (same as `one key lock`), sign the text
|
|
6
|
-
* "ONE message lock v1\n<name>\n<lock>" with this key's Sui account-0
|
|
7
|
-
* key, and send {lock, signature} to `wallet:lock-publish`.
|
|
8
|
-
* lock-of GET /api/lock/<name>, rebuild the text, check the signature, print the lock.
|
|
9
|
-
*
|
|
10
|
-
* WHAT GOES ON THE WIRE: the lock and the signature. Never the words, never a secret, and
|
|
11
|
-
* not the name — the server signs-over the name of the key's own session, so a name in
|
|
12
|
-
* the body would be ignored (the request schema has no field for it, and the edge strips
|
|
13
|
-
* unknown ones). That makes the NAME a thing this command must get right on its own: it
|
|
14
|
-
* signs for `--slug` (else AGENCY_SLUG / WORKSPACE_SLUG, the way `one whoami` reads them),
|
|
15
|
-
* and every success and every refusal says which name it signed for. A key that belongs to
|
|
16
|
-
* another name comes back `bad_signature`, and the sentence says so.
|
|
17
|
-
*
|
|
18
|
-
* THE SUI KEY IS THE SAME KEY THE WALLETS USE — `recoverWallet(words, derivation)` from
|
|
19
|
-
* @oneie/sdk/wallet, the account-0 Sui key /keys derives, no second derivation. Derivation
|
|
20
|
-
* is v2 only when the key file says so (or `--derivation v2`): an unmarked key is v1
|
|
21
|
-
* forever (wallet.ts readDerivation), and the two give different Sui addresses. A wrong
|
|
22
|
-
* guess is a `wrong_signer`, and that sentence prints both addresses so the fix is a flag.
|
|
23
|
-
*
|
|
24
|
-
* WHO CAN PUBLISH — a PERSON publishes under their name with their login key (`one login`).
|
|
25
|
-
* An AGENT publishes under `<workspace>/<agent-id>` with `--agent <its id>`, authenticated by
|
|
26
|
-
* ITS OWN API key: the door takes the agent from that key and refuses a person, an owner,
|
|
27
|
-
* the service key or another agent (`not_the_agent`) however the body is worded. The Sui key
|
|
28
|
-
* that signs must be the address on the agent's wallet row (`one wallet register --kind
|
|
29
|
-
* agent` proves it); a shell row answers `no_sui_address`. `--workspace` picks which of the
|
|
30
|
-
* agent's rows (default: the agent's own id, the self-registered shape) and grants nothing.
|
|
31
|
-
* The service key sends no name at all (`unauthorized`).
|
|
32
|
-
*
|
|
33
|
-
* No prompts, no stdin: an agent runs this. Exit codes are in lib/lock-lookup.ts EXIT.
|
|
34
|
-
*/
|
|
35
|
-
import { Command } from 'commander';
|
|
36
|
-
/** Swappable in tests: the API key the ask door will be sent. */
|
|
37
|
-
export declare const auth: {
|
|
38
|
-
key: () => string;
|
|
39
|
-
};
|
|
40
|
-
export declare function keyPublishCommands(): Command[];
|
package/dist/src/key-publish.js
DELETED
|
@@ -1,232 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* key-publish.ts — `one key publish-lock | lock-of`: put a lock under a name, and read one back
|
|
3
|
-
* with the check made HERE.
|
|
4
|
-
*
|
|
5
|
-
* publish-lock derive this key's lock (same as `one key lock`), sign the text
|
|
6
|
-
* "ONE message lock v1\n<name>\n<lock>" with this key's Sui account-0
|
|
7
|
-
* key, and send {lock, signature} to `wallet:lock-publish`.
|
|
8
|
-
* lock-of GET /api/lock/<name>, rebuild the text, check the signature, print the lock.
|
|
9
|
-
*
|
|
10
|
-
* WHAT GOES ON THE WIRE: the lock and the signature. Never the words, never a secret, and
|
|
11
|
-
* not the name — the server signs-over the name of the key's own session, so a name in
|
|
12
|
-
* the body would be ignored (the request schema has no field for it, and the edge strips
|
|
13
|
-
* unknown ones). That makes the NAME a thing this command must get right on its own: it
|
|
14
|
-
* signs for `--slug` (else AGENCY_SLUG / WORKSPACE_SLUG, the way `one whoami` reads them),
|
|
15
|
-
* and every success and every refusal says which name it signed for. A key that belongs to
|
|
16
|
-
* another name comes back `bad_signature`, and the sentence says so.
|
|
17
|
-
*
|
|
18
|
-
* THE SUI KEY IS THE SAME KEY THE WALLETS USE — `recoverWallet(words, derivation)` from
|
|
19
|
-
* @oneie/sdk/wallet, the account-0 Sui key /keys derives, no second derivation. Derivation
|
|
20
|
-
* is v2 only when the key file says so (or `--derivation v2`): an unmarked key is v1
|
|
21
|
-
* forever (wallet.ts readDerivation), and the two give different Sui addresses. A wrong
|
|
22
|
-
* guess is a `wrong_signer`, and that sentence prints both addresses so the fix is a flag.
|
|
23
|
-
*
|
|
24
|
-
* WHO CAN PUBLISH — a PERSON publishes under their name with their login key (`one login`).
|
|
25
|
-
* An AGENT publishes under `<workspace>/<agent-id>` with `--agent <its id>`, authenticated by
|
|
26
|
-
* ITS OWN API key: the door takes the agent from that key and refuses a person, an owner,
|
|
27
|
-
* the service key or another agent (`not_the_agent`) however the body is worded. The Sui key
|
|
28
|
-
* that signs must be the address on the agent's wallet row (`one wallet register --kind
|
|
29
|
-
* agent` proves it); a shell row answers `no_sui_address`. `--workspace` picks which of the
|
|
30
|
-
* agent's rows (default: the agent's own id, the self-registered shape) and grants nothing.
|
|
31
|
-
* The service key sends no name at all (`unauthorized`).
|
|
32
|
-
*
|
|
33
|
-
* No prompts, no stdin: an agent runs this. Exit codes are in lib/lock-lookup.ts EXIT.
|
|
34
|
-
*/
|
|
35
|
-
import { Command } from 'commander';
|
|
36
|
-
import { readFileSync } from 'node:fs';
|
|
37
|
-
import { readDerivation, recoverWallet } from '@oneie/sdk/wallet';
|
|
38
|
-
import { mergeEnv } from './env.js';
|
|
39
|
-
import { askPath } from './lib/api-path.js';
|
|
40
|
-
import { authHeaders, jsonMode, resolveBase, resolveKey } from './lib/client.js';
|
|
41
|
-
import { exitFor, lookupLock, TRUST_LIMIT } from './lib/lock-lookup.js';
|
|
42
|
-
import { keyWords, loadMessageKey } from './lib/message-seal.js';
|
|
43
|
-
import { writeBase } from './write.js';
|
|
44
|
-
const SLUG_RE = /^[a-z0-9][a-z0-9-]{0,62}$/;
|
|
45
|
-
const AGENT_RE = /^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/;
|
|
46
|
-
const DEADLINE_MS = 15_000;
|
|
47
|
-
/** Swappable in tests: the API key the ask door will be sent. */
|
|
48
|
-
export const auth = { key: () => resolveKey({}) };
|
|
49
|
-
function refuse(cmd, f) {
|
|
50
|
-
if (jsonMode(cmd))
|
|
51
|
-
process.stdout.write(JSON.stringify(f) + '\n');
|
|
52
|
-
else
|
|
53
|
-
process.stderr.write(`error ${f.error}\n`);
|
|
54
|
-
process.exitCode = exitFor(f.code);
|
|
55
|
-
}
|
|
56
|
-
/** The derivation the Sui key is read under: --derivation, else the key file's marker, else v1. */
|
|
57
|
-
function derivationFor(flag, keyPath) {
|
|
58
|
-
let marker = flag;
|
|
59
|
-
if (flag === undefined && keyPath) {
|
|
60
|
-
try {
|
|
61
|
-
marker = JSON.parse(readFileSync(keyPath, 'utf8')).derivation;
|
|
62
|
-
}
|
|
63
|
-
catch {
|
|
64
|
-
marker = undefined; // not JSON (a bare phrase file) or unreadable — keyWords reports that one
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
try {
|
|
68
|
-
return readDerivation(marker);
|
|
69
|
-
}
|
|
70
|
-
catch {
|
|
71
|
-
return { ok: false, error: `the derivation is "v1" or "v2", not ${JSON.stringify(String(marker))}`, code: 'bad_derivation' };
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
const hexBytes = (h) => Uint8Array.from(h.match(/../g) ?? [], (b) => parseInt(b, 16));
|
|
75
|
-
/** The sentence for each way `wallet:lock-publish` can refuse. */
|
|
76
|
-
function serverRefusal(error, ctx) {
|
|
77
|
-
const who = ctx.agent === undefined ? ctx.slug : `${ctx.slug}/${ctx.agent}`;
|
|
78
|
-
const other = ctx.derivation === 'v1' ? 'v2' : 'v1';
|
|
79
|
-
switch (error) {
|
|
80
|
-
case 'unauthorized':
|
|
81
|
-
return { ok: false, code: error, error: 'you are not signed in — the key sent was refused, or the door could not tell whose it is. Sign in with `one login` (a person\'s login key; a service key names no one)' };
|
|
82
|
-
case 'no_sui_address':
|
|
83
|
-
return {
|
|
84
|
-
ok: false,
|
|
85
|
-
code: error,
|
|
86
|
-
error: ctx.agent === undefined
|
|
87
|
-
? 'your account has no Sui address on file — a person account needs a registered Sui wallet: open Wallets on one.ie once, then try again. An agent publishes with --agent <its id>'
|
|
88
|
-
: `the agent ${who} has no Sui address on file — register one with proof of control first (\`one wallet register --kind agent\`), then try again`,
|
|
89
|
-
};
|
|
90
|
-
case 'not_the_agent':
|
|
91
|
-
return { ok: false, code: error, error: `only the agent itself can publish ${who}: run this with the agent's own API key, and --agent set to that agent's id. A person, an owner or another agent is refused. Nothing was published` };
|
|
92
|
-
case 'bad_agent':
|
|
93
|
-
return { ok: false, code: error, error: `"${ctx.agent ?? ''}" is not an agent name — letters, digits, dots, dashes or underscores. Nothing was published` };
|
|
94
|
-
case 'wrong_signer':
|
|
95
|
-
return {
|
|
96
|
-
ok: false,
|
|
97
|
-
code: error,
|
|
98
|
-
error: `the key used here is not the Sui key ${ctx.agent === undefined ? 'your account' : `${who}`} has on file, so nothing was published. This key's Sui address is ${ctx.suiV1} under v1 and ${ctx.suiV2} under v2; this run signed with ${ctx.derivation}. If your account registered the other one, add --derivation ${other}`,
|
|
99
|
-
};
|
|
100
|
-
case 'bad_signature':
|
|
101
|
-
return { ok: false, code: error, error: ctx.agent === undefined ? `the signature did not check out for the name "${ctx.slug}" — nothing was published. The server signs for the name your login key belongs to; if that is not "${ctx.slug}", pass --slug <your name>` : `the signature did not check out for "${who}" — nothing was published. Check --agent and --workspace` };
|
|
102
|
-
case 'bad_lock':
|
|
103
|
-
return { ok: false, code: error, error: 'that is not a lock — it should be age1 followed by 58 characters. Nothing was published' };
|
|
104
|
-
case 'bad_slug':
|
|
105
|
-
return { ok: false, code: error, error: 'the server says your account name is not a name it can file a lock under — nothing was published' };
|
|
106
|
-
case 'db_error':
|
|
107
|
-
case 'no_db':
|
|
108
|
-
return { ok: false, code: error, error: 'the server could not save the lock right now — nothing was published; try again in a moment' };
|
|
109
|
-
default:
|
|
110
|
-
return { ok: false, code: error, error: `the server refused it (${error}) — nothing was published` };
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
export function keyPublishCommands() {
|
|
114
|
-
const publish = new Command('publish-lock')
|
|
115
|
-
.description('Publish this key\'s lock under your name, signed with its Sui key — so anyone can look it up and check it (a person account with a registered Sui address)')
|
|
116
|
-
.option('--key <file>', 'Key file made by `one key new --out` (else ONE_WALLET_MNEMONIC). Never read from stdin')
|
|
117
|
-
.option('--slug <name>', 'The name to publish under — the name your login key belongs to (else AGENCY_SLUG / WORKSPACE_SLUG)')
|
|
118
|
-
.option('--agent <id>', 'Publish an AGENT\'s own lock as <workspace>/<id>. Run it with that agent\'s own API key; a person or owner is refused')
|
|
119
|
-
.option('--workspace <name>', 'With --agent: the workspace of the agent\'s wallet row (default: the agent\'s own id, the self-registered shape)')
|
|
120
|
-
.option('--derivation <v1|v2>', 'Which Sui key: the key file\'s marker, else v1. Pass v2 for a key minted under standard paths')
|
|
121
|
-
.option('--api <url>', 'API base URL (default https://api.one.ie)')
|
|
122
|
-
.action(async (o, c) => {
|
|
123
|
-
const env = mergeEnv(process.cwd());
|
|
124
|
-
const agent = o.agent?.trim();
|
|
125
|
-
if (agent !== undefined && !AGENT_RE.test(agent))
|
|
126
|
-
return refuse(c, { ok: false, error: `"${agent}" is not an agent name — letters, digits, dots, dashes or underscores`, code: 'bad_agent' });
|
|
127
|
-
// An agent's name is its workspace (default: its own id) — the env slug is NOT read, since
|
|
128
|
-
// that is usually the person's, and a text signed for the wrong name is only refused later.
|
|
129
|
-
const slug = (agent !== undefined ? (o.workspace ?? agent) : (o.slug ?? env.AGENCY_SLUG ?? env.WORKSPACE_SLUG ?? '')).trim().toLowerCase();
|
|
130
|
-
if (!slug)
|
|
131
|
-
return refuse(c, { ok: false, error: 'which name? pass --slug <your name> — the name your login key belongs to', code: 'no_slug' });
|
|
132
|
-
if (!SLUG_RE.test(slug))
|
|
133
|
-
return refuse(c, { ok: false, error: `"${slug}" is not a name — lowercase letters, digits and dashes`, code: 'bad_slug' });
|
|
134
|
-
const derivation = derivationFor(o.derivation, o.key);
|
|
135
|
-
if (typeof derivation !== 'string')
|
|
136
|
-
return refuse(c, derivation);
|
|
137
|
-
const words = keyWords(o.key);
|
|
138
|
-
if (typeof words !== 'string')
|
|
139
|
-
return refuse(c, words);
|
|
140
|
-
if (!auth.key())
|
|
141
|
-
return refuse(c, { ok: false, error: 'no API key — run `one login`, or set ONE_API_KEY. Nothing was sent', code: 'no_api_key' });
|
|
142
|
-
// Everything secret stays in this block: the lock, then the signature, then zeroed.
|
|
143
|
-
const mk = await loadMessageKey(o.key);
|
|
144
|
-
if ('ok' in mk)
|
|
145
|
-
return refuse(c, mk);
|
|
146
|
-
const lock = mk.recipient;
|
|
147
|
-
mk.secret.fill(0);
|
|
148
|
-
let signature;
|
|
149
|
-
let signer;
|
|
150
|
-
let suiV1;
|
|
151
|
-
let suiV2;
|
|
152
|
-
try {
|
|
153
|
-
const { agentLockMessage, lockMessage, signSuiPersonalMessage } = await import('@oneie/sdk/message-lock');
|
|
154
|
-
const suiOf = async (d) => (await recoverWallet(words, d)).keys.find((k) => k.chain === 'sui');
|
|
155
|
-
const [k1, k2] = await Promise.all([suiOf('v1'), suiOf('v2')]);
|
|
156
|
-
suiV1 = k1.address;
|
|
157
|
-
suiV2 = k2.address;
|
|
158
|
-
const used = derivation === 'v2' ? k2 : k1;
|
|
159
|
-
const secret = hexBytes(used.privateKeyHex);
|
|
160
|
-
try {
|
|
161
|
-
const s = signSuiPersonalMessage(secret, agent === undefined ? lockMessage(slug, lock) : agentLockMessage(slug, agent, lock));
|
|
162
|
-
signature = s.signature;
|
|
163
|
-
signer = s.address;
|
|
164
|
-
}
|
|
165
|
-
finally {
|
|
166
|
-
secret.fill(0);
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
catch (e) {
|
|
170
|
-
return refuse(c, { ok: false, error: e.message, code: 'bad_key' });
|
|
171
|
-
}
|
|
172
|
-
const base = resolveBase({ api: o.api }, 'https://api.one.ie');
|
|
173
|
-
const ctl = new AbortController();
|
|
174
|
-
const timer = setTimeout(() => ctl.abort(), DEADLINE_MS);
|
|
175
|
-
let res;
|
|
176
|
-
try {
|
|
177
|
-
res = await fetch(askPath(base, 'wallet:lock-publish'), {
|
|
178
|
-
method: 'POST',
|
|
179
|
-
headers: authHeaders(),
|
|
180
|
-
body: JSON.stringify({ data: agent === undefined ? { lock, signature } : { lock, signature, agent, ...(slug === agent ? {} : { workspace: slug }) } }),
|
|
181
|
-
signal: ctl.signal,
|
|
182
|
-
});
|
|
183
|
-
}
|
|
184
|
-
catch {
|
|
185
|
-
return refuse(c, { ok: false, error: `could not reach ${base} — nothing was published`, code: 'unreachable' });
|
|
186
|
-
}
|
|
187
|
-
finally {
|
|
188
|
-
clearTimeout(timer);
|
|
189
|
-
}
|
|
190
|
-
let body = {};
|
|
191
|
-
try {
|
|
192
|
-
body = (await res.json());
|
|
193
|
-
}
|
|
194
|
-
catch {
|
|
195
|
-
/* judged by status below */
|
|
196
|
-
}
|
|
197
|
-
// The ask door answers 200 for refusals too: read the outcome, not just the status.
|
|
198
|
-
if (res.status === 401 || res.status === 403)
|
|
199
|
-
return refuse(c, serverRefusal('unauthorized', { slug, agent, suiV1, suiV2, derivation }));
|
|
200
|
-
if (body.outcome === 'result' && body.result) {
|
|
201
|
-
if (body.result.ok) {
|
|
202
|
-
const r = body.result;
|
|
203
|
-
const name = agent === undefined ? slug : `${slug}/${agent}`;
|
|
204
|
-
const done = { ok: true, slug, ...(agent === undefined ? {} : { agent }), name, lock, suiAddress: r.suiAddress ?? signer, publishedAt: r.publishedAt ?? null, derivation };
|
|
205
|
-
if (jsonMode(c))
|
|
206
|
-
process.stdout.write(JSON.stringify(done) + '\n');
|
|
207
|
-
else
|
|
208
|
-
process.stdout.write(`published ${lock}\n as ${name}, signed by Sui address ${done.suiAddress} (${derivation})\n anyone can check it: one key lock-of ${name}\n`);
|
|
209
|
-
return;
|
|
210
|
-
}
|
|
211
|
-
return refuse(c, serverRefusal(String(body.result.error ?? 'failed'), { slug, agent, suiV1, suiV2, derivation }));
|
|
212
|
-
}
|
|
213
|
-
return refuse(c, { ok: false, error: `the server did not complete it (${body.outcome ?? `HTTP ${res.status}`}) — nothing was published`, code: 'failed' });
|
|
214
|
-
});
|
|
215
|
-
const lockOf = new Command('lock-of')
|
|
216
|
-
.description('Look up the lock a name has published and CHECK it here — prints the lock. Refuses if it is unpublished, unreachable, or does not verify')
|
|
217
|
-
.argument('<slug>', "The holder's name, or <workspace>/<agent-id> for an agent's own lock")
|
|
218
|
-
.option('--api <url>', 'Web base (default https://one.ie; the lookup is a web route, not on the gateway)')
|
|
219
|
-
.action(async (slugArg, o, c) => {
|
|
220
|
-
const r = await lookupLock(writeBase(o.api), slugArg.trim());
|
|
221
|
-
if (!r.ok)
|
|
222
|
-
return refuse(c, r);
|
|
223
|
-
if (jsonMode(c)) {
|
|
224
|
-
process.stdout.write(JSON.stringify({ ok: true, slug: r.slug, ...(r.agent === undefined ? {} : { agent: r.agent }), name: r.name, lock: r.lock, suiAddress: r.suiAddress, publishedAt: r.publishedAt, verified: true, trustLimit: TRUST_LIMIT }) + '\n');
|
|
225
|
-
}
|
|
226
|
-
else {
|
|
227
|
-
process.stdout.write(r.lock + '\n');
|
|
228
|
-
process.stderr.write(`checked signed by Sui address ${r.suiAddress}; ${TRUST_LIMIT}\n`);
|
|
229
|
-
}
|
|
230
|
-
});
|
|
231
|
-
return [publish, lockOf];
|
|
232
|
-
}
|
package/dist/src/key-seal.d.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* key-seal.ts — `one key lock | seal | open | identity`: sealed notes without ONE's web page.
|
|
3
|
-
*
|
|
4
|
-
* Every command here is offline — no network — and none prompts, because an agent runs
|
|
5
|
-
* them. The key is a key file (`--key`, what `one key new --out` writes) or
|
|
6
|
-
* ONE_WALLET_MNEMONIC; the note is a file argument or stdin. Each answers `--json` and
|
|
7
|
-
* sets the exit code: 0 done, 1 refused (with a plain sentence, and a `code` under --json).
|
|
8
|
-
*
|
|
9
|
-
* lock the `age1…` lock for this key — what anyone seals a note to
|
|
10
|
-
* seal a note → an armored age block, for one or more `age1…` locks
|
|
11
|
-
* open an age block → the note, with this key
|
|
12
|
-
* identity the `AGE-SECRET-KEY-1…` line, so the stock `age -d -i` opens a note with
|
|
13
|
-
* no ONE code on the machine
|
|
14
|
-
*
|
|
15
|
-
* `identity` is the one verb that prints a secret to stdout, on purpose: the spec for
|
|
16
|
-
* this door is "age -d works with nothing else installed". A stderr warning always
|
|
17
|
-
* says so; under --json the warning is a field. Everything else in `one key` keeps its
|
|
18
|
-
* posture of never printing key material.
|
|
19
|
-
*/
|
|
20
|
-
import { Command } from 'commander';
|
|
21
|
-
export declare function keySealCommands(): Command[];
|
package/dist/src/key-seal.js
DELETED
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* key-seal.ts — `one key lock | seal | open | identity`: sealed notes without ONE's web page.
|
|
3
|
-
*
|
|
4
|
-
* Every command here is offline — no network — and none prompts, because an agent runs
|
|
5
|
-
* them. The key is a key file (`--key`, what `one key new --out` writes) or
|
|
6
|
-
* ONE_WALLET_MNEMONIC; the note is a file argument or stdin. Each answers `--json` and
|
|
7
|
-
* sets the exit code: 0 done, 1 refused (with a plain sentence, and a `code` under --json).
|
|
8
|
-
*
|
|
9
|
-
* lock the `age1…` lock for this key — what anyone seals a note to
|
|
10
|
-
* seal a note → an armored age block, for one or more `age1…` locks
|
|
11
|
-
* open an age block → the note, with this key
|
|
12
|
-
* identity the `AGE-SECRET-KEY-1…` line, so the stock `age -d -i` opens a note with
|
|
13
|
-
* no ONE code on the machine
|
|
14
|
-
*
|
|
15
|
-
* `identity` is the one verb that prints a secret to stdout, on purpose: the spec for
|
|
16
|
-
* this door is "age -d works with nothing else installed". A stderr warning always
|
|
17
|
-
* says so; under --json the warning is a field. Everything else in `one key` keeps its
|
|
18
|
-
* posture of never printing key material.
|
|
19
|
-
*/
|
|
20
|
-
import { Command } from 'commander';
|
|
21
|
-
import { jsonMode } from './lib/client.js';
|
|
22
|
-
import { ageFailure, ageModule, loadMessageKey, readNote, } from './lib/message-seal.js';
|
|
23
|
-
function fail(cmd, f) {
|
|
24
|
-
if (jsonMode(cmd))
|
|
25
|
-
process.stdout.write(JSON.stringify(f) + '\n');
|
|
26
|
-
else
|
|
27
|
-
process.stderr.write(`error ${f.error}\n`);
|
|
28
|
-
process.exitCode = 1;
|
|
29
|
-
}
|
|
30
|
-
const collect = (v, prev = []) => [...prev, v];
|
|
31
|
-
/** Utf-8 text when the bytes are valid utf-8, base64 when they are not (a binary note). */
|
|
32
|
-
function textOrBase64(bytes) {
|
|
33
|
-
try {
|
|
34
|
-
return { text: new TextDecoder('utf-8', { fatal: true }).decode(bytes) };
|
|
35
|
-
}
|
|
36
|
-
catch {
|
|
37
|
-
return { base64: Buffer.from(bytes).toString('base64') };
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
const KEY_OPT = '--key <file>';
|
|
41
|
-
const KEY_HELP = 'Key file made by `one key new --out` (else ONE_WALLET_MNEMONIC). Never read from stdin';
|
|
42
|
-
export function keySealCommands() {
|
|
43
|
-
const lock = new Command('lock')
|
|
44
|
-
.description('Print the age1… lock for this key — give it to anyone who should be able to seal you a note')
|
|
45
|
-
.option(KEY_OPT, KEY_HELP)
|
|
46
|
-
.action(async (o, c) => {
|
|
47
|
-
const k = await loadMessageKey(o.key);
|
|
48
|
-
if ('ok' in k)
|
|
49
|
-
return fail(c, k);
|
|
50
|
-
const recipient = k.recipient;
|
|
51
|
-
k.secret.fill(0);
|
|
52
|
-
if (jsonMode(c))
|
|
53
|
-
process.stdout.write(JSON.stringify({ ok: true, lock: recipient }) + '\n');
|
|
54
|
-
else
|
|
55
|
-
process.stdout.write(recipient + '\n');
|
|
56
|
-
});
|
|
57
|
-
const seal = new Command('seal')
|
|
58
|
-
.description('Seal a note (file or stdin) to one or more age1… locks — prints an armored age block')
|
|
59
|
-
.argument('[file]', 'The note to seal; omit or "-" to read stdin')
|
|
60
|
-
.option('--to <lock>', 'An age1… lock to seal to (repeat for several)', collect)
|
|
61
|
-
.option('--self', 'Also seal to this key, so you can reopen what you sent (needs --key or ONE_WALLET_MNEMONIC)')
|
|
62
|
-
.option(KEY_OPT, KEY_HELP)
|
|
63
|
-
.action(async (file, o, c) => {
|
|
64
|
-
const locks = [...(o.to ?? [])];
|
|
65
|
-
if (o.self) {
|
|
66
|
-
const k = await loadMessageKey(o.key);
|
|
67
|
-
if ('ok' in k)
|
|
68
|
-
return fail(c, k);
|
|
69
|
-
k.secret.fill(0);
|
|
70
|
-
locks.push(k.recipient);
|
|
71
|
-
}
|
|
72
|
-
if (locks.length === 0)
|
|
73
|
-
return fail(c, { ok: false, error: 'seal it to someone — pass --to age1… (or --self)', code: 'no_recipient' });
|
|
74
|
-
const age = await ageModule();
|
|
75
|
-
for (const l of locks) {
|
|
76
|
-
try {
|
|
77
|
-
age.decodeRecipient(l);
|
|
78
|
-
}
|
|
79
|
-
catch {
|
|
80
|
-
return fail(c, { ok: false, error: `${l} is not an age lock — it starts age1…`, code: 'bad_key' });
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
const note = await readNote(file);
|
|
84
|
-
if ('ok' in note)
|
|
85
|
-
return fail(c, note);
|
|
86
|
-
const unique = [...new Set(locks.map((l) => l.trim()))];
|
|
87
|
-
const sealed = age.armor(age.encrypt(note, unique));
|
|
88
|
-
if (jsonMode(c))
|
|
89
|
-
process.stdout.write(JSON.stringify({ ok: true, sealed, recipients: unique.length }) + '\n');
|
|
90
|
-
else
|
|
91
|
-
process.stdout.write(sealed);
|
|
92
|
-
});
|
|
93
|
-
const open = new Command('open')
|
|
94
|
-
.description('Open a sealed note (file or stdin) with this key — prints the note')
|
|
95
|
-
.argument('[file]', 'The armored age block; omit or "-" to read stdin')
|
|
96
|
-
.option(KEY_OPT, KEY_HELP)
|
|
97
|
-
.action(async (file, o, c) => {
|
|
98
|
-
const k = await loadMessageKey(o.key);
|
|
99
|
-
if ('ok' in k)
|
|
100
|
-
return fail(c, k);
|
|
101
|
-
const note = await readNote(file);
|
|
102
|
-
if ('ok' in note) {
|
|
103
|
-
k.secret.fill(0);
|
|
104
|
-
return fail(c, note);
|
|
105
|
-
}
|
|
106
|
-
const age = await ageModule();
|
|
107
|
-
try {
|
|
108
|
-
// Armored anywhere in the bytes (a quoted email) or a raw binary age file.
|
|
109
|
-
const asText = new TextDecoder().decode(note.subarray(0, Math.min(note.length, 1 << 20)));
|
|
110
|
-
const bytes = asText.includes(age.AGE_ARMOR_BEGIN) ? age.dearmor(new TextDecoder().decode(note)) : note;
|
|
111
|
-
const plain = age.decrypt(bytes, [k.secret]);
|
|
112
|
-
if (jsonMode(c))
|
|
113
|
-
process.stdout.write(JSON.stringify({ ok: true, ...textOrBase64(plain) }) + '\n');
|
|
114
|
-
else
|
|
115
|
-
process.stdout.write(plain);
|
|
116
|
-
}
|
|
117
|
-
catch (e) {
|
|
118
|
-
fail(c, ageFailure(e));
|
|
119
|
-
}
|
|
120
|
-
finally {
|
|
121
|
-
k.secret.fill(0);
|
|
122
|
-
}
|
|
123
|
-
});
|
|
124
|
-
const identity = new Command('identity')
|
|
125
|
-
.description('Print the AGE-SECRET-KEY-1… line so `age -d -i` opens your notes with no ONE code. A SECRET — warns on stderr')
|
|
126
|
-
.option(KEY_OPT, KEY_HELP)
|
|
127
|
-
.action(async (o, c) => {
|
|
128
|
-
const k = await loadMessageKey(o.key);
|
|
129
|
-
if ('ok' in k)
|
|
130
|
-
return fail(c, k);
|
|
131
|
-
const age = await ageModule();
|
|
132
|
-
const line = age.encodeIdentity(k.secret);
|
|
133
|
-
k.secret.fill(0);
|
|
134
|
-
const warning = 'this line opens every note sealed to your lock — keep it out of logs, chat and shell history';
|
|
135
|
-
process.stderr.write(`warning ${warning}\n`);
|
|
136
|
-
if (jsonMode(c))
|
|
137
|
-
process.stdout.write(JSON.stringify({ ok: true, identity: line, warning }) + '\n');
|
|
138
|
-
else
|
|
139
|
-
process.stdout.write(line + '\n');
|
|
140
|
-
});
|
|
141
|
-
return [lock, seal, open, identity];
|
|
142
|
-
}
|
package/dist/src/key-sweep.d.ts
DELETED
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* key-sweep.ts — `one key sweep-rule | sweep | sweep-run`, the terminal halves of
|
|
3
|
-
* text/key.md deliverable 8 under Tony's ruling (2026-10-06): "the sweep is
|
|
4
|
-
* signed by the human who owns the agent; agents can be claimed by any owner."
|
|
5
|
-
*
|
|
6
|
-
* sweep-rule OWNER. Proves the owner's address (a signature over a fresh
|
|
7
|
-
* wallet:challenge) and sets the agent's threshold + float.
|
|
8
|
-
* sweep OWNER. Reads what is due, signs an ORDER with the owner's
|
|
9
|
-
* address key, and submits it to wallet:sweep, which records it.
|
|
10
|
-
* sweep-run AGENT. Reads its open orders, re-verifies each locally, performs
|
|
11
|
-
* the transfer with the agent's own key and settles it
|
|
12
|
-
* (@oneie/sdk/sweep-runner). Sui only; other chains are refused by
|
|
13
|
-
* name, because no signer for them exists here.
|
|
14
|
-
*
|
|
15
|
-
* KEYS come from the folder's sealed vault (`.one/wallet.json`) through
|
|
16
|
-
* wallet.ts `unlock` — Keychain or a passphrase typed at a terminal, never argv,
|
|
17
|
-
* env or a pipe. Nothing here prints, logs or sends a private key or the words:
|
|
18
|
-
* only addresses, signatures and the public order cross the wire, and every
|
|
19
|
-
* receipt is built field by field.
|
|
20
|
-
*
|
|
21
|
-
* THE NEW SDK MODULES LOAD LAZILY. key.ts registers these commands, so a static
|
|
22
|
-
* import of `@oneie/sdk/sweep-runner` would make every `one key` verb — `key new`
|
|
23
|
-
* included — crash on an installed SDK that predates that export. Only the three
|
|
24
|
-
* sweep actions reach for it, at the moment they run.
|
|
25
|
-
*/
|
|
26
|
-
import { Command } from 'commander';
|
|
27
|
-
import type { SweepOrderChain } from '@oneie/sdk/sweep-order';
|
|
28
|
-
import type { SweepAsk, SweepTransfer } from '@oneie/sdk/sweep-runner';
|
|
29
|
-
import { type SuiSendDone, type SuiSendReq } from './lib/sui-grpc-send.js';
|
|
30
|
-
import { type Net } from './lib/wallet-money.js';
|
|
31
|
-
/** The order lives 10 minutes: inside the server's 15-minute cap, with room for the agent's 2-minute floor. */
|
|
32
|
-
export declare const ORDER_LIFETIME_MS: number;
|
|
33
|
-
type VaultKey = {
|
|
34
|
-
chain: string;
|
|
35
|
-
address: string;
|
|
36
|
-
privateKeyHex: string;
|
|
37
|
-
};
|
|
38
|
-
export interface SweepDeps {
|
|
39
|
-
ask: SweepAsk;
|
|
40
|
-
/** The folder's vault, opened for this one act. */
|
|
41
|
-
unlock: () => Promise<{
|
|
42
|
-
keys: VaultKey[];
|
|
43
|
-
} | {
|
|
44
|
-
error: string;
|
|
45
|
-
}>;
|
|
46
|
-
/** The agent's balance in base units, read from the chain; null = could not read. */
|
|
47
|
-
readBalance?: (address: string) => Promise<string | null>;
|
|
48
|
-
now?: () => number;
|
|
49
|
-
}
|
|
50
|
-
/** One receiver call through the ask door; answers the receiver's own result. */
|
|
51
|
-
export declare function askVia(base: string, fetchImpl?: typeof fetch): SweepAsk;
|
|
52
|
-
/**
|
|
53
|
-
* Sui balance in mist over gRPC — Sui JSON-RPC is switched off on every public fullnode.
|
|
54
|
-
* `core.getBalance` answers `balance.balance` (coin + address balance), already base units.
|
|
55
|
-
* `rpc` overrides the gRPC base URL; the default is Mysten's public fullnode for `net`.
|
|
56
|
-
*/
|
|
57
|
-
export declare function suiBalanceReader(opts: {
|
|
58
|
-
net: Net;
|
|
59
|
-
rpc?: string;
|
|
60
|
-
}, load?: (spec: string) => Promise<Record<string, unknown>>, deadlineMs?: number): (address: string) => Promise<string | null>;
|
|
61
|
-
/** The sweep's Sui signer over gRPC: one SUI transfer through suiSendGrpc; resolves to the digest. */
|
|
62
|
-
export declare function suiTransferGrpc(opts: {
|
|
63
|
-
net: Net;
|
|
64
|
-
rpc?: string;
|
|
65
|
-
}, send?: (r: SuiSendReq) => Promise<SuiSendDone>): SweepTransfer;
|
|
66
|
-
/** --network wins; else an --rpc URL that names mainnet or testnet; else null. */
|
|
67
|
-
export declare function sweepNet(network?: string, rpc?: string): Net | null;
|
|
68
|
-
export declare function ownerSweepRule(args: {
|
|
69
|
-
agent: string;
|
|
70
|
-
workspace: string;
|
|
71
|
-
chain: SweepOrderChain;
|
|
72
|
-
threshold: string;
|
|
73
|
-
float: string;
|
|
74
|
-
}, deps: SweepDeps): Promise<Record<string, unknown>>;
|
|
75
|
-
export declare function ownerSweep(args: {
|
|
76
|
-
agent: string;
|
|
77
|
-
workspace: string;
|
|
78
|
-
chain: SweepOrderChain;
|
|
79
|
-
amount?: string;
|
|
80
|
-
balance?: string;
|
|
81
|
-
}, deps: SweepDeps): Promise<Record<string, unknown>>;
|
|
82
|
-
export declare function agentSweepRun(args: {
|
|
83
|
-
agent: string;
|
|
84
|
-
workspace: string;
|
|
85
|
-
chain: SweepOrderChain;
|
|
86
|
-
rpc?: string;
|
|
87
|
-
network?: Net;
|
|
88
|
-
ownerAddress?: string;
|
|
89
|
-
}, deps: SweepDeps & {
|
|
90
|
-
transfer?: Partial<Record<SweepOrderChain, SweepTransfer>>;
|
|
91
|
-
}): Promise<Record<string, unknown>>;
|
|
92
|
-
export declare function keySweepCommands(): Command[];
|
|
93
|
-
export {};
|