@0gfoundation/0g-agentdna 0.4.0 → 0.5.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/GUIDE.md +190 -40
- package/OPERATORS.md +164 -0
- package/OPERATORS.zh.md +141 -0
- package/PROVIDERS.md +6 -0
- package/PROVIDERS.zh.md +3 -1
- package/README.md +84 -11
- package/dist/AgentClient.d.ts +374 -26
- package/dist/AgentClient.d.ts.map +1 -1
- package/dist/AgentClient.js +323 -40
- package/dist/AgentClient.js.map +1 -1
- package/dist/AgenticID.d.ts +170 -80
- package/dist/AgenticID.d.ts.map +1 -1
- package/dist/AgenticID.js +300 -42
- package/dist/AgenticID.js.map +1 -1
- package/dist/AttestorClient.d.ts +115 -31
- package/dist/AttestorClient.d.ts.map +1 -1
- package/dist/AttestorClient.js +276 -56
- package/dist/AttestorClient.js.map +1 -1
- package/dist/Credentials.d.ts +574 -0
- package/dist/Credentials.d.ts.map +1 -0
- package/dist/Credentials.js +838 -0
- package/dist/Credentials.js.map +1 -0
- package/dist/Operators.d.ts +60 -0
- package/dist/Operators.d.ts.map +1 -0
- package/dist/Operators.js +38 -0
- package/dist/Operators.js.map +1 -0
- package/dist/Providers.d.ts +13 -0
- package/dist/Providers.d.ts.map +1 -1
- package/dist/Providers.js +20 -1
- package/dist/Providers.js.map +1 -1
- package/dist/Releases.d.ts +51 -0
- package/dist/Releases.d.ts.map +1 -0
- package/dist/Releases.js +72 -0
- package/dist/Releases.js.map +1 -0
- package/dist/ReputationClient.d.ts +47 -3
- package/dist/ReputationClient.d.ts.map +1 -1
- package/dist/ReputationClient.js +204 -78
- package/dist/ReputationClient.js.map +1 -1
- package/dist/ServeProof.d.ts +70 -23
- package/dist/ServeProof.d.ts.map +1 -1
- package/dist/ServeProof.js +94 -35
- package/dist/ServeProof.js.map +1 -1
- package/dist/ServeSession.d.ts +17 -2
- package/dist/ServeSession.d.ts.map +1 -1
- package/dist/ServeSession.js +77 -9
- package/dist/ServeSession.js.map +1 -1
- package/dist/Settings.d.ts +25 -1
- package/dist/Settings.d.ts.map +1 -1
- package/dist/Settings.js +53 -1
- package/dist/Settings.js.map +1 -1
- package/dist/TrustRegistry.d.ts +28 -0
- package/dist/TrustRegistry.d.ts.map +1 -0
- package/dist/TrustRegistry.js +67 -0
- package/dist/TrustRegistry.js.map +1 -0
- package/dist/abi.d.ts +346 -34
- package/dist/abi.d.ts.map +1 -1
- package/dist/abi.js +150 -30
- package/dist/abi.js.map +1 -1
- package/dist/cli/attach.d.ts +79 -0
- package/dist/cli/attach.d.ts.map +1 -0
- package/dist/cli/attach.js +253 -0
- package/dist/cli/attach.js.map +1 -0
- package/dist/cli/commands/cells.d.ts +45 -0
- package/dist/cli/commands/cells.d.ts.map +1 -1
- package/dist/cli/commands/cells.js +77 -0
- package/dist/cli/commands/cells.js.map +1 -1
- package/dist/cli/commands/cred.d.ts +12 -0
- package/dist/cli/commands/cred.d.ts.map +1 -0
- package/dist/cli/commands/cred.js +43 -0
- package/dist/cli/commands/cred.js.map +1 -0
- package/dist/cli/commands/doctor.d.ts.map +1 -1
- package/dist/cli/commands/doctor.js +44 -35
- package/dist/cli/commands/doctor.js.map +1 -1
- package/dist/cli/commands/interactive.d.ts +597 -21
- package/dist/cli/commands/interactive.d.ts.map +1 -1
- package/dist/cli/commands/interactive.js +5082 -1323
- package/dist/cli/commands/interactive.js.map +1 -1
- package/dist/cli/commands/list.d.ts +5 -5
- package/dist/cli/commands/list.d.ts.map +1 -1
- package/dist/cli/commands/list.js +21 -26
- package/dist/cli/commands/list.js.map +1 -1
- package/dist/cli/commands/providers.d.ts +4 -0
- package/dist/cli/commands/providers.d.ts.map +1 -1
- package/dist/cli/commands/providers.js +19 -5
- package/dist/cli/commands/providers.js.map +1 -1
- package/dist/cli/commands/releases.d.ts +13 -0
- package/dist/cli/commands/releases.d.ts.map +1 -0
- package/dist/cli/commands/releases.js +65 -0
- package/dist/cli/commands/releases.js.map +1 -0
- package/dist/cli/commands/settings.d.ts +5 -0
- package/dist/cli/commands/settings.d.ts.map +1 -1
- package/dist/cli/commands/settings.js +70 -24
- package/dist/cli/commands/settings.js.map +1 -1
- package/dist/cli/commands/status.d.ts +2 -1
- package/dist/cli/commands/status.d.ts.map +1 -1
- package/dist/cli/commands/status.js +22 -19
- package/dist/cli/commands/status.js.map +1 -1
- package/dist/cli/config.d.ts +48 -1
- package/dist/cli/config.d.ts.map +1 -1
- package/dist/cli/config.js +114 -5
- package/dist/cli/config.js.map +1 -1
- package/dist/cli/credentials.d.ts +179 -0
- package/dist/cli/credentials.d.ts.map +1 -0
- package/dist/cli/credentials.js +1443 -0
- package/dist/cli/credentials.js.map +1 -0
- package/dist/cli/download.d.ts +21 -0
- package/dist/cli/download.d.ts.map +1 -0
- package/dist/cli/download.js +89 -0
- package/dist/cli/download.js.map +1 -0
- package/dist/cli/env.d.ts +6 -0
- package/dist/cli/env.d.ts.map +1 -1
- package/dist/cli/env.js +18 -6
- package/dist/cli/env.js.map +1 -1
- package/dist/cli/envelope.d.ts +4 -2
- package/dist/cli/envelope.d.ts.map +1 -1
- package/dist/cli/envelope.js +10 -6
- package/dist/cli/envelope.js.map +1 -1
- package/dist/cli/errors.d.ts +45 -1
- package/dist/cli/errors.d.ts.map +1 -1
- package/dist/cli/errors.js +77 -0
- package/dist/cli/errors.js.map +1 -1
- package/dist/cli/inference.d.ts.map +1 -1
- package/dist/cli/inference.js +7 -0
- package/dist/cli/inference.js.map +1 -1
- package/dist/cli/inkView.d.ts +341 -0
- package/dist/cli/inkView.d.ts.map +1 -0
- package/dist/cli/inkView.js +1019 -0
- package/dist/cli/inkView.js.map +1 -0
- package/dist/cli/legacy/modelKey.d.ts +24 -0
- package/dist/cli/legacy/modelKey.d.ts.map +1 -0
- package/dist/cli/legacy/modelKey.js +32 -0
- package/dist/cli/legacy/modelKey.js.map +1 -0
- package/dist/cli/livePrompt.d.ts +212 -0
- package/dist/cli/livePrompt.d.ts.map +1 -0
- package/dist/cli/livePrompt.js +576 -0
- package/dist/cli/livePrompt.js.map +1 -0
- package/dist/cli/main.js +206 -72
- package/dist/cli/main.js.map +1 -1
- package/dist/cli/modelkey.d.ts +64 -0
- package/dist/cli/modelkey.d.ts.map +1 -0
- package/dist/cli/modelkey.js +113 -0
- package/dist/cli/modelkey.js.map +1 -0
- package/dist/cli/outboxSync.d.ts +51 -0
- package/dist/cli/outboxSync.d.ts.map +1 -0
- package/dist/cli/outboxSync.js +210 -0
- package/dist/cli/outboxSync.js.map +1 -0
- package/dist/cli/plain.d.ts +46 -0
- package/dist/cli/plain.d.ts.map +1 -0
- package/dist/cli/plain.js +260 -0
- package/dist/cli/plain.js.map +1 -0
- package/dist/cli/proofs.d.ts +5 -0
- package/dist/cli/proofs.d.ts.map +1 -1
- package/dist/cli/proofs.js +20 -0
- package/dist/cli/proofs.js.map +1 -1
- package/dist/cli/ref.d.ts.map +1 -1
- package/dist/cli/ref.js +3 -2
- package/dist/cli/ref.js.map +1 -1
- package/dist/cli/releaseNotice.d.ts +64 -0
- package/dist/cli/releaseNotice.d.ts.map +1 -0
- package/dist/cli/releaseNotice.js +194 -0
- package/dist/cli/releaseNotice.js.map +1 -0
- package/dist/cli/sdk.d.ts +18 -0
- package/dist/cli/sdk.d.ts.map +1 -1
- package/dist/cli/sdk.js +99 -1
- package/dist/cli/sdk.js.map +1 -1
- package/dist/cli/settings.d.ts +87 -6
- package/dist/cli/settings.d.ts.map +1 -1
- package/dist/cli/settings.js +270 -18
- package/dist/cli/settings.js.map +1 -1
- package/dist/cli/textfit.d.ts +28 -0
- package/dist/cli/textfit.d.ts.map +1 -0
- package/dist/cli/textfit.js +111 -0
- package/dist/cli/textfit.js.map +1 -0
- package/dist/constants.d.ts +1 -1
- package/dist/constants.js +1 -1
- package/dist/context.d.ts +26 -0
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +1 -0
- package/dist/context.js.map +1 -1
- package/dist/index.d.ts +19 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +35 -2
- package/dist/index.js.map +1 -1
- package/dist/legacy/modelKey.d.ts +67 -0
- package/dist/legacy/modelKey.d.ts.map +1 -0
- package/dist/legacy/modelKey.js +80 -0
- package/dist/legacy/modelKey.js.map +1 -0
- package/dist/legacy/serveProofV1.d.ts +56 -0
- package/dist/legacy/serveProofV1.d.ts.map +1 -0
- package/dist/legacy/serveProofV1.js +91 -0
- package/dist/legacy/serveProofV1.js.map +1 -0
- package/dist/provider-catalog.json +3 -2
- package/dist/secretEnv.d.ts +18 -3
- package/dist/secretEnv.d.ts.map +1 -1
- package/dist/secretEnv.js +16 -2
- package/dist/secretEnv.js.map +1 -1
- package/dist/types.d.ts +63 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/viemErrors.d.ts +30 -0
- package/dist/viemErrors.d.ts.map +1 -0
- package/dist/viemErrors.js +36 -0
- package/dist/viemErrors.js.map +1 -0
- package/package.json +5 -1
- package/src/AgentClient.ts +622 -68
- package/src/AgenticID.ts +345 -56
- package/src/AttestorClient.ts +330 -83
- package/src/Credentials.ts +1027 -0
- package/src/Operators.ts +71 -0
- package/src/Providers.ts +20 -0
- package/src/Releases.ts +95 -0
- package/src/ReputationClient.ts +231 -79
- package/src/ServeProof.ts +123 -39
- package/src/ServeSession.ts +91 -9
- package/src/Settings.ts +61 -1
- package/src/TrustRegistry.ts +75 -0
- package/src/abi.ts +153 -30
- package/src/cli/attach.ts +257 -0
- package/src/cli/commands/cells.ts +104 -0
- package/src/cli/commands/cred.ts +44 -0
- package/src/cli/commands/doctor.ts +45 -37
- package/src/cli/commands/interactive.ts +4120 -664
- package/src/cli/commands/list.ts +21 -30
- package/src/cli/commands/providers.ts +17 -4
- package/src/cli/commands/releases.ts +60 -0
- package/src/cli/commands/settings.ts +75 -28
- package/src/cli/commands/status.ts +24 -21
- package/src/cli/config.ts +119 -4
- package/src/cli/credentials.ts +1379 -0
- package/src/cli/download.ts +80 -0
- package/src/cli/env.ts +22 -7
- package/src/cli/envelope.ts +10 -6
- package/src/cli/errors.ts +92 -0
- package/src/cli/inference.ts +8 -1
- package/src/cli/inkView.ts +969 -0
- package/src/cli/legacy/modelKey.ts +35 -0
- package/src/cli/livePrompt.ts +615 -0
- package/src/cli/main.ts +206 -76
- package/src/cli/modelkey.ts +124 -0
- package/src/cli/outboxSync.ts +231 -0
- package/src/cli/plain.ts +260 -0
- package/src/cli/proofs.ts +27 -0
- package/src/cli/ref.ts +5 -4
- package/src/cli/releaseNotice.ts +200 -0
- package/src/cli/sdk.ts +87 -7
- package/src/cli/settings.ts +272 -22
- package/src/cli/textfit.ts +95 -0
- package/src/constants.ts +1 -1
- package/src/context.ts +28 -0
- package/src/index.ts +50 -7
- package/src/legacy/modelKey.ts +80 -0
- package/src/legacy/serveProofV1.ts +124 -0
- package/src/provider-catalog.json +3 -2
- package/src/secretEnv.ts +18 -3
- package/src/types.ts +60 -1
- package/src/viemErrors.ts +39 -0
|
@@ -15,9 +15,11 @@ import { createPublicClient, http, formatEther, type PublicClient } from 'viem';
|
|
|
15
15
|
import { privateKeyToAccount } from 'viem/accounts';
|
|
16
16
|
import { MIN_SANDBOX_BALANCE_WEI, type AgenticID } from '../../AgenticID';
|
|
17
17
|
import { RPC_URL } from '../../constants';
|
|
18
|
-
import { buildClient } from '../sdk';
|
|
18
|
+
import { attestorUnreachable, buildClient } from '../sdk';
|
|
19
19
|
import { renamedAttestor } from '../config';
|
|
20
|
-
import {
|
|
20
|
+
import { attestorUrlRemedy } from '../env';
|
|
21
|
+
import { CliError, currentSurface, shellStep, shellTo, type ErrorCode } from '../errors';
|
|
22
|
+
import { explainError, ogShown } from '../plain';
|
|
21
23
|
import { emitOk, print } from '../envelope';
|
|
22
24
|
import type { CommandContext } from '../types';
|
|
23
25
|
|
|
@@ -63,8 +65,8 @@ export async function run(ctx: CommandContext): Promise<void> {
|
|
|
63
65
|
if (!env.attestorUrl) {
|
|
64
66
|
checks.push({
|
|
65
67
|
name: 'attestor', status: 'fail', code: 'MISSING_ATTESTOR_URL',
|
|
66
|
-
detail: '
|
|
67
|
-
remedy:
|
|
68
|
+
detail: 'no attestor URL is set',
|
|
69
|
+
remedy: attestorUrlRemedy(),
|
|
68
70
|
});
|
|
69
71
|
} else {
|
|
70
72
|
try {
|
|
@@ -76,28 +78,34 @@ export async function run(ctx: CommandContext): Promise<void> {
|
|
|
76
78
|
detail: current ? `${env.attestorUrl} (now ${current}; the earlier name still answers — update AGENTIC_ATTESTOR_URL)` : env.attestorUrl,
|
|
77
79
|
});
|
|
78
80
|
} catch (e) {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
remedy: 'verify AGENTIC_ATTESTOR_URL and your network, then retry',
|
|
83
|
-
});
|
|
81
|
+
// As every other command says it: a garbage address is not "did not answer".
|
|
82
|
+
const why = attestorUnreachable(env, e);
|
|
83
|
+
checks.push({ name: 'attestor', status: 'fail', code: 'ATTESTOR_UNREACHABLE', detail: why.message, remedy: why.remedy });
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
-
// 2 — RPC connectivity (explicit-wins: env override > attestor /config > SDK
|
|
88
|
-
|
|
89
|
-
|
|
87
|
+
// 2 — RPC connectivity (explicit-wins: env override > attestor /config > SDK
|
|
88
|
+
// default). Without an override the chain is the attestor's: with no
|
|
89
|
+
// attestor to name it, there is no chain to probe (never a default one the
|
|
90
|
+
// owner did not pick).
|
|
91
|
+
const rpcUrl = env.rpcUrl ?? (cfg ? cfg.chain_rpc ?? RPC_URL : undefined);
|
|
92
|
+
const publicClient: PublicClient | null = rpcUrl ? createPublicClient({ transport: http(rpcUrl) }) : null;
|
|
90
93
|
let rpcOk = false;
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
name: 'rpc', status: '
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
94
|
+
if (!publicClient) {
|
|
95
|
+
skip('rpc', "needs the attestor's /config, or AGENTIC_RPC_URL");
|
|
96
|
+
} else {
|
|
97
|
+
try {
|
|
98
|
+
const chainId = await publicClient.getChainId();
|
|
99
|
+
rpcOk = true;
|
|
100
|
+
checks.push({ name: 'rpc', status: 'pass', detail: `${rpcUrl} (chainId ${chainId})` });
|
|
101
|
+
} catch (e) {
|
|
102
|
+
const p = explainError(e);
|
|
103
|
+
checks.push({
|
|
104
|
+
name: 'rpc', status: 'fail', code: 'RPC_UNREACHABLE',
|
|
105
|
+
detail: p.code === 'RPC_UNREACHABLE' ? p.message : `${rpcUrl}: ${p.message}`,
|
|
106
|
+
remedy: 'set AGENTIC_RPC_URL to a reachable 0G RPC (an attestor /config may advertise an internal-only one)',
|
|
107
|
+
});
|
|
108
|
+
}
|
|
101
109
|
}
|
|
102
110
|
|
|
103
111
|
// 3 — wallet configured. Absent = skip (matching gas/ack/sandboxBalance,
|
|
@@ -107,27 +115,29 @@ export async function run(ctx: CommandContext): Promise<void> {
|
|
|
107
115
|
checks.push({
|
|
108
116
|
name: 'wallet', status: 'skip', code: 'WALLET_REQUIRED',
|
|
109
117
|
detail: 'no owner key configured (owner checks skipped)',
|
|
110
|
-
remedy:
|
|
118
|
+
remedy: currentSurface() === 'shell'
|
|
119
|
+
? `${shellStep('login')} saves it`
|
|
120
|
+
: `${shellStep('login')}, or export AGENTIC_PRIVATE_KEY=0x… # env only — no flag, by design`,
|
|
111
121
|
});
|
|
112
122
|
} else if (!/^0x[0-9a-fA-F]{64}$/.test(env.privateKey)) {
|
|
113
123
|
checks.push({
|
|
114
124
|
name: 'wallet', status: 'fail', code: 'WALLET_REQUIRED',
|
|
115
|
-
detail: 'the
|
|
116
|
-
remedy: 'export AGENTIC_PRIVATE_KEY=0x<64 hex chars>',
|
|
125
|
+
detail: `${env.privateKeySource === 'file' ? 'the owner key saved by login' : 'AGENTIC_PRIVATE_KEY'} is malformed (expected 64 hex chars, 0x prefix optional)`,
|
|
126
|
+
remedy: env.privateKeySource === 'file' ? shellTo('login', 'enter the key again') : 'export AGENTIC_PRIVATE_KEY=0x<64 hex chars>',
|
|
117
127
|
});
|
|
118
128
|
} else {
|
|
119
129
|
owner = privateKeyToAccount(env.privateKey).address;
|
|
120
|
-
checks.push({ name: 'wallet', status: 'pass', detail: `${owner} (from AGENTIC_PRIVATE_KEY)` });
|
|
130
|
+
checks.push({ name: 'wallet', status: 'pass', detail: `${owner} (${env.privateKeySource === 'file' ? 'saved by login' : 'from AGENTIC_PRIVATE_KEY'})` });
|
|
121
131
|
}
|
|
122
132
|
|
|
123
133
|
// 4 — gas: the owner must be able to pay for ack/deposit txs at all
|
|
124
134
|
if (!owner) skip('gas', 'needs wallet');
|
|
125
|
-
else if (!rpcOk) skip('gas', 'needs rpc');
|
|
135
|
+
else if (!rpcOk || !publicClient) skip('gas', 'needs rpc');
|
|
126
136
|
else {
|
|
127
137
|
try {
|
|
128
138
|
const bal = await publicClient.getBalance({ address: owner });
|
|
129
139
|
if (bal > 0n) {
|
|
130
|
-
checks.push({ name: 'gas', status: 'pass', detail:
|
|
140
|
+
checks.push({ name: 'gas', status: 'pass', detail: ogShown(bal) });
|
|
131
141
|
} else {
|
|
132
142
|
checks.push({
|
|
133
143
|
name: 'gas', status: 'fail', code: 'PREFLIGHT_GAS',
|
|
@@ -138,7 +148,7 @@ export async function run(ctx: CommandContext): Promise<void> {
|
|
|
138
148
|
} catch (e) {
|
|
139
149
|
checks.push({
|
|
140
150
|
name: 'gas', status: 'fail', code: 'PREFLIGHT_GAS',
|
|
141
|
-
detail: `could not read balance: ${(e
|
|
151
|
+
detail: `could not read balance: ${explainError(e).message}`,
|
|
142
152
|
remedy: 'check RPC connectivity, then retry',
|
|
143
153
|
});
|
|
144
154
|
}
|
|
@@ -171,15 +181,13 @@ export async function run(ctx: CommandContext): Promise<void> {
|
|
|
171
181
|
checks.push({
|
|
172
182
|
name: 'ack', status: 'fail', code: 'PREFLIGHT_ACK',
|
|
173
183
|
detail: `not acknowledged: ${missing.join(', ')}`,
|
|
174
|
-
|
|
175
|
-
// remedy is guidance text until stage 1 promotes it to a command.
|
|
176
|
-
remedy: 'run `ack` in the interactive shell (or SDK: await ag.ack())',
|
|
184
|
+
remedy: shellStep('ack'),
|
|
177
185
|
});
|
|
178
186
|
}
|
|
179
187
|
} catch (e) {
|
|
180
188
|
checks.push({
|
|
181
189
|
name: 'ack', status: 'fail', code: 'PREFLIGHT_ACK',
|
|
182
|
-
detail: `could not read ack status: ${(e
|
|
190
|
+
detail: `could not read ack status: ${explainError(e).message}`,
|
|
183
191
|
remedy: 'verify the attestor environment, then retry',
|
|
184
192
|
});
|
|
185
193
|
}
|
|
@@ -192,18 +200,18 @@ export async function run(ctx: CommandContext): Promise<void> {
|
|
|
192
200
|
try {
|
|
193
201
|
const bal = await ag.getBalance({ user: owner });
|
|
194
202
|
if (bal >= MIN_SANDBOX_BALANCE_WEI) {
|
|
195
|
-
checks.push({ name: 'sandboxBalance', status: 'pass', detail: `${
|
|
203
|
+
checks.push({ name: 'sandboxBalance', status: 'pass', detail: `${ogShown(bal)} (≥ 0.1 floor)` });
|
|
196
204
|
} else {
|
|
197
205
|
checks.push({
|
|
198
206
|
name: 'sandboxBalance', status: 'fail', code: 'PREFLIGHT_BALANCE',
|
|
199
|
-
detail: `${
|
|
200
|
-
remedy:
|
|
207
|
+
detail: `${ogShown(bal)} — below the 0.1 OG deploy floor`,
|
|
208
|
+
remedy: shellStep(`deposit ${formatEther(MIN_SANDBOX_BALANCE_WEI - bal)}`),
|
|
201
209
|
});
|
|
202
210
|
}
|
|
203
211
|
} catch (e) {
|
|
204
212
|
checks.push({
|
|
205
213
|
name: 'sandboxBalance', status: 'fail', code: 'PREFLIGHT_BALANCE',
|
|
206
|
-
detail: `could not read sandbox balance: ${(e
|
|
214
|
+
detail: `could not read sandbox balance: ${explainError(e).message}`,
|
|
207
215
|
remedy: 'verify the attestor environment, then retry',
|
|
208
216
|
});
|
|
209
217
|
}
|