@mantle-agent/cli 0.0.0-stage → 0.1.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 +51 -2
- package/dist/api.d.ts +22 -0
- package/dist/api.js +48 -0
- package/dist/api.js.map +1 -0
- package/dist/bin.d.ts +2 -0
- package/dist/bin.js +4 -0
- package/dist/bin.js.map +1 -0
- package/dist/cli.d.ts +6 -0
- package/dist/cli.js +277 -0
- package/dist/cli.js.map +1 -0
- package/dist/connect.d.ts +31 -0
- package/dist/connect.js +70 -0
- package/dist/connect.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp.d.ts +8 -0
- package/dist/mcp.js +32 -0
- package/dist/mcp.js.map +1 -0
- package/dist/proof.d.ts +2 -0
- package/dist/proof.js +3 -0
- package/dist/proof.js.map +1 -0
- package/dist/run.d.ts +24 -0
- package/dist/run.js +94 -0
- package/dist/run.js.map +1 -0
- package/dist/skill.d.ts +13 -0
- package/dist/skill.js +42 -0
- package/dist/skill.js.map +1 -0
- package/dist/store.d.ts +45 -0
- package/dist/store.js +64 -0
- package/dist/store.js.map +1 -0
- package/dist/tools.d.ts +141 -0
- package/dist/tools.js +259 -0
- package/dist/tools.js.map +1 -0
- package/package.json +51 -3
- package/skill/mantle-agent/SKILL.md +144 -0
package/dist/mcp.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp.js","sourceRoot":"","sources":["../src/mcp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,WAAW,IAAI,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EAAE,KAAK,EAAoB,MAAM,YAAY,CAAC;AAErD,MAAM,OAAO,GAAG,OAAO,CA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AAChB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,GAAgB;IAC/C,MAAM,eAAe,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,IAAI,oBAAoB,EAAE,CAAC,CAAC;AACjE,CAAC"}
|
package/dist/proof.d.ts
ADDED
package/dist/proof.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"proof.js","sourceRoot":"","sources":["../src/proof.ts"],"names":[],"mappings":"AAAA,oHAAoH;AACpH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,OAAe,EAAE,EAAE,CAAC,sBAAsB,OAAO,EAAE,CAAC"}
|
package/dist/run.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { AgentClient } from "@mantle-agent/client";
|
|
2
|
+
import type { Store } from "./store.js";
|
|
3
|
+
/**
|
|
4
|
+
* One scheduled run (PRD RUN-02/03): take the lease, run the host's agent command with the lease in its
|
|
5
|
+
* environment, kill it when the lease expires, report back. No lease → nothing runs (missed slots are skipped,
|
|
6
|
+
* never caught up).
|
|
7
|
+
*/
|
|
8
|
+
export declare function runScheduled(client: AgentClient, params: {
|
|
9
|
+
host: string;
|
|
10
|
+
command: string[];
|
|
11
|
+
emit: (event: object) => void;
|
|
12
|
+
}): Promise<number>;
|
|
13
|
+
/**
|
|
14
|
+
* Prints a cron entry (does not install it). Cron fires every few minutes; the server decides when a run is due,
|
|
15
|
+
* so the owner can change the interval or pause from the confirmation page without touching the machine.
|
|
16
|
+
*/
|
|
17
|
+
export declare function schedule(store: Store, params: {
|
|
18
|
+
host: string;
|
|
19
|
+
cli: string;
|
|
20
|
+
}): {
|
|
21
|
+
cron: string;
|
|
22
|
+
promptFile: string;
|
|
23
|
+
note: string;
|
|
24
|
+
};
|
package/dist/run.js
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { spawn } from "node:child_process";
|
|
2
|
+
import { existsSync, writeFileSync } from "node:fs";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
/**
|
|
5
|
+
* One scheduled run (PRD RUN-02/03): take the lease, run the host's agent command with the lease in its
|
|
6
|
+
* environment, kill it when the lease expires, report back. No lease → nothing runs (missed slots are skipped,
|
|
7
|
+
* never caught up).
|
|
8
|
+
*/
|
|
9
|
+
export async function runScheduled(client, params) {
|
|
10
|
+
const lease = await client.runtime.lease(params.host);
|
|
11
|
+
if (!lease.granted) {
|
|
12
|
+
params.emit({ event: "skipped", reason: lease.reason, nextRunAt: lease.nextRunAt });
|
|
13
|
+
return 0;
|
|
14
|
+
}
|
|
15
|
+
// The host received these commands; their effect (pause/resume/run-now) already happened server-side.
|
|
16
|
+
for (const c of lease.commands)
|
|
17
|
+
await client.runtime.ack(c.commandId);
|
|
18
|
+
params.emit({ event: "run", leaseId: lease.leaseId, expiresAt: lease.expiresAt, budget: lease.budget });
|
|
19
|
+
const [cmd, ...args] = params.command;
|
|
20
|
+
if (!cmd)
|
|
21
|
+
throw new Error("missing host command after --");
|
|
22
|
+
const child = spawn(cmd, args, {
|
|
23
|
+
stdio: ["ignore", "pipe", "inherit"],
|
|
24
|
+
env: {
|
|
25
|
+
...process.env,
|
|
26
|
+
MANTLE_AGENT_LEASE: lease.leaseId,
|
|
27
|
+
MANTLE_AGENT_RUN_EXPIRES: lease.expiresAt,
|
|
28
|
+
MANTLE_AGENT_RUN_BUDGET: JSON.stringify(lease.budget),
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
let output = "";
|
|
32
|
+
child.stdout.on("data", (d) => {
|
|
33
|
+
output += d.toString();
|
|
34
|
+
process.stderr.write(d); // keep our own stdout machine-readable
|
|
35
|
+
});
|
|
36
|
+
let timedOut = false;
|
|
37
|
+
const timer = setTimeout(() => {
|
|
38
|
+
timedOut = true;
|
|
39
|
+
child.kill("SIGTERM");
|
|
40
|
+
setTimeout(() => child.kill("SIGKILL"), 5_000).unref();
|
|
41
|
+
}, Math.max(0, new Date(lease.expiresAt).getTime() - Date.now()));
|
|
42
|
+
const code = await new Promise((resolve) => {
|
|
43
|
+
child.on("error", () => resolve(127));
|
|
44
|
+
child.on("close", (c) => resolve(c ?? 1));
|
|
45
|
+
});
|
|
46
|
+
clearTimeout(timer);
|
|
47
|
+
const llmCostUsd = costFrom(output);
|
|
48
|
+
const summary = `exit ${code}${timedOut ? " (lease expired)" : ""}`;
|
|
49
|
+
await client.runtime.complete(lease.leaseId, { summary, ...(llmCostUsd !== undefined ? { llmCostUsd } : {}) });
|
|
50
|
+
params.emit({ event: "completed", leaseId: lease.leaseId, exitCode: code, timedOut, ...(llmCostUsd !== undefined ? { llmCostUsd } : {}) });
|
|
51
|
+
return code;
|
|
52
|
+
}
|
|
53
|
+
/** Hosts that report spend in their JSON output (e.g. `claude -p --output-format json` → total_cost_usd). */
|
|
54
|
+
function costFrom(output) {
|
|
55
|
+
for (const line of output.trim().split("\n").reverse()) {
|
|
56
|
+
try {
|
|
57
|
+
const v = JSON.parse(line);
|
|
58
|
+
if (typeof v.total_cost_usd === "number")
|
|
59
|
+
return v.total_cost_usd;
|
|
60
|
+
}
|
|
61
|
+
catch {
|
|
62
|
+
// not JSON
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return undefined;
|
|
66
|
+
}
|
|
67
|
+
const HOST_COMMANDS = {
|
|
68
|
+
"claude-code": (p) => `claude -p "$(cat ${p})" --output-format json --allowedTools "mcp__mantle-agent__*"`,
|
|
69
|
+
codex: (p) => `codex exec "$(cat ${p})"`,
|
|
70
|
+
};
|
|
71
|
+
const DEFAULT_PROMPT = `You are running a scheduled session for the owner's Mantle Agent Account.
|
|
72
|
+
Follow the mantle-agent skill. Start with the \`status\` and \`runtime_status\` tools, decide whether a trade is
|
|
73
|
+
warranted under the owner's instructions below, trade within the remaining budget, and finish. If anything looks
|
|
74
|
+
wrong, call \`pause\` and explain why.
|
|
75
|
+
|
|
76
|
+
Owner instructions:
|
|
77
|
+
- (edit this file to describe your strategy)
|
|
78
|
+
`;
|
|
79
|
+
/**
|
|
80
|
+
* Prints a cron entry (does not install it). Cron fires every few minutes; the server decides when a run is due,
|
|
81
|
+
* so the owner can change the interval or pause from the confirmation page without touching the machine.
|
|
82
|
+
*/
|
|
83
|
+
export function schedule(store, params) {
|
|
84
|
+
const promptFile = join(store.dir, "run-prompt.md");
|
|
85
|
+
if (!existsSync(promptFile))
|
|
86
|
+
writeFileSync(promptFile, DEFAULT_PROMPT);
|
|
87
|
+
const hostCmd = HOST_COMMANDS[params.host]?.(promptFile) ?? "<your agent command, e.g. hermes run ...>";
|
|
88
|
+
return {
|
|
89
|
+
cron: `*/5 * * * * ${params.cli} run --host ${params.host} -- ${hostCmd} >> ${join(store.dir, "runs.log")} 2>&1`,
|
|
90
|
+
promptFile,
|
|
91
|
+
note: "Add this line with `crontab -e` (or the host's native scheduler). Edit the prompt file to set the strategy.",
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=run.js.map
|
package/dist/run.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run.js","sourceRoot":"","sources":["../src/run.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAIjC;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,MAAmB,EACnB,MAA0E;IAE1E,MAAM,KAAK,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACtD,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;QACnB,MAAM,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,CAAC,CAAC;QACpF,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AChH,UAAU;QACV,IAAI,EAAE,6GAA6G;KACpH,CAAC;AACJ,CAAC"}
|
package/dist/skill.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const SKILL_FILE: URL;
|
|
2
|
+
/**
|
|
3
|
+
* `mantle-agent install-skill`: copies the skill into a host's skills directory. Without `host`/`dir` it installs
|
|
4
|
+
* for every known host whose config directory exists. Hosts without a skills directory (Grok Bot, …) read
|
|
5
|
+
* `mantle-agent guide` instead.
|
|
6
|
+
*/
|
|
7
|
+
export declare function installSkill(params: {
|
|
8
|
+
host?: string;
|
|
9
|
+
dir?: string;
|
|
10
|
+
}): {
|
|
11
|
+
installed: string[];
|
|
12
|
+
skipped: string[];
|
|
13
|
+
};
|
package/dist/skill.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { copyFileSync, existsSync, mkdirSync } from "node:fs";
|
|
2
|
+
import { homedir } from "node:os";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
export const SKILL_FILE = new URL("../skill/mantle-agent/SKILL.md", import.meta.url);
|
|
5
|
+
/** Hosts that load skills from a directory of `<name>/SKILL.md` folders. */
|
|
6
|
+
const HOSTS = {
|
|
7
|
+
"claude-code": join(homedir(), ".claude", "skills"),
|
|
8
|
+
codex: join(homedir(), ".codex", "skills"),
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* `mantle-agent install-skill`: copies the skill into a host's skills directory. Without `host`/`dir` it installs
|
|
12
|
+
* for every known host whose config directory exists. Hosts without a skills directory (Grok Bot, …) read
|
|
13
|
+
* `mantle-agent guide` instead.
|
|
14
|
+
*/
|
|
15
|
+
export function installSkill(params) {
|
|
16
|
+
let targets;
|
|
17
|
+
if (params.dir)
|
|
18
|
+
targets = [["custom", params.dir]];
|
|
19
|
+
else if (params.host) {
|
|
20
|
+
const dir = HOSTS[params.host];
|
|
21
|
+
if (!dir)
|
|
22
|
+
throw new Error(`unknown host ${params.host}; use one of ${Object.keys(HOSTS).join(", ")} or --dir <skills dir>`);
|
|
23
|
+
targets = [[params.host, dir]];
|
|
24
|
+
}
|
|
25
|
+
else
|
|
26
|
+
targets = Object.entries(HOSTS);
|
|
27
|
+
const installed = [];
|
|
28
|
+
const skipped = [];
|
|
29
|
+
for (const [host, dir] of targets) {
|
|
30
|
+
// Only auto-install where the host is actually present (its config dir exists).
|
|
31
|
+
if (!params.dir && !params.host && !existsSync(join(dir, ".."))) {
|
|
32
|
+
skipped.push(host);
|
|
33
|
+
continue;
|
|
34
|
+
}
|
|
35
|
+
const target = join(dir, "mantle-agent");
|
|
36
|
+
mkdirSync(target, { recursive: true });
|
|
37
|
+
copyFileSync(SKILL_FILE, join(target, "SKILL.md"));
|
|
38
|
+
installed.push(join(target, "SKILL.md"));
|
|
39
|
+
}
|
|
40
|
+
return { installed, skipped };
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=skill.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skill.js","sourceRoot":"","sources":["../src/skill.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAC9D,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,gCAAgC,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAErF,4EAA4E;AAC5E,MAAM,KAAK,GAA2B;IACpC,aAAa,EAAE,IAAI,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,QAAQ,CAAC;IACnD,KAAK,EAAE,IAAI,CAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,QAAQ,CAAC;CAC3C,CAAC;AAEF;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAC,MAAuC;IAClE,IAAI,OAA2B,CAAC;IAChC,IAAI,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EAAE,SAAS,EAAE,OAAO,EAAE,CAAC;AAChC,CAAC"}
|
package/dist/store.d.ts
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { Claim } from "@mantle-agent/client";
|
|
2
|
+
export type CredentialKind = "trading" | "social" | "runtime";
|
|
3
|
+
export type Credentials = Record<CredentialKind, {
|
|
4
|
+
token: string;
|
|
5
|
+
expiresAt: string;
|
|
6
|
+
}>;
|
|
7
|
+
export type Config = {
|
|
8
|
+
apiUrl: string;
|
|
9
|
+
agentId?: string;
|
|
10
|
+
name?: string;
|
|
11
|
+
host?: string;
|
|
12
|
+
};
|
|
13
|
+
/** A claim started with `connect --no-wait` that the owner has not approved yet. */
|
|
14
|
+
export type PendingClaim = Claim & {
|
|
15
|
+
apiUrl: string;
|
|
16
|
+
name: string;
|
|
17
|
+
host: string;
|
|
18
|
+
proposalKey?: string | null;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Local state under MANTLE_AGENT_HOME (default ~/.mantle-agent): config, the agent's Ed25519 key and the API
|
|
22
|
+
* credentials. Secrets are written 0600 and never printed.
|
|
23
|
+
*/
|
|
24
|
+
export declare class Store {
|
|
25
|
+
readonly dir: string;
|
|
26
|
+
constructor(dir?: string);
|
|
27
|
+
private path;
|
|
28
|
+
private write;
|
|
29
|
+
private read;
|
|
30
|
+
config(): Config | null;
|
|
31
|
+
saveConfig(config: Config): void;
|
|
32
|
+
credentials(): Credentials | null;
|
|
33
|
+
saveCredentials(credentials: Credentials): void;
|
|
34
|
+
pendingClaim(): PendingClaim | null;
|
|
35
|
+
savePendingClaim(claim: PendingClaim | null): void;
|
|
36
|
+
/** The agent identity key; created on first use. Its public half is what the owner sees as a fingerprint. */
|
|
37
|
+
agentKey(): AgentKey;
|
|
38
|
+
}
|
|
39
|
+
export type AgentKey = {
|
|
40
|
+
publicKey: string;
|
|
41
|
+
fingerprint: string;
|
|
42
|
+
sign(message: string): string;
|
|
43
|
+
};
|
|
44
|
+
/** Same algorithm as the server; computed locally so the user compares against something the server did not send. */
|
|
45
|
+
export declare function fingerprintOf(publicKeyHex: string): string;
|
package/dist/store.js
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { createHash, createPrivateKey, createPublicKey, generateKeyPairSync, sign } from "node:crypto";
|
|
2
|
+
import { chmodSync, existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
3
|
+
import { homedir } from "node:os";
|
|
4
|
+
import { join } from "node:path";
|
|
5
|
+
/**
|
|
6
|
+
* Local state under MANTLE_AGENT_HOME (default ~/.mantle-agent): config, the agent's Ed25519 key and the API
|
|
7
|
+
* credentials. Secrets are written 0600 and never printed.
|
|
8
|
+
*/
|
|
9
|
+
export class Store {
|
|
10
|
+
dir;
|
|
11
|
+
constructor(dir = process.env.MANTLE_AGENT_HOME ?? join(homedir(), ".mantle-agent")) {
|
|
12
|
+
this.dir = dir;
|
|
13
|
+
}
|
|
14
|
+
path(name) {
|
|
15
|
+
return join(this.dir, name);
|
|
16
|
+
}
|
|
17
|
+
write(name, content, secret) {
|
|
18
|
+
mkdirSync(this.dir, { recursive: true, mode: 0o700 });
|
|
19
|
+
writeFileSync(this.path(name), content, { mode: secret ? 0o600 : 0o644 });
|
|
20
|
+
if (secret)
|
|
21
|
+
chmodSync(this.path(name), 0o600);
|
|
22
|
+
}
|
|
23
|
+
read(name) {
|
|
24
|
+
return existsSync(this.path(name)) ? JSON.parse(readFileSync(this.path(name), "utf8")) : null;
|
|
25
|
+
}
|
|
26
|
+
config() {
|
|
27
|
+
return this.read("config.json");
|
|
28
|
+
}
|
|
29
|
+
saveConfig(config) {
|
|
30
|
+
this.write("config.json", JSON.stringify(config, null, 2), false);
|
|
31
|
+
}
|
|
32
|
+
credentials() {
|
|
33
|
+
return this.read("credentials.json");
|
|
34
|
+
}
|
|
35
|
+
saveCredentials(credentials) {
|
|
36
|
+
this.write("credentials.json", JSON.stringify(credentials, null, 2), true);
|
|
37
|
+
}
|
|
38
|
+
pendingClaim() {
|
|
39
|
+
return this.read("pending-claim.json");
|
|
40
|
+
}
|
|
41
|
+
savePendingClaim(claim) {
|
|
42
|
+
if (claim)
|
|
43
|
+
this.write("pending-claim.json", JSON.stringify(claim, null, 2), false);
|
|
44
|
+
else
|
|
45
|
+
rmSync(this.path("pending-claim.json"), { force: true });
|
|
46
|
+
}
|
|
47
|
+
/** The agent identity key; created on first use. Its public half is what the owner sees as a fingerprint. */
|
|
48
|
+
agentKey() {
|
|
49
|
+
const file = this.path("agent-key.pem");
|
|
50
|
+
if (!existsSync(file)) {
|
|
51
|
+
const { privateKey } = generateKeyPairSync("ed25519");
|
|
52
|
+
this.write("agent-key.pem", privateKey.export({ format: "pem", type: "pkcs8" }).toString(), true);
|
|
53
|
+
}
|
|
54
|
+
const privateKey = createPrivateKey(readFileSync(file));
|
|
55
|
+
const publicKey = createPublicKey(privateKey).export({ format: "der", type: "spki" }).subarray(12).toString("hex");
|
|
56
|
+
return { publicKey, fingerprint: fingerprintOf(publicKey), sign: (message) => sign(null, Buffer.from(message), privateKey).toString("hex") };
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
/** Same algorithm as the server; computed locally so the user compares against something the server did not send. */
|
|
60
|
+
export function fingerprintOf(publicKeyHex) {
|
|
61
|
+
const digest = createHash("sha256").update(Buffer.from(publicKeyHex, "hex")).digest("hex").slice(0, 16);
|
|
62
|
+
return digest.match(/.{4}/g).join("-");
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store.js","sourceRoot":"","sources":["../src/store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,eAAe,EAAE,mBAAmB,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACvG,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,SAAS,C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E,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QACnH,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,aAAa,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,UAAU,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;IAC/I,CAAC;CACF;AAID,qHAAqH;AACrH,MAAM,UAAU,aAAa,CAAC,YAAoB;IAChD,MAAM,MAAM,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IACxG,OAAO,MAAM,CAAC,KAAK,CAAC,OAAO,CAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC1C,CAAC"}
|
package/dist/tools.d.ts
ADDED
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { type AgentClient, type SessionLimits } from "@mantle-agent/client";
|
|
3
|
+
export type ToolContext = {
|
|
4
|
+
/** The SDK client; its `leaseId` (from MANTLE_AGENT_LEASE under `mantle-agent run`) charges trades to the run. */
|
|
5
|
+
client: AgentClient;
|
|
6
|
+
};
|
|
7
|
+
/** One capability, exposed identically as a CLI command and an MCP tool (PRD RUN-01). */
|
|
8
|
+
export type Tool<S extends z.ZodRawShape = z.ZodRawShape> = {
|
|
9
|
+
name: string;
|
|
10
|
+
title: string;
|
|
11
|
+
description: string;
|
|
12
|
+
input: S;
|
|
13
|
+
run(ctx: ToolContext, input: z.infer<z.ZodObject<S>>): Promise<unknown>;
|
|
14
|
+
};
|
|
15
|
+
export declare const statusTool: Tool<{}>;
|
|
16
|
+
export declare const quoteTool: Tool<{
|
|
17
|
+
side: z.ZodEnum<{
|
|
18
|
+
buy: "buy";
|
|
19
|
+
sell: "sell";
|
|
20
|
+
}>;
|
|
21
|
+
token: z.ZodString;
|
|
22
|
+
amount: z.ZodString;
|
|
23
|
+
unit: z.ZodOptional<z.ZodEnum<{
|
|
24
|
+
ether: "ether";
|
|
25
|
+
wei: "wei";
|
|
26
|
+
}>>;
|
|
27
|
+
}>;
|
|
28
|
+
export declare const tradeTool: Tool<{
|
|
29
|
+
side: z.ZodEnum<{
|
|
30
|
+
buy: "buy";
|
|
31
|
+
sell: "sell";
|
|
32
|
+
}>;
|
|
33
|
+
token: z.ZodString;
|
|
34
|
+
amount: z.ZodString;
|
|
35
|
+
unit: z.ZodOptional<z.ZodEnum<{
|
|
36
|
+
ether: "ether";
|
|
37
|
+
wei: "wei";
|
|
38
|
+
}>>;
|
|
39
|
+
requestId: z.ZodOptional<z.ZodString>;
|
|
40
|
+
wait: z.ZodOptional<z.ZodBoolean>;
|
|
41
|
+
}>;
|
|
42
|
+
export declare const tradeStatusTool: Tool<{
|
|
43
|
+
intentId: z.ZodString;
|
|
44
|
+
}>;
|
|
45
|
+
export declare const stopTool: Tool<{}>;
|
|
46
|
+
export declare const runtimeStatusTool: Tool<{}>;
|
|
47
|
+
export declare const pauseTool: Tool<{}>;
|
|
48
|
+
export declare const limitsInput: {
|
|
49
|
+
perTrade: z.ZodOptional<z.ZodString>;
|
|
50
|
+
period: z.ZodOptional<z.ZodString>;
|
|
51
|
+
periodHours: z.ZodOptional<z.ZodNumber>;
|
|
52
|
+
total: z.ZodOptional<z.ZodString>;
|
|
53
|
+
days: z.ZodOptional<z.ZodNumber>;
|
|
54
|
+
slippagePercent: z.ZodOptional<z.ZodNumber>;
|
|
55
|
+
};
|
|
56
|
+
export declare function limitsFrom(i: {
|
|
57
|
+
perTrade?: string;
|
|
58
|
+
period?: string;
|
|
59
|
+
periodHours?: number;
|
|
60
|
+
total?: string;
|
|
61
|
+
days?: number;
|
|
62
|
+
slippagePercent?: number;
|
|
63
|
+
}): SessionLimits;
|
|
64
|
+
export declare const requestAuthorizeTool: Tool<{
|
|
65
|
+
perTrade: z.ZodOptional<z.ZodString>;
|
|
66
|
+
period: z.ZodOptional<z.ZodString>;
|
|
67
|
+
periodHours: z.ZodOptional<z.ZodNumber>;
|
|
68
|
+
total: z.ZodOptional<z.ZodString>;
|
|
69
|
+
days: z.ZodOptional<z.ZodNumber>;
|
|
70
|
+
slippagePercent: z.ZodOptional<z.ZodNumber>;
|
|
71
|
+
}>;
|
|
72
|
+
export declare const requestRenewTool: Tool<{
|
|
73
|
+
days: z.ZodNumber;
|
|
74
|
+
}>;
|
|
75
|
+
export declare const requestRevokeTool: Tool<{}>;
|
|
76
|
+
export declare const requestWithdrawTool: Tool<{
|
|
77
|
+
asset: z.ZodUnion<readonly [z.ZodLiteral<"MNT">, z.ZodString]>;
|
|
78
|
+
amount: z.ZodUnion<readonly [z.ZodLiteral<"all">, z.ZodString]>;
|
|
79
|
+
to: z.ZodString;
|
|
80
|
+
}>;
|
|
81
|
+
export declare const requestAutoRunTool: Tool<{
|
|
82
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
83
|
+
everyHours: z.ZodOptional<z.ZodNumber>;
|
|
84
|
+
maxTradesPerRun: z.ZodOptional<z.ZodNumber>;
|
|
85
|
+
maxTradesPerDay: z.ZodOptional<z.ZodNumber>;
|
|
86
|
+
maxSpendPerDay: z.ZodOptional<z.ZodString>;
|
|
87
|
+
maxLlmUsdPerDay: z.ZodOptional<z.ZodNumber>;
|
|
88
|
+
}>;
|
|
89
|
+
export declare const requestResumeTool: Tool<{}>;
|
|
90
|
+
export declare const requestStatusTool: Tool<{
|
|
91
|
+
requestId: z.ZodOptional<z.ZodString>;
|
|
92
|
+
}>;
|
|
93
|
+
export declare const tools: readonly [Tool<{}>, Tool<{
|
|
94
|
+
side: z.ZodEnum<{
|
|
95
|
+
buy: "buy";
|
|
96
|
+
sell: "sell";
|
|
97
|
+
}>;
|
|
98
|
+
token: z.ZodString;
|
|
99
|
+
amount: z.ZodString;
|
|
100
|
+
unit: z.ZodOptional<z.ZodEnum<{
|
|
101
|
+
ether: "ether";
|
|
102
|
+
wei: "wei";
|
|
103
|
+
}>>;
|
|
104
|
+
}>, Tool<{
|
|
105
|
+
side: z.ZodEnum<{
|
|
106
|
+
buy: "buy";
|
|
107
|
+
sell: "sell";
|
|
108
|
+
}>;
|
|
109
|
+
token: z.ZodString;
|
|
110
|
+
amount: z.ZodString;
|
|
111
|
+
unit: z.ZodOptional<z.ZodEnum<{
|
|
112
|
+
ether: "ether";
|
|
113
|
+
wei: "wei";
|
|
114
|
+
}>>;
|
|
115
|
+
requestId: z.ZodOptional<z.ZodString>;
|
|
116
|
+
wait: z.ZodOptional<z.ZodBoolean>;
|
|
117
|
+
}>, Tool<{
|
|
118
|
+
intentId: z.ZodString;
|
|
119
|
+
}>, Tool<{}>, Tool<{}>, Tool<{}>, Tool<{
|
|
120
|
+
perTrade: z.ZodOptional<z.ZodString>;
|
|
121
|
+
period: z.ZodOptional<z.ZodString>;
|
|
122
|
+
periodHours: z.ZodOptional<z.ZodNumber>;
|
|
123
|
+
total: z.ZodOptional<z.ZodString>;
|
|
124
|
+
days: z.ZodOptional<z.ZodNumber>;
|
|
125
|
+
slippagePercent: z.ZodOptional<z.ZodNumber>;
|
|
126
|
+
}>, Tool<{
|
|
127
|
+
days: z.ZodNumber;
|
|
128
|
+
}>, Tool<{}>, Tool<{
|
|
129
|
+
asset: z.ZodUnion<readonly [z.ZodLiteral<"MNT">, z.ZodString]>;
|
|
130
|
+
amount: z.ZodUnion<readonly [z.ZodLiteral<"all">, z.ZodString]>;
|
|
131
|
+
to: z.ZodString;
|
|
132
|
+
}>, Tool<{
|
|
133
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
134
|
+
everyHours: z.ZodOptional<z.ZodNumber>;
|
|
135
|
+
maxTradesPerRun: z.ZodOptional<z.ZodNumber>;
|
|
136
|
+
maxTradesPerDay: z.ZodOptional<z.ZodNumber>;
|
|
137
|
+
maxSpendPerDay: z.ZodOptional<z.ZodString>;
|
|
138
|
+
maxLlmUsdPerDay: z.ZodOptional<z.ZodNumber>;
|
|
139
|
+
}>, Tool<{}>, Tool<{
|
|
140
|
+
requestId: z.ZodOptional<z.ZodString>;
|
|
141
|
+
}>];
|