oneie 5.8.0 → 5.9.0
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 +114 -6
- package/dist/package.json +37 -11
- package/dist/src/age-1k8hs4ec.js +1 -0
- package/dist/src/client-n6fpnd9f.js +1 -0
- package/dist/src/evm-tx-cqhm9rtt.js +1 -0
- package/dist/src/hl-run-0pv1e0p2.js +1 -0
- package/dist/src/index-f5vhzspa.js +12 -0
- package/dist/src/index-h3nrt8bx.js +4 -0
- package/dist/src/index-st6k9vhc.js +2062 -0
- package/dist/src/index.js +1122 -134
- package/dist/src/message-key-yczrxszr.js +1 -0
- package/dist/src/message-lock-thr851d5.js +5 -0
- package/dist/src/sweep-order-jrq2hkye.js +1 -0
- package/dist/src/sweep-runner-jftw9em7.js +1 -0
- package/package.json +37 -11
- 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,25 +0,0 @@
|
|
|
1
|
-
export declare function usd(credits: number | undefined): string | null;
|
|
2
|
-
interface Usage {
|
|
3
|
-
model?: string;
|
|
4
|
-
tokensIn?: number;
|
|
5
|
-
tokensOut?: number;
|
|
6
|
-
costCredits?: number;
|
|
7
|
-
unmetered?: true;
|
|
8
|
-
}
|
|
9
|
-
interface Frontier {
|
|
10
|
-
model?: string;
|
|
11
|
-
usd?: number;
|
|
12
|
-
}
|
|
13
|
-
interface Reply {
|
|
14
|
-
text?: string;
|
|
15
|
-
model?: string;
|
|
16
|
-
picked?: string;
|
|
17
|
-
shape?: string;
|
|
18
|
-
reason?: string;
|
|
19
|
-
usage?: Usage;
|
|
20
|
-
frontier?: Frontier;
|
|
21
|
-
}
|
|
22
|
-
export declare function renderReceipt(reply: Reply, opts?: {
|
|
23
|
-
slug?: string;
|
|
24
|
-
}): string;
|
|
25
|
-
export {};
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
/* Message receipt — no imports */
|
|
2
|
-
// Up to 6 significant digits, never scientific: a measured $0.00000042 never prints as $0.
|
|
3
|
-
function formatDollar(n) {
|
|
4
|
-
return n.toLocaleString('en-US', { maximumSignificantDigits: 6, useGrouping: false });
|
|
5
|
-
}
|
|
6
|
-
export function usd(credits) {
|
|
7
|
-
if (typeof credits !== 'number' || !isFinite(credits) || credits < 0) {
|
|
8
|
-
return null;
|
|
9
|
-
}
|
|
10
|
-
const dollars = credits / 1000;
|
|
11
|
-
// A positive figure below what a float can divide down to is still not $0.
|
|
12
|
-
if (credits > 0 && !(dollars > 0))
|
|
13
|
-
return 'under $0.000001';
|
|
14
|
-
return '$' + formatDollar(dollars);
|
|
15
|
-
}
|
|
16
|
-
export function renderReceipt(reply, opts = {}) {
|
|
17
|
-
const model = reply.model ?? reply.usage?.model ?? 'unmeasured';
|
|
18
|
-
const reason = reply.reason === 'cold'
|
|
19
|
-
? 'cold'
|
|
20
|
-
: reply.reason
|
|
21
|
-
? 'warmed'
|
|
22
|
-
: 'unmeasured';
|
|
23
|
-
const shape = reply.shape ?? 'unmeasured';
|
|
24
|
-
// tokens line
|
|
25
|
-
const tokensLine = reply.usage &&
|
|
26
|
-
typeof reply.usage.tokensIn === 'number' &&
|
|
27
|
-
typeof reply.usage.tokensOut === 'number'
|
|
28
|
-
? `${reply.usage.tokensIn} in / ${reply.usage.tokensOut} out`
|
|
29
|
-
: 'unmeasured';
|
|
30
|
-
// cost line
|
|
31
|
-
let costLine;
|
|
32
|
-
if (!reply.usage ||
|
|
33
|
-
reply.usage.unmetered ||
|
|
34
|
-
typeof reply.usage.costCredits !== 'number') {
|
|
35
|
-
costLine = 'unmeasured';
|
|
36
|
-
}
|
|
37
|
-
else {
|
|
38
|
-
const usdStr = usd(reply.usage.costCredits);
|
|
39
|
-
if (usdStr === null) {
|
|
40
|
-
costLine = 'unmeasured';
|
|
41
|
-
}
|
|
42
|
-
else {
|
|
43
|
-
costLine = `${usdStr} est. (measured tokens × registry price)`;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
// billed line
|
|
47
|
-
const slug = opts.slug ?? '<your-group>';
|
|
48
|
-
const billedLine = `billed pending → https://one.ie/u/${slug}/stream`;
|
|
49
|
-
// frontier line
|
|
50
|
-
let frontierLine;
|
|
51
|
-
if (reply.frontier &&
|
|
52
|
-
typeof reply.frontier.usd === 'number' &&
|
|
53
|
-
isFinite(reply.frontier.usd) &&
|
|
54
|
-
reply.frontier.usd > 0) {
|
|
55
|
-
const frontierDollar = reply.frontier.usd;
|
|
56
|
-
const frontierUsdStr = '$' + formatDollar(frontierDollar);
|
|
57
|
-
frontierLine = `at ${reply.frontier.model ?? 'model'} list price: ${frontierUsdStr}`;
|
|
58
|
-
}
|
|
59
|
-
else {
|
|
60
|
-
frontierLine = 'at frontier list price: unmeasured';
|
|
61
|
-
}
|
|
62
|
-
const dashLine = '\u2014'.repeat(3); // three em dashes
|
|
63
|
-
const lines = [
|
|
64
|
-
`model ${model} \u00b7 ${reason} (shape ${shape})`,
|
|
65
|
-
`tokens ${tokensLine}`,
|
|
66
|
-
`cost ${costLine}`,
|
|
67
|
-
billedLine,
|
|
68
|
-
frontierLine,
|
|
69
|
-
];
|
|
70
|
-
return dashLine + '\n' + lines.join('\n');
|
|
71
|
-
}
|
package/dist/src/message.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export declare const MESSAGE_TIMEOUT_MS = 30000;
|
|
2
|
-
export declare const SIGN_IN = "not signed in \u2014 run: npx oneie login";
|
|
3
|
-
export interface MessageIO {
|
|
4
|
-
fetch: typeof fetch;
|
|
5
|
-
key: string;
|
|
6
|
-
base: string;
|
|
7
|
-
stdout: (s: string) => void;
|
|
8
|
-
stderr: (s: string) => void;
|
|
9
|
-
}
|
|
10
|
-
export declare function sendMessage(text: string, io: MessageIO, opts?: {
|
|
11
|
-
json?: boolean;
|
|
12
|
-
}): Promise<number>;
|
|
13
|
-
export declare function bareMessageArgv(argv: string[], known: ReadonlySet<string>): string[];
|
package/dist/src/message.js
DELETED
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import { askPath } from './lib/api-path.js';
|
|
2
|
-
import { renderReceipt } from './message-receipt.js';
|
|
3
|
-
export const MESSAGE_TIMEOUT_MS = 30000;
|
|
4
|
-
export const SIGN_IN = 'not signed in — run: npx oneie login';
|
|
5
|
-
export async function sendMessage(text, io, opts = {}) {
|
|
6
|
-
const trimmed = text.trim();
|
|
7
|
-
if (!trimmed) {
|
|
8
|
-
io.stderr('usage: oneie message <text...>');
|
|
9
|
-
return 2;
|
|
10
|
-
}
|
|
11
|
-
if (!io.key) {
|
|
12
|
-
io.stderr(SIGN_IN);
|
|
13
|
-
return 1;
|
|
14
|
-
}
|
|
15
|
-
const url = askPath(io.base, 'world:route');
|
|
16
|
-
let response;
|
|
17
|
-
try {
|
|
18
|
-
response = await io.fetch(url, {
|
|
19
|
-
method: 'POST',
|
|
20
|
-
headers: {
|
|
21
|
-
'Content-Type': 'application/json',
|
|
22
|
-
Authorization: 'Bearer ' + io.key,
|
|
23
|
-
},
|
|
24
|
-
body: JSON.stringify({
|
|
25
|
-
data: { text: trimmed, reply: true, deliver: false },
|
|
26
|
-
timeoutMs: MESSAGE_TIMEOUT_MS,
|
|
27
|
-
}),
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
catch (err) {
|
|
31
|
-
io.stderr(`could not reach ${io.base}: ${err instanceof Error ? err.message : String(err)}`);
|
|
32
|
-
return 1;
|
|
33
|
-
}
|
|
34
|
-
// Check HTTP 401/403 FIRST before parsing body
|
|
35
|
-
if (response.status === 401 || response.status === 403) {
|
|
36
|
-
io.stderr(SIGN_IN);
|
|
37
|
-
return 1;
|
|
38
|
-
}
|
|
39
|
-
let body;
|
|
40
|
-
try {
|
|
41
|
-
body = await response.json();
|
|
42
|
-
}
|
|
43
|
-
catch {
|
|
44
|
-
body = {};
|
|
45
|
-
}
|
|
46
|
-
// Treat null or non-object body as failure
|
|
47
|
-
if (body === null || typeof body !== 'object' || Array.isArray(body)) {
|
|
48
|
-
io.stderr('no answer');
|
|
49
|
-
return 1;
|
|
50
|
-
}
|
|
51
|
-
// Body-level forbidden/unauthor check (redundant for 401/403 but catches 200 with forbidden)
|
|
52
|
-
const isForbidden = (body.error &&
|
|
53
|
-
(typeof body.error === 'string'
|
|
54
|
-
? /forbidden|unauthor/i.test(body.error)
|
|
55
|
-
: /forbidden|unauthor/i.test(body.error.message || ''))) ||
|
|
56
|
-
(body.result?.error &&
|
|
57
|
-
/forbidden|unauthor/i.test(typeof body.result.error === 'string'
|
|
58
|
-
? body.result.error
|
|
59
|
-
: body.result.error.message || ''));
|
|
60
|
-
if (isForbidden) {
|
|
61
|
-
io.stderr(SIGN_IN);
|
|
62
|
-
return 1;
|
|
63
|
-
}
|
|
64
|
-
if (body.outcome === 'timeout') {
|
|
65
|
-
io.stderr('no answer within 30s — the reply is still running; see https://one.ie/u/<you>/stream');
|
|
66
|
-
return 1;
|
|
67
|
-
}
|
|
68
|
-
const reply = body.result?.reply;
|
|
69
|
-
if (opts.json) {
|
|
70
|
-
const output = JSON.stringify(reply ?? body.result ?? body, null, 2) + '\n';
|
|
71
|
-
io.stdout(output);
|
|
72
|
-
return reply?.text ? 0 : 1;
|
|
73
|
-
}
|
|
74
|
-
const answer = reply?.text;
|
|
75
|
-
if (!answer) {
|
|
76
|
-
const replyError = reply?.error;
|
|
77
|
-
const resultError = body.result?.error;
|
|
78
|
-
const bodyError = body.error;
|
|
79
|
-
const errMsg = replyError || resultError || bodyError || '';
|
|
80
|
-
io.stderr(errMsg ? `no answer: ${errMsg}` : 'no answer');
|
|
81
|
-
return 1;
|
|
82
|
-
}
|
|
83
|
-
io.stdout(answer + '\n');
|
|
84
|
-
io.stdout(renderReceipt(reply) + '\n');
|
|
85
|
-
return 0;
|
|
86
|
-
}
|
|
87
|
-
export function bareMessageArgv(argv, known) {
|
|
88
|
-
if (argv[2] !== undefined && !argv[2].startsWith('-') && !known.has(argv[2])) {
|
|
89
|
-
return [argv[0], argv[1], 'message', ...argv.slice(2)];
|
|
90
|
-
}
|
|
91
|
-
return argv;
|
|
92
|
-
}
|
package/dist/src/move.d.ts
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* move.ts — `one move publish <package dir>`: publish a Move package from a THROWAWAY deployer
|
|
3
|
-
* and hand everything it made to its owner, so no key that ever touched the publish keeps power.
|
|
4
|
-
*
|
|
5
|
-
* 1. build `sui move build --dump-bytecode-as-base64 -e <net>` in a temp copy (the repo's
|
|
6
|
-
* Move.lock and build/ are never written).
|
|
7
|
-
* 2. mint a fresh deployer key, in memory. It is kept, 0600, under ~/.one/deployers/ only so
|
|
8
|
-
* a crash between steps can still return the dust; it never prints and owns nothing
|
|
9
|
-
* once the run ends.
|
|
10
|
-
* 3. fund `--fund` SUI from the sealed vault in `--fund-dir` to the deployer.
|
|
11
|
-
* 4. publish one transaction: publish, and the UpgradeCap to `--owner` in the same PTB.
|
|
12
|
-
* 5. hand on one transaction from the deployer: every object `init` gave it goes to `--owner`
|
|
13
|
-
* (a `::WorkerCap` to `--worker-cap-to` when named), and the whole gas coin goes
|
|
14
|
-
* back to the funder.
|
|
15
|
-
* 6. read every created object is read back from the chain; the run is ok only if the
|
|
16
|
-
* UpgradeCap and every handed-on object sit with the address they were sent to and
|
|
17
|
-
* the deployer holds nothing.
|
|
18
|
-
*
|
|
19
|
-
* Dry by default: without --live it builds, prints the plan, and signs nothing. Only addresses,
|
|
20
|
-
* object ids and digests are printed. Every Sui act goes through suiExecGrpc, the CLI's one signer.
|
|
21
|
-
*/
|
|
22
|
-
import { Command } from 'commander';
|
|
23
|
-
import { type SuiCreated } from './lib/sui-grpc-send.js';
|
|
24
|
-
import { type Net } from './lib/wallet-money.js';
|
|
25
|
-
export interface MoveBytecode {
|
|
26
|
-
modules: string[];
|
|
27
|
-
dependencies: string[];
|
|
28
|
-
digest: number[];
|
|
29
|
-
}
|
|
30
|
-
/** Compile in a temp copy so the repo's Move.lock and build/ stay untouched. */
|
|
31
|
-
export declare function buildBytecode(dir: string, net: Net): MoveBytecode;
|
|
32
|
-
/** Where each object the deployer was given goes: a WorkerCap to its worker, everything else to the owner. */
|
|
33
|
-
export declare function handOnPlan(created: SuiCreated[], deployer: string, owner: string, workerCapTo?: string): Array<SuiCreated & {
|
|
34
|
-
to: string;
|
|
35
|
-
}>;
|
|
36
|
-
export declare function moveCmd(): Command;
|
package/dist/src/move.js
DELETED
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* move.ts — `one move publish <package dir>`: publish a Move package from a THROWAWAY deployer
|
|
3
|
-
* and hand everything it made to its owner, so no key that ever touched the publish keeps power.
|
|
4
|
-
*
|
|
5
|
-
* 1. build `sui move build --dump-bytecode-as-base64 -e <net>` in a temp copy (the repo's
|
|
6
|
-
* Move.lock and build/ are never written).
|
|
7
|
-
* 2. mint a fresh deployer key, in memory. It is kept, 0600, under ~/.one/deployers/ only so
|
|
8
|
-
* a crash between steps can still return the dust; it never prints and owns nothing
|
|
9
|
-
* once the run ends.
|
|
10
|
-
* 3. fund `--fund` SUI from the sealed vault in `--fund-dir` to the deployer.
|
|
11
|
-
* 4. publish one transaction: publish, and the UpgradeCap to `--owner` in the same PTB.
|
|
12
|
-
* 5. hand on one transaction from the deployer: every object `init` gave it goes to `--owner`
|
|
13
|
-
* (a `::WorkerCap` to `--worker-cap-to` when named), and the whole gas coin goes
|
|
14
|
-
* back to the funder.
|
|
15
|
-
* 6. read every created object is read back from the chain; the run is ok only if the
|
|
16
|
-
* UpgradeCap and every handed-on object sit with the address they were sent to and
|
|
17
|
-
* the deployer holds nothing.
|
|
18
|
-
*
|
|
19
|
-
* Dry by default: without --live it builds, prints the plan, and signs nothing. Only addresses,
|
|
20
|
-
* object ids and digests are printed. Every Sui act goes through suiExecGrpc, the CLI's one signer.
|
|
21
|
-
*/
|
|
22
|
-
import { Command } from 'commander';
|
|
23
|
-
import { spawnSync } from 'node:child_process';
|
|
24
|
-
import { randomBytes } from 'node:crypto';
|
|
25
|
-
import { cpSync, mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs';
|
|
26
|
-
import { homedir, tmpdir } from 'node:os';
|
|
27
|
-
import { basename, join, resolve } from 'node:path';
|
|
28
|
-
import { out } from './lib/client.js';
|
|
29
|
-
import { SuiSendError, loadSpec, mistToSui, suiExecGrpc, suiReadObjects, suiSendGrpc } from './lib/sui-grpc-send.js';
|
|
30
|
-
import { SUI_NATIVE } from './lib/wallet-money.js';
|
|
31
|
-
import { unlock } from './wallet.js';
|
|
32
|
-
import { netLine, resolveNet } from './lib/net-choice.js';
|
|
33
|
-
const SUI_ADDR = /^0x[0-9a-f]{64}$/i;
|
|
34
|
-
/** Compile in a temp copy so the repo's Move.lock and build/ stay untouched. */
|
|
35
|
-
export function buildBytecode(dir, net) {
|
|
36
|
-
const work = mkdtempSync(join(tmpdir(), 'one-move-'));
|
|
37
|
-
try {
|
|
38
|
-
const copy = join(work, basename(resolve(dir)));
|
|
39
|
-
cpSync(resolve(dir), copy, { recursive: true, filter: (p) => !p.includes(`${'/'}build${'/'}`) && !p.endsWith('/build') });
|
|
40
|
-
const r = spawnSync('sui', ['move', 'build', '--dump-bytecode-as-base64', '-e', net, '--path', copy], { encoding: 'utf8', maxBuffer: 64 * 1024 * 1024 });
|
|
41
|
-
if (r.error)
|
|
42
|
-
throw new SuiSendError('sui_cli_missing', 'the `sui` CLI is not on PATH (brew install sui)');
|
|
43
|
-
const line = (r.stdout ?? '').split('\n').reverse().find((l) => l.trim().startsWith('{"modules"'));
|
|
44
|
-
if (r.status !== 0 || !line)
|
|
45
|
-
throw new SuiSendError('move_build_failed', ((r.stderr ?? '') + (r.stdout ?? '')).trim().split('\n').slice(-3).join(' | ') || 'no bytecode');
|
|
46
|
-
return JSON.parse(line);
|
|
47
|
-
}
|
|
48
|
-
finally {
|
|
49
|
-
rmSync(work, { recursive: true, force: true });
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
/** Where each object the deployer was given goes: a WorkerCap to its worker, everything else to the owner. */
|
|
53
|
-
export function handOnPlan(created, deployer, owner, workerCapTo) {
|
|
54
|
-
return created
|
|
55
|
-
.filter((c) => c.owner.toLowerCase() === deployer.toLowerCase())
|
|
56
|
-
.map((c) => ({ ...c, to: workerCapTo && /::WorkerCap$/.test(c.type) ? workerCapTo : owner }));
|
|
57
|
-
}
|
|
58
|
-
export function moveCmd() {
|
|
59
|
-
const cmd = new Command('move').description('Move packages on Sui — publish from a throwaway key and hand every cap to its owner');
|
|
60
|
-
cmd.command('publish <dir>')
|
|
61
|
-
.description('Publish a Move package from a THROWAWAY deployer: fund it from --fund-dir, publish, send the UpgradeCap and every init object to --owner (a WorkerCap to --worker-cap-to), return the gas, read it all back. Dry unless --live')
|
|
62
|
-
.requiredOption('--owner <address>', 'Sui address that receives the UpgradeCap and every owned object the package creates')
|
|
63
|
-
.option('--worker-cap-to <address>', 'Sui address for a ::WorkerCap (default: --owner)')
|
|
64
|
-
.option('--fund-dir <dir>', 'Sealed vault folder that funds the deployer (Keychain / Touch ID)')
|
|
65
|
-
.option('--fund <sui>', 'SUI to fund the deployer with', '1')
|
|
66
|
-
.option('--net <network>', 'testnet | mainnet (default: ONE_NETWORK, then `one network`, then the deploy)')
|
|
67
|
-
.option('--rpc <url>', 'gRPC base URL override')
|
|
68
|
-
.option('--live', 'Sign and send. Without it: build and print the plan only')
|
|
69
|
-
.action(async (dir, o, sub) => {
|
|
70
|
-
const t0 = Date.now();
|
|
71
|
-
const nc = await resolveNet(o.net);
|
|
72
|
-
if (!nc.ok)
|
|
73
|
-
return out(sub, nc);
|
|
74
|
-
const net = nc.net;
|
|
75
|
-
if (!SUI_ADDR.test(o.owner))
|
|
76
|
-
return out(sub, { ok: false, error: 'owner_not_a_sui_address' });
|
|
77
|
-
if (o.workerCapTo && !SUI_ADDR.test(o.workerCapTo))
|
|
78
|
-
return out(sub, { ok: false, error: 'worker_cap_to_not_a_sui_address' });
|
|
79
|
-
if (!/^\d+(\.\d{1,9})?$/.test(o.fund) || Number(o.fund) <= 0)
|
|
80
|
-
return out(sub, { ok: false, error: 'fund_not_an_amount' });
|
|
81
|
-
const fundMist = BigInt(o.fund.split('.')[0]) * 1000000000n + BigInt((o.fund.split('.')[1] ?? '').padEnd(9, '0') || '0');
|
|
82
|
-
let code;
|
|
83
|
-
try {
|
|
84
|
-
code = buildBytecode(dir, net);
|
|
85
|
-
}
|
|
86
|
-
catch (e) {
|
|
87
|
-
return out(sub, { ok: false, error: e.code ?? 'move_build_failed', detail: e.message });
|
|
88
|
-
}
|
|
89
|
-
const plan = {
|
|
90
|
-
package: basename(resolve(dir)), net, networkFrom: nc.from, says: netLine(nc), modules: code.modules.length, dependencies: code.dependencies,
|
|
91
|
-
owner: o.owner, workerCapTo: o.workerCapTo ?? o.owner, fund: `${o.fund} SUI`, fundDir: o.fundDir ?? null,
|
|
92
|
-
};
|
|
93
|
-
if (!o.live)
|
|
94
|
-
return out(sub, { ok: true, dry: true, plan, next: 'add --live (and --fund-dir) to publish' });
|
|
95
|
-
if (!o.fundDir)
|
|
96
|
-
return out(sub, { ok: false, error: 'fund_dir_required', detail: '--live needs --fund-dir <vault folder> to fund the deployer' });
|
|
97
|
-
const opened = await unlock(o.fundDir);
|
|
98
|
-
if ('error' in opened)
|
|
99
|
-
return out(sub, { ok: false, error: 'vault_locked', detail: opened.error });
|
|
100
|
-
const funderKey = opened.keys.find((k) => k.chain === 'sui');
|
|
101
|
-
if (!funderKey)
|
|
102
|
-
return out(sub, { ok: false, error: 'no_sui_key_in_vault' });
|
|
103
|
-
// The throwaway. Kept 0600 outside any repo only so dust can be recovered after a crash.
|
|
104
|
-
const kp = (await loadSpec('@mysten/sui/keypairs/ed25519'));
|
|
105
|
-
const secret = randomBytes(32);
|
|
106
|
-
const deployer = kp.Ed25519Keypair.fromSecretKey(secret).toSuiAddress();
|
|
107
|
-
const secretHex = secret.toString('hex');
|
|
108
|
-
const keep = join(homedir(), '.one', 'deployers');
|
|
109
|
-
mkdirSync(keep, { recursive: true, mode: 0o700 });
|
|
110
|
-
const keptAt = join(keep, `${net}-${plan.package}-${Date.now()}.json`);
|
|
111
|
-
writeFileSync(keptAt, JSON.stringify({ net, package: plan.package, address: deployer, secretKeyHex: secretHex, minted: new Date().toISOString() }), { mode: 0o600 });
|
|
112
|
-
const steps = { deployer, deployerKeptAt: keptAt };
|
|
113
|
-
try {
|
|
114
|
-
const fundTx = await suiSendGrpc({ asset: 'SUI', coinType: SUI_NATIVE, from: funderKey.address, to: deployer, amountUnits: fundMist, privateKeyHex: funderKey.privateKeyHex, net, rpc: o.rpc });
|
|
115
|
-
steps.fund = { digest: fundTx.digest, from: funderKey.address, amount: `${o.fund} SUI`, ms: fundTx.finalMs };
|
|
116
|
-
const pub = await suiExecGrpc({
|
|
117
|
-
net, rpc: o.rpc, from: deployer, privateKeyHex: secretHex,
|
|
118
|
-
build: (tx) => {
|
|
119
|
-
const [upgradeCap] = tx.publish({ modules: code.modules, dependencies: code.dependencies });
|
|
120
|
-
tx.transferObjects([upgradeCap], tx.pure.address(o.owner));
|
|
121
|
-
},
|
|
122
|
-
});
|
|
123
|
-
const pkg = pub.created.find((c) => c.owner === 'package');
|
|
124
|
-
const upgradeCap = pub.created.find((c) => /::package::UpgradeCap$/.test(c.type));
|
|
125
|
-
steps.publish = { digest: pub.digest, packageId: pkg?.objectId, upgradeCap: upgradeCap?.objectId, created: pub.created, gas: `${mistToSui(pub.gasMist)} SUI`, ms: pub.finalMs };
|
|
126
|
-
const hand = handOnPlan(pub.created, deployer, o.owner, o.workerCapTo);
|
|
127
|
-
const back = await suiExecGrpc({
|
|
128
|
-
net, rpc: o.rpc, from: deployer, privateKeyHex: secretHex,
|
|
129
|
-
build: (tx) => {
|
|
130
|
-
for (const to of new Set(hand.map((h) => h.to))) {
|
|
131
|
-
tx.transferObjects(hand.filter((h) => h.to === to).map((h) => tx.object(h.objectId)), tx.pure.address(to));
|
|
132
|
-
}
|
|
133
|
-
tx.transferObjects([tx.gas], tx.pure.address(funderKey.address));
|
|
134
|
-
},
|
|
135
|
-
});
|
|
136
|
-
steps.handOn = { digest: back.digest, objects: hand.map((h) => ({ objectId: h.objectId, type: h.type, to: h.to })), gasReturnedTo: funderKey.address, ms: back.finalMs };
|
|
137
|
-
// Read back. Ok only if every cap sits where it was sent and the deployer holds nothing.
|
|
138
|
-
const ids = [...(upgradeCap ? [upgradeCap.objectId] : []), ...hand.map((h) => h.objectId)];
|
|
139
|
-
const read = await suiReadObjects(net, ids, { rpc: o.rpc });
|
|
140
|
-
const want = new Map([...(upgradeCap ? [[upgradeCap.objectId, o.owner]] : []), ...hand.map((h) => [h.objectId, h.to])]);
|
|
141
|
-
const wrong = read.filter((r) => (want.get(r.objectId) ?? '').toLowerCase() !== r.owner.toLowerCase());
|
|
142
|
-
steps.readBack = read;
|
|
143
|
-
const ok = Boolean(pkg && upgradeCap) && wrong.length === 0;
|
|
144
|
-
return out(sub, { ok, ...(ok ? {} : { error: 'read_back_mismatch', wrong }), net, packageId: pkg?.objectId, upgradeCap: upgradeCap?.objectId, ...steps, wallMs: Date.now() - t0 });
|
|
145
|
-
}
|
|
146
|
-
catch (e) {
|
|
147
|
-
const err = e;
|
|
148
|
-
return out(sub, { ok: false, error: err.code ?? 'move_publish_failed', detail: err.message, ...(err.digest ? { digest: err.digest } : {}), ...steps, recover: `deployer key kept at ${keptAt} (0600) — return its SUI with a send from that key` });
|
|
149
|
-
}
|
|
150
|
-
});
|
|
151
|
-
return cmd;
|
|
152
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* network-cmd.ts — `one network [mainnet|testnet|auto]`: the one switch every chain command reads
|
|
3
|
-
* (lib/net-choice.ts). Bare: which network a command would use right now, and why. A name: save it in
|
|
4
|
-
* ~/.config/one/network. `auto`: clear it, so commands follow the deploy again.
|
|
5
|
-
*
|
|
6
|
-
* Tony, 2026-11-12: "making the switch between testnet to mainnet and back to testnet for training to be
|
|
7
|
-
* seamless and delightful." So the switch says, in one line, what it means for your money, then shows the
|
|
8
|
-
* wallet in this folder on that network — and on testnet with nothing in it, the one command for free coins.
|
|
9
|
-
*/
|
|
10
|
-
import { Command } from 'commander';
|
|
11
|
-
import { type NetChoice } from './lib/net-choice.js';
|
|
12
|
-
import { type Net } from './lib/network.js';
|
|
13
|
-
/** The headline: what this network means for your money, in plain words. */
|
|
14
|
-
export declare function headline(c: NetChoice & {
|
|
15
|
-
ok: true;
|
|
16
|
-
}, deploy: Net | null): string;
|
|
17
|
-
export declare function networkCmd(): Command;
|
package/dist/src/network-cmd.js
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* network-cmd.ts — `one network [mainnet|testnet|auto]`: the one switch every chain command reads
|
|
3
|
-
* (lib/net-choice.ts). Bare: which network a command would use right now, and why. A name: save it in
|
|
4
|
-
* ~/.config/one/network. `auto`: clear it, so commands follow the deploy again.
|
|
5
|
-
*
|
|
6
|
-
* Tony, 2026-11-12: "making the switch between testnet to mainnet and back to testnet for training to be
|
|
7
|
-
* seamless and delightful." So the switch says, in one line, what it means for your money, then shows the
|
|
8
|
-
* wallet in this folder on that network — and on testnet with nothing in it, the one command for free coins.
|
|
9
|
-
*/
|
|
10
|
-
import { Command } from 'commander';
|
|
11
|
-
import { jsonMode, out } from './lib/client.js';
|
|
12
|
-
import { NET_FILE, resolveNet, saveNet, savedNet, webBase } from './lib/net-choice.js';
|
|
13
|
-
import { readDeployNetwork } from './lib/network.js';
|
|
14
|
-
import { SUI, SUI_NATIVE, readSuiCoin } from './lib/wallet-money.js';
|
|
15
|
-
import { deadlineFetch, vaultSuiAddressOf } from './wallet-money.js';
|
|
16
|
-
/** The headline: what this network means for your money, in plain words. */
|
|
17
|
-
export function headline(c, deploy) {
|
|
18
|
-
const why = { flag: '--net', env: 'ONE_NETWORK', saved: 'your choice', deploy: 'one.ie' }[c.from];
|
|
19
|
-
if (c.net === 'testnet')
|
|
20
|
-
return `◐ Practice — test coins, free to get, nothing real moves. (${why})`;
|
|
21
|
-
return `● Real money — every send names MAINNET and waits for --live. (${why}${c.from !== 'deploy' && deploy === 'testnet' ? ', while one.ie still runs testnet' : ''})`;
|
|
22
|
-
}
|
|
23
|
-
const units = (v, d) => {
|
|
24
|
-
const w = (v / 10n ** BigInt(d)).toString();
|
|
25
|
-
const f = (v % 10n ** BigInt(d)).toString().padStart(d, '0').replace(/0+$/, '');
|
|
26
|
-
return f ? `${w}.${f}` : w;
|
|
27
|
-
};
|
|
28
|
-
export function networkCmd() {
|
|
29
|
-
return new Command('network')
|
|
30
|
-
.description('Testnet or mainnet for every chain command. Bare: the network now and why. `mainnet|testnet`: switch. `auto`: follow one.ie. Order: --net, ONE_NETWORK, this choice, the deploy')
|
|
31
|
-
.argument('[choice]', 'mainnet | testnet | auto')
|
|
32
|
-
.option('--api <url>', 'one.ie base URL whose deploy is followed')
|
|
33
|
-
.option('--dir <path>', 'The wallet folder to show on this network', '.')
|
|
34
|
-
.action(async (choice, o, sub) => {
|
|
35
|
-
const t0 = Date.now();
|
|
36
|
-
if (choice !== undefined) {
|
|
37
|
-
if (choice !== 'mainnet' && choice !== 'testnet' && choice !== 'auto')
|
|
38
|
-
return out(sub, { ok: false, error: 'bad_choice', message: 'one network mainnet | testnet | auto' });
|
|
39
|
-
saveNet(choice === 'auto' ? null : choice);
|
|
40
|
-
}
|
|
41
|
-
const base = webBase(o.api);
|
|
42
|
-
const [now, deploy] = await Promise.all([resolveNet(undefined, o.api), readDeployNetwork(base)]);
|
|
43
|
-
const saved = savedNet();
|
|
44
|
-
const env = process.env.ONE_NETWORK?.trim() || null;
|
|
45
|
-
// This folder's wallet, on the network just chosen. Public address only — the vault never opens.
|
|
46
|
-
const sui = vaultSuiAddressOf(o.dir);
|
|
47
|
-
let wallet = null;
|
|
48
|
-
if (now.ok && sui) {
|
|
49
|
-
const f = deadlineFetch(6000);
|
|
50
|
-
const [s, u] = await Promise.all([readSuiCoin(f, now.net, sui, SUI_NATIVE), readSuiCoin(f, now.net, sui, SUI[now.net].usdc)]);
|
|
51
|
-
wallet = { address: sui, sui: s === null ? null : units(s, 9), usdc: u === null ? null : units(u, 6) };
|
|
52
|
-
}
|
|
53
|
-
const empty = wallet && wallet.sui !== null && Number(wallet.sui) === 0;
|
|
54
|
-
if (jsonMode(sub))
|
|
55
|
-
return out(sub, { ok: now.ok, network: now.ok ? now.net : null, from: now.ok ? now.from : null, deploy, saved, env, wallet, ms: Date.now() - t0, ...(now.ok ? {} : { error: now.error }) });
|
|
56
|
-
if (!now.ok) {
|
|
57
|
-
process.exitCode = 1;
|
|
58
|
-
process.stdout.write(`? Which network? ${now.message}\n`);
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
const short = (a) => `${a.slice(0, 6)}…${a.slice(-4)}`;
|
|
62
|
-
const lines = [
|
|
63
|
-
headline(now, deploy),
|
|
64
|
-
...(wallet ? [` your wallet ${short(wallet.address)}: ${wallet.sui ?? '—'} SUI · ${wallet.usdc ?? '—'} USDC on ${now.net}`] : []),
|
|
65
|
-
...(now.net === 'testnet' && wallet && empty ? [` free test coins: one wallet faucet ${wallet.address} --chain sui --network testnet`] : []),
|
|
66
|
-
'',
|
|
67
|
-
now.net === 'testnet' ? ' back to real money: one network mainnet' : ' practise first: one network testnet',
|
|
68
|
-
saved ? ' follow one.ie again: one network auto' : ` one.ie runs ${deploy ?? 'an unreadable network'} — this follows it`,
|
|
69
|
-
...(env ? [` ONE_NETWORK=${env} is set in this shell and wins over the switch`] : []),
|
|
70
|
-
` order: --net, then ONE_NETWORK, then this switch${saved ? ` (${NET_FILE})` : ''}, then one.ie`,
|
|
71
|
-
];
|
|
72
|
-
process.stdout.write(lines.join('\n') + '\n');
|
|
73
|
-
});
|
|
74
|
-
}
|
package/dist/src/next.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `one next` (alias `one learn`): where you are, and the one thing to do now.
|
|
3
|
-
* `one learn <topic>` teaches one thing: me · key · wallets · limit · sell · paid · ask · never · course.
|
|
4
|
-
*
|
|
5
|
-
* Reads this folder only (`.one/`), never the network: the "what now" door answers at
|
|
6
|
-
* once. The words are `lib/next-words.ts`; this file reads the disk and prints.
|
|
7
|
-
*/
|
|
8
|
-
import { Command } from 'commander';
|
|
9
|
-
import { type NextFacts } from './lib/next-words.js';
|
|
10
|
-
/** The folder's facts. Secrets are checked for presence only; their contents are never read. */
|
|
11
|
-
export declare function readFacts(dir: string): NextFacts;
|
|
12
|
-
export declare function nextCmd(): Command;
|
package/dist/src/next.js
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `one next` (alias `one learn`): where you are, and the one thing to do now.
|
|
3
|
-
* `one learn <topic>` teaches one thing: me · key · wallets · limit · sell · paid · ask · never · course.
|
|
4
|
-
*
|
|
5
|
-
* Reads this folder only (`.one/`), never the network: the "what now" door answers at
|
|
6
|
-
* once. The words are `lib/next-words.ts`; this file reads the disk and prints.
|
|
7
|
-
*/
|
|
8
|
-
import { Command } from 'commander';
|
|
9
|
-
import { existsSync, readFileSync } from 'node:fs';
|
|
10
|
-
import { join } from 'node:path';
|
|
11
|
-
import { jsonMode } from './lib/client.js';
|
|
12
|
-
import { cliPrefix } from './lib/invoked-as.js';
|
|
13
|
-
import { isAgentEnvironment } from './lib/agent-env.js';
|
|
14
|
-
import { KEY_DIR_NAME, KEY_FILE_NAME, LEGACY_KEY_DIR_NAME } from './lib/keyfile.js';
|
|
15
|
-
import { readVaultFolder } from './lib/vaultfile.js';
|
|
16
|
-
import { asciiOf } from './lib/journey-words.js';
|
|
17
|
-
import { isTopic, learnWords, nextData, nextWords, TOPICS } from './lib/next-words.js';
|
|
18
|
-
/** The folder's facts. Secrets are checked for presence only; their contents are never read. */
|
|
19
|
-
export function readFacts(dir) {
|
|
20
|
-
let state = null;
|
|
21
|
-
try {
|
|
22
|
-
const s = JSON.parse(readFileSync(join(dir, KEY_DIR_NAME, 'journey.json'), 'utf8'));
|
|
23
|
-
if (s && s.v === 1 && typeof s.workspace === 'string')
|
|
24
|
-
state = s;
|
|
25
|
-
}
|
|
26
|
-
catch { /* no journey here yet */ }
|
|
27
|
-
const hasKey = [KEY_DIR_NAME, LEGACY_KEY_DIR_NAME].some((d) => existsSync(join(dir, d, KEY_FILE_NAME)));
|
|
28
|
-
const v = readVaultFolder(dir);
|
|
29
|
-
return { state, hasKey, vault: v ? v.wrap : null };
|
|
30
|
-
}
|
|
31
|
-
export function nextCmd() {
|
|
32
|
-
return new Command('next')
|
|
33
|
-
.alias('learn')
|
|
34
|
-
.description(`Where you are, and the one thing to do now. Teach one thing: learn <${TOPICS.join('|')}>`)
|
|
35
|
-
.argument('[topic]', TOPICS.join(' | '))
|
|
36
|
-
.option('--for <reader>', 'agent (the whole primer) or person (one step). Default: agent in an agent shell, person at a terminal')
|
|
37
|
-
.option('--dir <path>', 'The agent\'s folder', '.')
|
|
38
|
-
.action((topic, opts, cmd) => {
|
|
39
|
-
if (topic && !isTopic(topic)) {
|
|
40
|
-
const error = `no lesson called "${topic}". Lessons: ${TOPICS.join(', ')}`;
|
|
41
|
-
if (jsonMode(cmd))
|
|
42
|
-
process.stdout.write(JSON.stringify({ ok: false, error }) + '\n');
|
|
43
|
-
else
|
|
44
|
-
process.stderr.write(`${error}\n`);
|
|
45
|
-
process.exitCode = 1;
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
if (opts.for && opts.for !== 'agent' && opts.for !== 'person') {
|
|
49
|
-
process.stderr.write('--for is agent or person\n');
|
|
50
|
-
process.exitCode = 1;
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
const facts = readFacts(opts.dir);
|
|
54
|
-
const cli = cliPrefix();
|
|
55
|
-
if (jsonMode(cmd)) {
|
|
56
|
-
const data = nextData(facts, cli);
|
|
57
|
-
// A topic narrows the answer to that one lesson; bare gives every lesson.
|
|
58
|
-
const body = topic ? { ...data, lessons: data.lessons.filter((l) => l.topic === topic) } : data;
|
|
59
|
-
process.stdout.write(JSON.stringify({ ok: true, ...body }) + '\n');
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
const reader = opts.for ?? (isAgentEnvironment() ? 'agent' : 'person');
|
|
63
|
-
const text = topic && isTopic(topic) ? learnWords(facts, cli, reader, topic) : nextWords(facts, cli, reader);
|
|
64
|
-
const plain = !process.stdout.isTTY || 'NO_COLOR' in process.env;
|
|
65
|
-
process.stdout.write(plain ? asciiOf(text) : text);
|
|
66
|
-
});
|
|
67
|
-
}
|
package/dist/src/onboard.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* oneie onboard — deterministically walk a fresh agent through the platform's
|
|
3
|
-
* agent-onboarding lifecycle (text/agent-onboarding-lifecycle.md): registered
|
|
4
|
-
* → bootstrapped → active → settled → adopted.
|
|
5
|
-
*
|
|
6
|
-
* Reuses the same zero-to-live call `one init` uses (POST /api/provision/agent)
|
|
7
|
-
* for register+bootstrap — both stages are tracked server-side automatically
|
|
8
|
-
* (no extra calls from here). Adds the read-back + guide layer `init` doesn't:
|
|
9
|
-
* after provisioning, reads the real stage_transition log via lifecycle:mine
|
|
10
|
-
* and tells the agent exactly what unlocks each remaining stage.
|
|
11
|
-
*
|
|
12
|
-
* Idempotent: if this directory already has ONE_API_KEY, skips provisioning
|
|
13
|
-
* and just reports current lifecycle position.
|
|
14
|
-
*/
|
|
15
|
-
import { Command } from 'commander';
|
|
16
|
-
export declare function onboardCmd(): Command;
|