@xploai/core 1.0.12 → 1.0.14
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/adapters.test.js +136 -8
- package/dist/adapters.test.js.map +1 -1
- package/dist/agent-auth-hint.d.ts +16 -0
- package/dist/agent-auth-hint.js +85 -0
- package/dist/agent-auth-hint.js.map +1 -0
- package/dist/agent-auth-hint.test.d.ts +1 -0
- package/dist/agent-auth-hint.test.js +72 -0
- package/dist/agent-auth-hint.test.js.map +1 -0
- package/dist/audit.d.ts +39 -1
- package/dist/audit.js +160 -14
- package/dist/audit.js.map +1 -1
- package/dist/audit.test.d.ts +1 -0
- package/dist/audit.test.js +90 -0
- package/dist/audit.test.js.map +1 -0
- package/dist/claude-code-adapter.d.ts +3 -0
- package/dist/claude-code-adapter.js +9 -3
- package/dist/claude-code-adapter.js.map +1 -1
- package/dist/claw-adapter.js +1 -1
- package/dist/claw-adapter.js.map +1 -1
- package/dist/cli-adapter.d.ts +7 -0
- package/dist/cli-adapter.js +24 -0
- package/dist/cli-adapter.js.map +1 -1
- package/dist/codex-adapter.d.ts +10 -0
- package/dist/codex-adapter.js +80 -13
- package/dist/codex-adapter.js.map +1 -1
- package/dist/grokbot-adapter.d.ts +11 -0
- package/dist/grokbot-adapter.js +44 -2
- package/dist/grokbot-adapter.js.map +1 -1
- package/dist/hyperliquid-adapter.d.ts +79 -0
- package/dist/hyperliquid-adapter.js +474 -0
- package/dist/hyperliquid-adapter.js.map +1 -0
- package/dist/hyperliquid-adapter.test.d.ts +1 -0
- package/dist/hyperliquid-adapter.test.js +366 -0
- package/dist/hyperliquid-adapter.test.js.map +1 -0
- package/dist/hyperliquid-journal.d.ts +1 -0
- package/dist/hyperliquid-journal.js +41 -0
- package/dist/hyperliquid-journal.js.map +1 -0
- package/dist/hyperliquid-network.d.ts +18 -0
- package/dist/hyperliquid-network.js +36 -0
- package/dist/hyperliquid-network.js.map +1 -0
- package/dist/hyperliquid-network.test.d.ts +1 -0
- package/dist/hyperliquid-network.test.js +26 -0
- package/dist/hyperliquid-network.test.js.map +1 -0
- package/dist/hyperliquid-path.d.ts +13 -0
- package/dist/hyperliquid-path.js +27 -0
- package/dist/hyperliquid-path.js.map +1 -0
- package/dist/hyperliquid-strategy-limits.d.ts +53 -0
- package/dist/hyperliquid-strategy-limits.js +118 -0
- package/dist/hyperliquid-strategy-limits.js.map +1 -0
- package/dist/hyperliquid-strategy-limits.test.d.ts +1 -0
- package/dist/hyperliquid-strategy-limits.test.js +87 -0
- package/dist/hyperliquid-strategy-limits.test.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -1
- package/dist/onchainos-guard-bin.d.ts +2 -0
- package/dist/onchainos-guard-bin.js +75 -0
- package/dist/onchainos-guard-bin.js.map +1 -0
- package/dist/onchainos-path.d.ts +1 -0
- package/dist/onchainos-path.js +1 -1
- package/dist/onchainos-path.js.map +1 -1
- package/dist/signer-binding.d.ts +45 -0
- package/dist/signer-binding.js +121 -0
- package/dist/signer-binding.js.map +1 -0
- package/dist/signer-binding.test.d.ts +1 -0
- package/dist/signer-binding.test.js +221 -0
- package/dist/signer-binding.test.js.map +1 -0
- package/dist/strategy-quotes.d.ts +5 -0
- package/dist/strategy-quotes.js +195 -0
- package/dist/strategy-quotes.js.map +1 -0
- package/dist/strategy-quotes.test.d.ts +1 -0
- package/dist/strategy-quotes.test.js +99 -0
- package/dist/strategy-quotes.test.js.map +1 -0
- package/dist/swap-intent.d.ts +7 -0
- package/dist/swap-intent.js +65 -0
- package/dist/swap-intent.js.map +1 -0
- package/dist/swap-intent.test.d.ts +1 -0
- package/dist/swap-intent.test.js +64 -0
- package/dist/swap-intent.test.js.map +1 -0
- package/dist/write-guard.d.ts +100 -0
- package/dist/write-guard.js +451 -0
- package/dist/write-guard.js.map +1 -0
- package/dist/write-guard.test.d.ts +1 -0
- package/dist/write-guard.test.js +448 -0
- package/dist/write-guard.test.js.map +1 -0
- package/package.json +3 -2
|
@@ -0,0 +1,451 @@
|
|
|
1
|
+
import { chmodSync, closeSync, existsSync, fstatSync, mkdirSync, mkdtempSync, openSync, readFileSync, readSync, rmSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { homedir, tmpdir } from "node:os";
|
|
3
|
+
import { delimiter, join } from "node:path";
|
|
4
|
+
import { fileURLToPath } from "node:url";
|
|
5
|
+
import { findOnchainosBinaries } from "./onchainos-path.js";
|
|
6
|
+
import { findHyperliquidBinaries } from "./hyperliquid-path.js";
|
|
7
|
+
/**
|
|
8
|
+
* Daemon-side approval gate for AI agent runs.
|
|
9
|
+
*
|
|
10
|
+
* An agent task drives the real `onchainos` CLI through its own shell, so a prompt
|
|
11
|
+
* can only ask the model to confirm before it moves funds, and nothing makes it. The
|
|
12
|
+
* guard puts a shim named `onchainos` first on the agent's PATH. The shim lets reads
|
|
13
|
+
* through and checks explicit argv approvals for regular writes. Strict Hyperliquid
|
|
14
|
+
* operations take their intent on stdin and require the daemon's dedicated adapter.
|
|
15
|
+
*
|
|
16
|
+
* Direct `cli` tasks (the dashboard's own forms, which show their own confirm step)
|
|
17
|
+
* do not go through the guard.
|
|
18
|
+
*/
|
|
19
|
+
/** Subcommands that spend funds, sign, or change wallet/order state, per command group. */
|
|
20
|
+
const WRITE_SUBCOMMANDS = {
|
|
21
|
+
swap: ["execute"],
|
|
22
|
+
"cross-chain": ["execute"],
|
|
23
|
+
gateway: ["broadcast"],
|
|
24
|
+
wallet: [
|
|
25
|
+
"send",
|
|
26
|
+
"contract-call",
|
|
27
|
+
"sign-message",
|
|
28
|
+
"logout",
|
|
29
|
+
"create", // `wallet inscription create`
|
|
30
|
+
"update-default-token", // `wallet gas-station ...`
|
|
31
|
+
"enable",
|
|
32
|
+
"disable",
|
|
33
|
+
"setup",
|
|
34
|
+
"unlock", // `wallet utxo ...`
|
|
35
|
+
"lock",
|
|
36
|
+
"reclaim",
|
|
37
|
+
],
|
|
38
|
+
strategy: ["create-limit", "cancel", "resume"],
|
|
39
|
+
payment: ["pay", "pay-local", "charge", "session", "subscription", "create"],
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Groups where almost everything signs, pays or broadcasts (the OKX.AI marketplace: create-task,
|
|
43
|
+
* confirm-accept, complete, refund-execute, apply, deliver, start-autorenew, ...). Listing the writes
|
|
44
|
+
* would miss each new subcommand, so here the reads are listed and anything else is a write.
|
|
45
|
+
*/
|
|
46
|
+
const READ_ONLY_SUBCOMMANDS = {
|
|
47
|
+
agent: new Set([
|
|
48
|
+
"help",
|
|
49
|
+
"get-my-agents",
|
|
50
|
+
"get-agents",
|
|
51
|
+
"my-agents",
|
|
52
|
+
"search",
|
|
53
|
+
"profile",
|
|
54
|
+
"service-list",
|
|
55
|
+
"service-match",
|
|
56
|
+
"service-detail",
|
|
57
|
+
"feedback-list",
|
|
58
|
+
"task-feedback",
|
|
59
|
+
"subscribe-detail",
|
|
60
|
+
"subscribe-cost",
|
|
61
|
+
"device-list",
|
|
62
|
+
"asp",
|
|
63
|
+
"asp-match",
|
|
64
|
+
"asp-claimable",
|
|
65
|
+
"task-service-select",
|
|
66
|
+
"task-create-prepare",
|
|
67
|
+
"prepare-create",
|
|
68
|
+
"designated-route",
|
|
69
|
+
"list-jobs-by-verified-sender",
|
|
70
|
+
"status",
|
|
71
|
+
"lifecycle",
|
|
72
|
+
"tasks",
|
|
73
|
+
"list",
|
|
74
|
+
"my-tasks",
|
|
75
|
+
"active-tasks",
|
|
76
|
+
"my-subscriptions",
|
|
77
|
+
"subscription-list",
|
|
78
|
+
"refund-list",
|
|
79
|
+
"refund-detail",
|
|
80
|
+
"refund-prepare",
|
|
81
|
+
"arbitration-list",
|
|
82
|
+
"arbitration-detail",
|
|
83
|
+
"gate-check",
|
|
84
|
+
"communication-check",
|
|
85
|
+
"system-config",
|
|
86
|
+
]),
|
|
87
|
+
};
|
|
88
|
+
/** Global flag whose value would otherwise be mistaken for a subcommand. */
|
|
89
|
+
const VALUE_FLAGS = new Set(["--chain"]);
|
|
90
|
+
function positionals(argv) {
|
|
91
|
+
const out = [];
|
|
92
|
+
for (let i = 0; i < argv.length; i++) {
|
|
93
|
+
const token = argv[i];
|
|
94
|
+
if (token === "--") {
|
|
95
|
+
out.push(...argv.slice(i + 1));
|
|
96
|
+
break;
|
|
97
|
+
}
|
|
98
|
+
if (token.startsWith("-")) {
|
|
99
|
+
if (VALUE_FLAGS.has(token))
|
|
100
|
+
i++;
|
|
101
|
+
continue;
|
|
102
|
+
}
|
|
103
|
+
out.push(token);
|
|
104
|
+
}
|
|
105
|
+
return out;
|
|
106
|
+
}
|
|
107
|
+
const isKnownGroup = (token) => token in WRITE_SUBCOMMANDS || token in READ_ONLY_SUBCOMMANDS;
|
|
108
|
+
/**
|
|
109
|
+
* True when the onchainos argv moves funds, signs, or changes orders.
|
|
110
|
+
*
|
|
111
|
+
* The group is the first positional that names a known command group, not simply the first
|
|
112
|
+
* positional: a global option that takes a value (`--output json wallet send`) leaves that value
|
|
113
|
+
* ahead of the group, and reading it as the group would let the write through. Any positional after
|
|
114
|
+
* the group that names a write subcommand counts, so a stray value ahead of the subcommand cannot
|
|
115
|
+
* hide it either.
|
|
116
|
+
*/
|
|
117
|
+
export function isOnchainosWriteCommand(argv) {
|
|
118
|
+
const tokens = positionals(argv).map((token) => token.toLowerCase());
|
|
119
|
+
const at = tokens.findIndex(isKnownGroup);
|
|
120
|
+
if (at < 0)
|
|
121
|
+
return false;
|
|
122
|
+
const group = tokens[at];
|
|
123
|
+
const rest = tokens.slice(at + 1);
|
|
124
|
+
const writes = WRITE_SUBCOMMANDS[group];
|
|
125
|
+
if (writes && rest.some((token) => writes.includes(token)))
|
|
126
|
+
return true;
|
|
127
|
+
const reads = READ_ONLY_SUBCOMMANDS[group];
|
|
128
|
+
const subcommand = rest[0];
|
|
129
|
+
return Boolean(reads && subcommand !== undefined && !reads.has(subcommand));
|
|
130
|
+
}
|
|
131
|
+
/** Name the Hyperliquid shims report as their tool; also the first token of an approved argv. */
|
|
132
|
+
export const HYPERLIQUID_GUARD_TOOL = "hyperliquid-plugin";
|
|
133
|
+
/** The names an agent may call the plugin by: the docs use the first two, the installer's real binary is the third. */
|
|
134
|
+
const HYPERLIQUID_SHIM_NAMES = ["hyperliquid-plugin", "hyperliquid", ".hyperliquid-plugin-core"];
|
|
135
|
+
/**
|
|
136
|
+
* Plugin subcommands that only read. Anything not listed is treated as a write, so a subcommand a
|
|
137
|
+
* later plugin release adds is held for approval instead of slipping through. `register` is not
|
|
138
|
+
* listed: it works out the signing address and may ask onchainos to sign.
|
|
139
|
+
*/
|
|
140
|
+
const HYPERLIQUID_READ_SUBCOMMANDS = new Set([
|
|
141
|
+
"quickstart",
|
|
142
|
+
"positions",
|
|
143
|
+
"orders",
|
|
144
|
+
"prices",
|
|
145
|
+
"markets",
|
|
146
|
+
"spot-balances",
|
|
147
|
+
"spot-prices",
|
|
148
|
+
"address",
|
|
149
|
+
"dex-list",
|
|
150
|
+
"outcome-list",
|
|
151
|
+
"outcome-positions",
|
|
152
|
+
"validators",
|
|
153
|
+
"staking-info",
|
|
154
|
+
"staking-rewards",
|
|
155
|
+
"unbonding",
|
|
156
|
+
"delegation-history",
|
|
157
|
+
"help",
|
|
158
|
+
]);
|
|
159
|
+
const HYPERLIQUID_INFO_FLAGS = new Set(["--version", "-V", "--help", "-h"]);
|
|
160
|
+
const HYPERLIQUID_ADAPTER_COMMANDS = new Set(["mogo-order", "mogo-setup"]);
|
|
161
|
+
/**
|
|
162
|
+
* Only the exact read probes may use a strict adapter command from a managed agent.
|
|
163
|
+
* Any leading option makes the subcommand position ambiguous, so check the remaining
|
|
164
|
+
* tokens for adapter commands before considering an argv approval.
|
|
165
|
+
*/
|
|
166
|
+
export function hyperliquidGuardPolicy(argv) {
|
|
167
|
+
const first = argv[0];
|
|
168
|
+
if (first === undefined || HYPERLIQUID_READ_SUBCOMMANDS.has(first))
|
|
169
|
+
return "read";
|
|
170
|
+
if (argv.length === 1 && HYPERLIQUID_INFO_FLAGS.has(first))
|
|
171
|
+
return "read";
|
|
172
|
+
if (HYPERLIQUID_ADAPTER_COMMANDS.has(first)) {
|
|
173
|
+
const probe = argv.length === 2 && (argv[1] === "--protocol" || (first === "mogo-setup" && argv[1] === "--check"));
|
|
174
|
+
return probe ? "read" : "adapter_only";
|
|
175
|
+
}
|
|
176
|
+
if (first.startsWith("-") && argv.some(token => HYPERLIQUID_ADAPTER_COMMANDS.has(token)))
|
|
177
|
+
return "adapter_only";
|
|
178
|
+
return "approval";
|
|
179
|
+
}
|
|
180
|
+
export function isHyperliquidWriteCommand(argv) {
|
|
181
|
+
return hyperliquidGuardPolicy(argv) !== "read";
|
|
182
|
+
}
|
|
183
|
+
export function sameArgv(a, b) {
|
|
184
|
+
return a.length === b.length && a.every((token, i) => token === b[i]);
|
|
185
|
+
}
|
|
186
|
+
export function isApprovedArgv(argv, approved) {
|
|
187
|
+
return approved.some((candidate) => sameArgv(candidate, argv));
|
|
188
|
+
}
|
|
189
|
+
/** Validates the `approvedCommands` task param: a list of argv arrays of strings. */
|
|
190
|
+
export function parseApprovedCommands(value) {
|
|
191
|
+
if (!Array.isArray(value))
|
|
192
|
+
return [];
|
|
193
|
+
return value
|
|
194
|
+
.filter((entry) => Array.isArray(entry) && entry.length > 0 && entry.every((t) => typeof t === "string"))
|
|
195
|
+
.slice(0, 20);
|
|
196
|
+
}
|
|
197
|
+
export const APPROVAL_ARTIFACT_NAME = "approval_required";
|
|
198
|
+
const COMMAND_WORD = /^[a-z][a-z0-9-]{0,31}$/i;
|
|
199
|
+
const CHAIN_VALUE = /^[A-Za-z0-9_-]{1,32}$/;
|
|
200
|
+
/**
|
|
201
|
+
* The command group, subcommand and `--chain` of an onchainos call, for showing progress. Arguments
|
|
202
|
+
* (addresses, amounts, tokens) are deliberately left out: the step goes to the dashboard as text
|
|
203
|
+
* and is not the place to copy a wallet address or an amount around. A token that does not look
|
|
204
|
+
* like a command name is dropped rather than shown.
|
|
205
|
+
*/
|
|
206
|
+
export function describeOnchainosCall(argv) {
|
|
207
|
+
const tokens = positionals(argv);
|
|
208
|
+
const at = tokens.findIndex((token) => isKnownGroup(token.toLowerCase()));
|
|
209
|
+
const words = (at >= 0 ? tokens.slice(at, at + 2) : tokens.slice(0, 2)).filter((token) => COMMAND_WORD.test(token));
|
|
210
|
+
if (words.length === 0)
|
|
211
|
+
return undefined;
|
|
212
|
+
let chain;
|
|
213
|
+
for (let i = 0; i < argv.length; i++) {
|
|
214
|
+
const token = argv[i];
|
|
215
|
+
const value = token === "--chain" ? argv[i + 1] : token.startsWith("--chain=") ? token.slice("--chain=".length) : undefined;
|
|
216
|
+
if (value !== undefined) {
|
|
217
|
+
chain = CHAIN_VALUE.test(value) ? value.toLowerCase() : undefined;
|
|
218
|
+
break;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
return { command: words.join(" ").toLowerCase(), ...(chain ? { chain } : {}) };
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* The step for a plugin call: the subcommand only. Its arguments (coin, size, price, order id) are
|
|
225
|
+
* left out for the same reason as above, and a first token that is not a command word is dropped.
|
|
226
|
+
*/
|
|
227
|
+
export function describeHyperliquidCall(argv) {
|
|
228
|
+
const first = argv[0];
|
|
229
|
+
return first !== undefined && COMMAND_WORD.test(first) ? { command: first.toLowerCase() } : undefined;
|
|
230
|
+
}
|
|
231
|
+
export function agentStepFromCall(call) {
|
|
232
|
+
const where = call.chain ? ` (${call.chain})` : "";
|
|
233
|
+
const tool = call.tool ?? "onchainos";
|
|
234
|
+
if (call.adapterOnly) {
|
|
235
|
+
return { kind: "command", command: call.command, message: `Blocked ${tool} ${call.command}. Use the dedicated Follow or account setup flow.` };
|
|
236
|
+
}
|
|
237
|
+
return call.blocked
|
|
238
|
+
? { kind: "approval", command: call.command, chain: call.chain, message: `Waiting for your approval to run ${tool} ${call.command}${where}` }
|
|
239
|
+
: { kind: "command", command: call.command, chain: call.chain, message: `Running ${tool} ${call.command}${where}` };
|
|
240
|
+
}
|
|
241
|
+
export const WRITE_BLOCKED_MESSAGE = "BLOCKED: this command moves funds or signs and needs the user's approval. It was recorded for the user to approve. " +
|
|
242
|
+
"Do not retry it, change it, or look for another way to run it. Stop now and tell the user, in your final answer, " +
|
|
243
|
+
"the exact command you intended to run and what it would do.";
|
|
244
|
+
const GUARD_BIN = fileURLToPath(new URL("./onchainos-guard-bin.js", import.meta.url));
|
|
245
|
+
const ZSH_DIR = "zdot";
|
|
246
|
+
/**
|
|
247
|
+
* zsh startup files that load the user's own (from LUMORA_REAL_ZDOTDIR, default $HOME) and then put
|
|
248
|
+
* the guard directory back at the front of PATH. One per file zsh may read, because which of them
|
|
249
|
+
* run depends on how the agent starts its shell (-c, -lc, -ic, -lic).
|
|
250
|
+
*/
|
|
251
|
+
function writeZshStartupFiles(zdot) {
|
|
252
|
+
mkdirSync(zdot, { recursive: true });
|
|
253
|
+
for (const name of [".zshenv", ".zprofile", ".zshrc", ".zlogin"]) {
|
|
254
|
+
writeFileSync(join(zdot, name), [
|
|
255
|
+
`[ -f "\${LUMORA_REAL_ZDOTDIR:-$HOME}/${name}" ] && . "\${LUMORA_REAL_ZDOTDIR:-$HOME}/${name}"`,
|
|
256
|
+
'if [ -n "$LUMORA_GUARD_DIR" ]; then PATH="${PATH//$LUMORA_GUARD_DIR:/}"; export PATH="$LUMORA_GUARD_DIR:$PATH"; fi',
|
|
257
|
+
"",
|
|
258
|
+
].join("\n"));
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
/** Returns null when the guard cannot be installed; `runWithWriteGuard` then refuses to start the agent. */
|
|
262
|
+
export function createWriteGuard(opts = {}) {
|
|
263
|
+
const baseEnv = opts.baseEnv ?? process.env;
|
|
264
|
+
if (!existsSync(GUARD_BIN))
|
|
265
|
+
return null;
|
|
266
|
+
let dir;
|
|
267
|
+
try {
|
|
268
|
+
dir = mkdtempSync(join(tmpdir(), "lumora-guard-"));
|
|
269
|
+
}
|
|
270
|
+
catch {
|
|
271
|
+
return null;
|
|
272
|
+
}
|
|
273
|
+
const cleanup = () => rmSync(dir, { recursive: true, force: true });
|
|
274
|
+
try {
|
|
275
|
+
// One shim per name an agent may call a guarded tool by. Each sets LUMORA_GUARD_TOOL so the one
|
|
276
|
+
// guard program knows which rules apply; the Hyperliquid names all report as the same tool.
|
|
277
|
+
const shims = [
|
|
278
|
+
{ name: "onchainos", tool: "onchainos" },
|
|
279
|
+
...HYPERLIQUID_SHIM_NAMES.map((name) => ({ name, tool: HYPERLIQUID_GUARD_TOOL })),
|
|
280
|
+
];
|
|
281
|
+
for (const { name, tool } of shims) {
|
|
282
|
+
const shim = join(dir, process.platform === "win32" ? `${name}.cmd` : name);
|
|
283
|
+
writeFileSync(shim, process.platform === "win32"
|
|
284
|
+
? `@echo off\r\nset "LUMORA_GUARD_TOOL=${tool}"\r\n"%LUMORA_GUARD_NODE%" "%LUMORA_GUARD_BIN%" %*\r\n`
|
|
285
|
+
: `#!/bin/sh\nLUMORA_GUARD_TOOL=${tool} exec "$LUMORA_GUARD_NODE" "$LUMORA_GUARD_BIN" "$@"\n`);
|
|
286
|
+
chmodSync(shim, 0o755);
|
|
287
|
+
}
|
|
288
|
+
writeFileSync(join(dir, "approved.json"), JSON.stringify(opts.approvedCommands ?? []));
|
|
289
|
+
writeFileSync(join(dir, "blocked.jsonl"), "");
|
|
290
|
+
writeFileSync(join(dir, "calls.jsonl"), "");
|
|
291
|
+
if (process.platform !== "win32")
|
|
292
|
+
writeZshStartupFiles(join(dir, ZSH_DIR));
|
|
293
|
+
}
|
|
294
|
+
catch {
|
|
295
|
+
cleanup();
|
|
296
|
+
return null;
|
|
297
|
+
}
|
|
298
|
+
const realBin = findOnchainosBinaries(baseEnv)[0];
|
|
299
|
+
const realHyperliquid = baseEnv.LUMORA_REAL_HYPERLIQUID || findHyperliquidBinaries(baseEnv)[0];
|
|
300
|
+
const basePath = baseEnv.PATH ?? "";
|
|
301
|
+
const blockedFile = join(dir, "blocked.jsonl");
|
|
302
|
+
const readBlocked = () => {
|
|
303
|
+
let raw = "";
|
|
304
|
+
try {
|
|
305
|
+
raw = readFileSync(blockedFile, "utf8");
|
|
306
|
+
}
|
|
307
|
+
catch {
|
|
308
|
+
return [];
|
|
309
|
+
}
|
|
310
|
+
const seen = new Set();
|
|
311
|
+
const out = [];
|
|
312
|
+
for (const line of raw.split("\n")) {
|
|
313
|
+
if (!line.trim())
|
|
314
|
+
continue;
|
|
315
|
+
try {
|
|
316
|
+
const argv = JSON.parse(line);
|
|
317
|
+
if (!Array.isArray(argv) || !argv.every((t) => typeof t === "string"))
|
|
318
|
+
continue;
|
|
319
|
+
const key = JSON.stringify(argv);
|
|
320
|
+
if (seen.has(key))
|
|
321
|
+
continue;
|
|
322
|
+
seen.add(key);
|
|
323
|
+
out.push(argv);
|
|
324
|
+
}
|
|
325
|
+
catch {
|
|
326
|
+
// A torn line from a killed process: ignore it.
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
return out;
|
|
330
|
+
};
|
|
331
|
+
return {
|
|
332
|
+
env: {
|
|
333
|
+
PATH: `${dir}${delimiter}${basePath}`,
|
|
334
|
+
// Agents run their commands through the user's shell, and the shell's startup files
|
|
335
|
+
// (zsh -i / -l read ~/.zshrc, ~/.zprofile, ...) put ~/.local/bin and friends in front of the
|
|
336
|
+
// PATH given here, so the real onchainos would be found before the shim. zsh reads its
|
|
337
|
+
// startup files from ZDOTDIR: pointing it at files that source the user's own and then put
|
|
338
|
+
// the shim first again keeps the shim ahead no matter what they do.
|
|
339
|
+
...(process.platform === "win32" ? {} : { ZDOTDIR: join(dir, ZSH_DIR), LUMORA_REAL_ZDOTDIR: baseEnv.ZDOTDIR || baseEnv.HOME || homedir() }),
|
|
340
|
+
LUMORA_GUARD_DIR: dir,
|
|
341
|
+
LUMORA_GUARD_NODE: process.execPath,
|
|
342
|
+
LUMORA_GUARD_BIN: GUARD_BIN,
|
|
343
|
+
...(realBin ? { LUMORA_REAL_ONCHAINOS: realBin } : {}),
|
|
344
|
+
...(realHyperliquid ? { LUMORA_REAL_HYPERLIQUID: realHyperliquid } : {}),
|
|
345
|
+
},
|
|
346
|
+
blocked: readBlocked,
|
|
347
|
+
watchCalls(onStep) {
|
|
348
|
+
const callsFile = join(dir, "calls.jsonl");
|
|
349
|
+
let offset = 0;
|
|
350
|
+
let partial = "";
|
|
351
|
+
const drain = () => {
|
|
352
|
+
let fd;
|
|
353
|
+
try {
|
|
354
|
+
fd = openSync(callsFile, "r");
|
|
355
|
+
const size = fstatSync(fd).size;
|
|
356
|
+
if (size <= offset)
|
|
357
|
+
return;
|
|
358
|
+
const buffer = Buffer.alloc(size - offset);
|
|
359
|
+
const read = readSync(fd, buffer, 0, buffer.length, offset);
|
|
360
|
+
offset += read;
|
|
361
|
+
const lines = (partial + buffer.subarray(0, read).toString("utf8")).split("\n");
|
|
362
|
+
partial = lines.pop() ?? "";
|
|
363
|
+
for (const line of lines) {
|
|
364
|
+
if (!line.trim())
|
|
365
|
+
continue;
|
|
366
|
+
try {
|
|
367
|
+
const call = JSON.parse(line);
|
|
368
|
+
if (typeof call.command !== "string")
|
|
369
|
+
continue;
|
|
370
|
+
onStep(agentStepFromCall({
|
|
371
|
+
command: call.command,
|
|
372
|
+
chain: typeof call.chain === "string" ? call.chain : undefined,
|
|
373
|
+
blocked: call.blocked === true,
|
|
374
|
+
adapterOnly: call.adapterOnly === true,
|
|
375
|
+
tool: call.tool === HYPERLIQUID_GUARD_TOOL ? HYPERLIQUID_GUARD_TOOL : undefined,
|
|
376
|
+
}));
|
|
377
|
+
}
|
|
378
|
+
catch {
|
|
379
|
+
// A torn or foreign line: skip it.
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
catch {
|
|
384
|
+
// The folder may already be gone; progress is best effort.
|
|
385
|
+
}
|
|
386
|
+
finally {
|
|
387
|
+
if (fd !== undefined)
|
|
388
|
+
closeSync(fd);
|
|
389
|
+
}
|
|
390
|
+
};
|
|
391
|
+
const timer = setInterval(drain, 400);
|
|
392
|
+
timer.unref();
|
|
393
|
+
return () => {
|
|
394
|
+
clearInterval(timer);
|
|
395
|
+
drain();
|
|
396
|
+
};
|
|
397
|
+
},
|
|
398
|
+
artifact() {
|
|
399
|
+
const blocked = readBlocked();
|
|
400
|
+
if (blocked.length === 0)
|
|
401
|
+
return undefined;
|
|
402
|
+
return { name: APPROVAL_ARTIFACT_NAME, mimeType: "application/json", metadata: { commands: blocked } };
|
|
403
|
+
},
|
|
404
|
+
cleanup,
|
|
405
|
+
};
|
|
406
|
+
}
|
|
407
|
+
/**
|
|
408
|
+
* Whether an agent run on this computer can be guarded right now. The daemon advertises it so the
|
|
409
|
+
* dashboard knows whether it may ask an agent to attempt a fund-moving command (and get it held for
|
|
410
|
+
* approval) or must forbid the command outright. Probes the real install and cleans up after itself.
|
|
411
|
+
*/
|
|
412
|
+
export function isWriteGuardAvailable(install = createWriteGuard) {
|
|
413
|
+
const guard = install();
|
|
414
|
+
if (!guard)
|
|
415
|
+
return false;
|
|
416
|
+
guard.cleanup();
|
|
417
|
+
return true;
|
|
418
|
+
}
|
|
419
|
+
/** Raised when the approval guard cannot be installed: running the agent anyway would drop it silently. */
|
|
420
|
+
export class WriteGuardUnavailableError extends Error {
|
|
421
|
+
constructor() {
|
|
422
|
+
super("The approval guard could not be installed on this computer, so the agent was not started: without it nothing would stop it from moving funds. " +
|
|
423
|
+
"Reinstall or rebuild the daemon so onchainos-guard-bin.js is present, and make sure the temp folder is writable. " +
|
|
424
|
+
"(Set LUMORA_ALLOW_UNGUARDED_AGENT=1 on the daemon only if you accept agents running without approval.)");
|
|
425
|
+
this.name = "WriteGuardUnavailableError";
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
/**
|
|
429
|
+
* Runs an agent with the guard installed and attaches the approval request (if the agent
|
|
430
|
+
* tried a fund-moving command) to the result. `run` receives the env to spawn the agent with.
|
|
431
|
+
* If the guard cannot be installed the agent is not started, unless the machine owner opted out
|
|
432
|
+
* with `LUMORA_ALLOW_UNGUARDED_AGENT=1`.
|
|
433
|
+
*/
|
|
434
|
+
export async function runWithWriteGuard(approvedCommands, run, options = {}) {
|
|
435
|
+
const guard = (options.install ?? createWriteGuard)({ approvedCommands: parseApprovedCommands(approvedCommands) });
|
|
436
|
+
if (!guard && process.env.LUMORA_ALLOW_UNGUARDED_AGENT !== "1") {
|
|
437
|
+
throw new WriteGuardUnavailableError();
|
|
438
|
+
}
|
|
439
|
+
const stopWatching = options.onStep ? guard?.watchCalls(options.onStep) : undefined;
|
|
440
|
+
try {
|
|
441
|
+
const result = await run(guard?.env ?? {});
|
|
442
|
+
stopWatching?.();
|
|
443
|
+
const artifact = guard?.artifact();
|
|
444
|
+
return artifact ? { ...result, artifacts: [...result.artifacts, artifact] } : result;
|
|
445
|
+
}
|
|
446
|
+
finally {
|
|
447
|
+
stopWatching?.();
|
|
448
|
+
guard?.cleanup();
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
//# sourceMappingURL=write-guard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"write-guard.js","sourceRoot":"","sources":["../src/write-guard.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,QAAQ,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACvJ,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAEhE;;;;;;;;;;;GAWG;AAEH,2FAA2F;AAC3F,MAAM,iBAAi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