opencode-froggy 0.12.0 → 1.0.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 +10 -9
- package/command/diff-summary.md +27 -8
- package/command/doc-changes.md +1 -0
- package/command/review-changes.md +1 -0
- package/command/review-pr.md +1 -0
- package/command/simplify-changes.md +1 -0
- package/dist/command-installer.d.ts +6 -0
- package/dist/command-installer.js +49 -0
- package/dist/command-installer.test.d.ts +1 -0
- package/dist/command-installer.test.js +58 -0
- package/dist/config-paths.d.ts +2 -0
- package/dist/config-paths.js +6 -0
- package/dist/config-paths.test.js +16 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.js +326 -259
- package/dist/index.test.js +3 -3
- package/dist/loaders.d.ts +2 -0
- package/dist/loaders.js +1 -0
- package/dist/session-children.d.ts +14 -0
- package/dist/session-children.js +27 -0
- package/dist/session-children.test.d.ts +1 -0
- package/dist/session-children.test.js +25 -0
- package/dist/skill-activation.js +1 -1
- package/dist/tools/agent-promote.d.ts +38 -11
- package/dist/tools/agent-promote.js +35 -33
- package/dist/tools/blockchain/eth-address-balance.d.ts +18 -8
- package/dist/tools/blockchain/eth-address-balance.js +15 -14
- package/dist/tools/blockchain/eth-address-txs.d.ts +22 -10
- package/dist/tools/blockchain/eth-address-txs.js +19 -18
- package/dist/tools/blockchain/eth-token-transfers.d.ts +22 -10
- package/dist/tools/blockchain/eth-token-transfers.js +19 -18
- package/dist/tools/blockchain/eth-transaction.d.ts +30 -14
- package/dist/tools/blockchain/eth-transaction.js +24 -21
- package/dist/tools/gitingest.d.ts +27 -15
- package/dist/tools/gitingest.js +28 -21
- package/dist/tools/index.d.ts +1 -1
- package/dist/tools/index.js +1 -1
- package/dist/tools/list-child-sessions.d.ts +11 -7
- package/dist/tools/list-child-sessions.js +22 -17
- package/dist/tools/pdf-to-markdown.d.ts +18 -8
- package/dist/tools/pdf-to-markdown.js +20 -13
- package/dist/tools/prompt-session.d.ts +26 -11
- package/dist/tools/prompt-session.js +23 -28
- package/package.json +13 -5
- package/tui.ts +24 -0
package/dist/loaders.d.ts
CHANGED
|
@@ -21,6 +21,7 @@ export interface CommandFrontmatter {
|
|
|
21
21
|
description: string;
|
|
22
22
|
agent?: string;
|
|
23
23
|
model?: string;
|
|
24
|
+
subagent?: boolean;
|
|
24
25
|
subtask?: boolean;
|
|
25
26
|
}
|
|
26
27
|
export interface CommandConfig {
|
|
@@ -28,6 +29,7 @@ export interface CommandConfig {
|
|
|
28
29
|
description?: string;
|
|
29
30
|
agent?: string;
|
|
30
31
|
model?: string;
|
|
32
|
+
subagent?: boolean;
|
|
31
33
|
subtask?: boolean;
|
|
32
34
|
}
|
|
33
35
|
export interface LoadedSkill {
|
package/dist/loaders.js
CHANGED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface ChildSessionInfo {
|
|
2
|
+
id: string;
|
|
3
|
+
parentID: string;
|
|
4
|
+
title?: string;
|
|
5
|
+
created: number;
|
|
6
|
+
updated: number;
|
|
7
|
+
}
|
|
8
|
+
export declare class ChildSessionTracker {
|
|
9
|
+
private childrenByParent;
|
|
10
|
+
trackChild(info: ChildSessionInfo): void;
|
|
11
|
+
removeSession(sessionID: string): void;
|
|
12
|
+
listChildren(parentID: string): ChildSessionInfo[];
|
|
13
|
+
lastChild(parentID: string): ChildSessionInfo | undefined;
|
|
14
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export class ChildSessionTracker {
|
|
2
|
+
childrenByParent = new Map();
|
|
3
|
+
trackChild(info) {
|
|
4
|
+
let children = this.childrenByParent.get(info.parentID);
|
|
5
|
+
if (!children) {
|
|
6
|
+
children = new Map();
|
|
7
|
+
this.childrenByParent.set(info.parentID, children);
|
|
8
|
+
}
|
|
9
|
+
children.set(info.id, info);
|
|
10
|
+
}
|
|
11
|
+
removeSession(sessionID) {
|
|
12
|
+
this.childrenByParent.delete(sessionID);
|
|
13
|
+
for (const children of this.childrenByParent.values()) {
|
|
14
|
+
children.delete(sessionID);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
listChildren(parentID) {
|
|
18
|
+
const children = this.childrenByParent.get(parentID);
|
|
19
|
+
if (!children)
|
|
20
|
+
return [];
|
|
21
|
+
return Array.from(children.values()).sort((a, b) => a.created - b.created);
|
|
22
|
+
}
|
|
23
|
+
lastChild(parentID) {
|
|
24
|
+
const list = this.listChildren(parentID);
|
|
25
|
+
return list.at(-1);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { describe, it, expect } from "vitest";
|
|
2
|
+
import { ChildSessionTracker } from "./session-children";
|
|
3
|
+
describe("ChildSessionTracker", () => {
|
|
4
|
+
it("should return empty list for unknown parent", () => {
|
|
5
|
+
expect(new ChildSessionTracker().listChildren("ses_unknown")).toEqual([]);
|
|
6
|
+
});
|
|
7
|
+
it("should track and list children in creation order", () => {
|
|
8
|
+
const tracker = new ChildSessionTracker();
|
|
9
|
+
tracker.trackChild({ id: "ses_b", parentID: "ses_a", created: 2, updated: 2 });
|
|
10
|
+
tracker.trackChild({ id: "ses_c", parentID: "ses_a", created: 1, updated: 3 });
|
|
11
|
+
expect(tracker.listChildren("ses_a").map((c) => c.id)).toEqual(["ses_c", "ses_b"]);
|
|
12
|
+
});
|
|
13
|
+
it("should return the last child", () => {
|
|
14
|
+
const tracker = new ChildSessionTracker();
|
|
15
|
+
tracker.trackChild({ id: "ses_b", parentID: "ses_a", created: 1, updated: 1 });
|
|
16
|
+
tracker.trackChild({ id: "ses_c", parentID: "ses_a", created: 2, updated: 2 });
|
|
17
|
+
expect(tracker.lastChild("ses_a")?.id).toBe("ses_c");
|
|
18
|
+
});
|
|
19
|
+
it("should remove sessions and their children", () => {
|
|
20
|
+
const tracker = new ChildSessionTracker();
|
|
21
|
+
tracker.trackChild({ id: "ses_b", parentID: "ses_a", created: 1, updated: 1 });
|
|
22
|
+
tracker.removeSession("ses_a");
|
|
23
|
+
expect(tracker.listChildren("ses_a")).toEqual([]);
|
|
24
|
+
});
|
|
25
|
+
});
|
package/dist/skill-activation.js
CHANGED
|
@@ -2,7 +2,7 @@ function formatTrigger(text) {
|
|
|
2
2
|
return text.replace(/\s+/g, " ").trim();
|
|
3
3
|
}
|
|
4
4
|
function buildSkillInstruction(skill) {
|
|
5
|
-
return `MANDATORY: Call skill({
|
|
5
|
+
return `MANDATORY: Call skill({ id: "${skill.name}" }) ${formatTrigger(skill.useWhen)}`;
|
|
6
6
|
}
|
|
7
7
|
export function buildSkillActivationBlock(skills) {
|
|
8
8
|
if (!Array.isArray(skills) || skills.length === 0)
|
|
@@ -1,19 +1,46 @@
|
|
|
1
|
-
import { type ToolContext } from "@opencode-ai/plugin";
|
|
2
|
-
import type { createOpencodeClient } from "@opencode-ai/sdk";
|
|
3
1
|
export { type AgentMode, VALID_GRADES, getPromotedAgents, setPromotedAgent, validateGrade, validateAgentName, } from "./agent-promote-core";
|
|
4
|
-
type Client = ReturnType<typeof createOpencodeClient>;
|
|
5
2
|
export interface AgentPromoteArgs {
|
|
6
3
|
name: string;
|
|
7
4
|
grade?: string;
|
|
8
5
|
}
|
|
9
|
-
|
|
6
|
+
interface AgentReader {
|
|
7
|
+
get(input: {
|
|
8
|
+
agentID: string;
|
|
9
|
+
}): Promise<{
|
|
10
|
+
data?: {
|
|
11
|
+
mode?: string;
|
|
12
|
+
};
|
|
13
|
+
} | {
|
|
14
|
+
mode?: string;
|
|
15
|
+
}>;
|
|
16
|
+
}
|
|
17
|
+
interface AgentReloader {
|
|
18
|
+
reload(): Promise<void>;
|
|
19
|
+
}
|
|
20
|
+
interface PluginStorage {
|
|
21
|
+
set(key: string, value: unknown): Promise<void>;
|
|
22
|
+
}
|
|
23
|
+
declare const STORAGE_KEY = "promoted-agents";
|
|
24
|
+
export declare function createAgentPromoteTool(agent: AgentReader, reloader: AgentReloader, storage: PluginStorage, pluginAgentNames: string[]): {
|
|
25
|
+
name: string;
|
|
10
26
|
description: string;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
27
|
+
input: {
|
|
28
|
+
type: string;
|
|
29
|
+
properties: {
|
|
30
|
+
name: {
|
|
31
|
+
type: string;
|
|
32
|
+
description: string;
|
|
33
|
+
};
|
|
34
|
+
grade: {
|
|
35
|
+
type: string;
|
|
36
|
+
description: string;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
required: string[];
|
|
40
|
+
additionalProperties: boolean;
|
|
14
41
|
};
|
|
15
|
-
execute(
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}, context: ToolContext): Promise<string>;
|
|
42
|
+
execute(input: unknown): Promise<{
|
|
43
|
+
content: string;
|
|
44
|
+
}>;
|
|
19
45
|
};
|
|
46
|
+
export { STORAGE_KEY as AGENT_PROMOTE_STORAGE_KEY };
|
|
@@ -1,48 +1,50 @@
|
|
|
1
|
-
import { tool } from "@opencode-ai/plugin";
|
|
2
1
|
import { log } from "../logger";
|
|
3
|
-
import { VALID_GRADES, setPromotedAgent, validateGrade, validateAgentName, } from "./agent-promote-core";
|
|
2
|
+
import { VALID_GRADES, getPromotedAgents, setPromotedAgent, validateGrade, validateAgentName, } from "./agent-promote-core";
|
|
4
3
|
export { VALID_GRADES, getPromotedAgents, setPromotedAgent, validateGrade, validateAgentName, } from "./agent-promote-core";
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
const STORAGE_KEY = "promoted-agents";
|
|
5
|
+
export function createAgentPromoteTool(agent, reloader, storage, pluginAgentNames) {
|
|
6
|
+
return {
|
|
7
|
+
name: "agent-promote",
|
|
7
8
|
description: "Change the type of an agent to primary, subagent or all",
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
input: {
|
|
10
|
+
type: "object",
|
|
11
|
+
properties: {
|
|
12
|
+
name: { type: "string", description: "Name of the agent" },
|
|
13
|
+
grade: {
|
|
14
|
+
type: "string",
|
|
15
|
+
description: "Target type: 'subagent', 'primary', or 'all' (default: primary)",
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
required: ["name"],
|
|
19
|
+
additionalProperties: false,
|
|
11
20
|
},
|
|
12
|
-
async execute(
|
|
21
|
+
async execute(input) {
|
|
22
|
+
const args = input;
|
|
13
23
|
const { name } = args;
|
|
14
24
|
const grade = args.grade?.trim() || "primary";
|
|
15
25
|
if (!validateGrade(grade)) {
|
|
16
|
-
return `Invalid grade "${grade}". Valid grades: ${VALID_GRADES.join(", ")}
|
|
26
|
+
return { content: `Invalid grade "${grade}". Valid grades: ${VALID_GRADES.join(", ")}` };
|
|
17
27
|
}
|
|
18
28
|
if (!validateAgentName(name, pluginAgentNames)) {
|
|
19
|
-
return
|
|
29
|
+
return {
|
|
30
|
+
content: `Agent "${name}" not found in this plugin. Available: ${pluginAgentNames.join(", ")}`,
|
|
31
|
+
};
|
|
20
32
|
}
|
|
21
|
-
const
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
if (
|
|
25
|
-
return `Agent "${name}" is already of type "${grade}"
|
|
33
|
+
const existing = await agent.get({ agentID: name });
|
|
34
|
+
const currentMode = existing.data?.mode
|
|
35
|
+
?? existing.mode;
|
|
36
|
+
if (currentMode === grade) {
|
|
37
|
+
return { content: `Agent "${name}" is already of type "${grade}"` };
|
|
26
38
|
}
|
|
27
39
|
setPromotedAgent(name, grade);
|
|
28
40
|
log("[agent-promote] Agent type changed", { name, grade });
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
});
|
|
36
|
-
setTimeout(() => {
|
|
37
|
-
void client.instance.dispose().catch((error) => {
|
|
38
|
-
log("[agent-promote] Delayed dispose failed", {
|
|
39
|
-
name,
|
|
40
|
-
grade,
|
|
41
|
-
error: String(error),
|
|
42
|
-
});
|
|
43
|
-
});
|
|
44
|
-
}, 0);
|
|
45
|
-
return `Agent "${name}" changed to type "${grade}". Use Tab or <leader>a to select it.`;
|
|
41
|
+
const record = {};
|
|
42
|
+
for (const [key, value] of getPromotedAgents())
|
|
43
|
+
record[key] = value;
|
|
44
|
+
await storage.set(STORAGE_KEY, record);
|
|
45
|
+
await reloader.reload();
|
|
46
|
+
return { content: `Agent "${name}" changed to type "${grade}".` };
|
|
46
47
|
},
|
|
47
|
-
}
|
|
48
|
+
};
|
|
48
49
|
}
|
|
50
|
+
export { STORAGE_KEY as AGENT_PROMOTE_STORAGE_KEY };
|
|
@@ -1,20 +1,30 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Tool to get Ethereum address balance
|
|
3
3
|
*/
|
|
4
|
-
import { type ToolContext } from "@opencode-ai/plugin";
|
|
5
4
|
export interface EthAddressBalanceArgs {
|
|
6
5
|
address: string;
|
|
7
6
|
chainId?: string;
|
|
8
7
|
}
|
|
9
8
|
export declare function getAddressBalance(address: string, chainId?: string): Promise<string>;
|
|
10
9
|
export declare const ethAddressBalanceTool: {
|
|
10
|
+
name: string;
|
|
11
11
|
description: string;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
input: {
|
|
13
|
+
type: string;
|
|
14
|
+
properties: {
|
|
15
|
+
address: {
|
|
16
|
+
type: string;
|
|
17
|
+
description: string;
|
|
18
|
+
};
|
|
19
|
+
chainId: {
|
|
20
|
+
type: string;
|
|
21
|
+
description: string;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
required: string[];
|
|
25
|
+
additionalProperties: boolean;
|
|
15
26
|
};
|
|
16
|
-
execute(
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}, context: ToolContext): Promise<string>;
|
|
27
|
+
execute(input: unknown): Promise<{
|
|
28
|
+
content: string;
|
|
29
|
+
}>;
|
|
20
30
|
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Tool to get Ethereum address balance
|
|
3
3
|
*/
|
|
4
|
-
import { tool } from "@opencode-ai/plugin";
|
|
5
4
|
import { EtherscanClient, EtherscanClientError, validateAddress } from "./etherscan-client";
|
|
6
5
|
import { formatBalance } from "./formatters";
|
|
7
6
|
import { CHAIN_ID_DESCRIPTION } from "./types";
|
|
@@ -11,27 +10,29 @@ export async function getAddressBalance(address, chainId) {
|
|
|
11
10
|
const balanceWei = await client.getBalance(address);
|
|
12
11
|
return formatBalance(address, balanceWei);
|
|
13
12
|
}
|
|
14
|
-
export const ethAddressBalanceTool =
|
|
13
|
+
export const ethAddressBalanceTool = {
|
|
14
|
+
name: "eth-address-balance",
|
|
15
15
|
description: "Get the ETH balance of an Ethereum address. " +
|
|
16
16
|
"Returns balance in both ETH and Wei.",
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
17
|
+
input: {
|
|
18
|
+
type: "object",
|
|
19
|
+
properties: {
|
|
20
|
+
address: { type: "string", description: "Ethereum address (0x...)" },
|
|
21
|
+
chainId: { type: "string", description: CHAIN_ID_DESCRIPTION },
|
|
22
|
+
},
|
|
23
|
+
required: ["address"],
|
|
24
|
+
additionalProperties: false,
|
|
25
25
|
},
|
|
26
|
-
async execute(
|
|
26
|
+
async execute(input) {
|
|
27
|
+
const args = input;
|
|
27
28
|
try {
|
|
28
|
-
return await getAddressBalance(args.address, args.chainId);
|
|
29
|
+
return { content: await getAddressBalance(args.address, args.chainId) };
|
|
29
30
|
}
|
|
30
31
|
catch (error) {
|
|
31
32
|
if (error instanceof EtherscanClientError) {
|
|
32
|
-
return `Error: ${error.message}
|
|
33
|
+
return { content: `Error: ${error.message}` };
|
|
33
34
|
}
|
|
34
35
|
throw error;
|
|
35
36
|
}
|
|
36
37
|
},
|
|
37
|
-
}
|
|
38
|
+
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Tool to list Ethereum transactions for an address
|
|
3
3
|
*/
|
|
4
|
-
import { type ToolContext } from "@opencode-ai/plugin";
|
|
5
4
|
export interface EthAddressTxsArgs {
|
|
6
5
|
address: string;
|
|
7
6
|
limit?: number;
|
|
@@ -9,15 +8,28 @@ export interface EthAddressTxsArgs {
|
|
|
9
8
|
}
|
|
10
9
|
export declare function getAddressTransactions(address: string, limit?: number, chainId?: string): Promise<string>;
|
|
11
10
|
export declare const ethAddressTxsTool: {
|
|
11
|
+
name: string;
|
|
12
12
|
description: string;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
input: {
|
|
14
|
+
type: string;
|
|
15
|
+
properties: {
|
|
16
|
+
address: {
|
|
17
|
+
type: string;
|
|
18
|
+
description: string;
|
|
19
|
+
};
|
|
20
|
+
limit: {
|
|
21
|
+
type: string;
|
|
22
|
+
description: string;
|
|
23
|
+
};
|
|
24
|
+
chainId: {
|
|
25
|
+
type: string;
|
|
26
|
+
description: string;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
required: string[];
|
|
30
|
+
additionalProperties: boolean;
|
|
17
31
|
};
|
|
18
|
-
execute(
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
chainId?: string | undefined;
|
|
22
|
-
}, context: ToolContext): Promise<string>;
|
|
32
|
+
execute(input: unknown): Promise<{
|
|
33
|
+
content: string;
|
|
34
|
+
}>;
|
|
23
35
|
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Tool to list Ethereum transactions for an address
|
|
3
3
|
*/
|
|
4
|
-
import { tool } from "@opencode-ai/plugin";
|
|
5
4
|
import { EtherscanClient, EtherscanClientError, validateAddress } from "./etherscan-client";
|
|
6
5
|
import { formatTransactionList } from "./formatters";
|
|
7
6
|
import { DEFAULT_TRANSACTION_LIMIT, CHAIN_ID_DESCRIPTION } from "./types";
|
|
@@ -11,31 +10,33 @@ export async function getAddressTransactions(address, limit = DEFAULT_TRANSACTIO
|
|
|
11
10
|
const transactions = await client.getTransactions(address, limit);
|
|
12
11
|
return formatTransactionList(address, transactions);
|
|
13
12
|
}
|
|
14
|
-
export const ethAddressTxsTool =
|
|
13
|
+
export const ethAddressTxsTool = {
|
|
14
|
+
name: "eth-address-txs",
|
|
15
15
|
description: "List Ethereum transactions for an address. " +
|
|
16
16
|
"Shows incoming and outgoing transactions with values, timestamps, and status.",
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
17
|
+
input: {
|
|
18
|
+
type: "object",
|
|
19
|
+
properties: {
|
|
20
|
+
address: { type: "string", description: "Ethereum address (0x...)" },
|
|
21
|
+
limit: {
|
|
22
|
+
type: "number",
|
|
23
|
+
description: `Maximum number of transactions to return (default: ${DEFAULT_TRANSACTION_LIMIT})`,
|
|
24
|
+
},
|
|
25
|
+
chainId: { type: "string", description: CHAIN_ID_DESCRIPTION },
|
|
26
|
+
},
|
|
27
|
+
required: ["address"],
|
|
28
|
+
additionalProperties: false,
|
|
29
29
|
},
|
|
30
|
-
async execute(
|
|
30
|
+
async execute(input) {
|
|
31
|
+
const args = input;
|
|
31
32
|
try {
|
|
32
|
-
return await getAddressTransactions(args.address, args.limit, args.chainId);
|
|
33
|
+
return { content: await getAddressTransactions(args.address, args.limit, args.chainId) };
|
|
33
34
|
}
|
|
34
35
|
catch (error) {
|
|
35
36
|
if (error instanceof EtherscanClientError) {
|
|
36
|
-
return `Error: ${error.message}
|
|
37
|
+
return { content: `Error: ${error.message}` };
|
|
37
38
|
}
|
|
38
39
|
throw error;
|
|
39
40
|
}
|
|
40
41
|
},
|
|
41
|
-
}
|
|
42
|
+
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Tool to list ERC-20 token transfers for an address
|
|
3
3
|
*/
|
|
4
|
-
import { type ToolContext } from "@opencode-ai/plugin";
|
|
5
4
|
export interface EthTokenTransfersArgs {
|
|
6
5
|
address: string;
|
|
7
6
|
limit?: number;
|
|
@@ -9,15 +8,28 @@ export interface EthTokenTransfersArgs {
|
|
|
9
8
|
}
|
|
10
9
|
export declare function getTokenTransfers(address: string, limit?: number, chainId?: string): Promise<string>;
|
|
11
10
|
export declare const ethTokenTransfersTool: {
|
|
11
|
+
name: string;
|
|
12
12
|
description: string;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
input: {
|
|
14
|
+
type: string;
|
|
15
|
+
properties: {
|
|
16
|
+
address: {
|
|
17
|
+
type: string;
|
|
18
|
+
description: string;
|
|
19
|
+
};
|
|
20
|
+
limit: {
|
|
21
|
+
type: string;
|
|
22
|
+
description: string;
|
|
23
|
+
};
|
|
24
|
+
chainId: {
|
|
25
|
+
type: string;
|
|
26
|
+
description: string;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
required: string[];
|
|
30
|
+
additionalProperties: boolean;
|
|
17
31
|
};
|
|
18
|
-
execute(
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
chainId?: string | undefined;
|
|
22
|
-
}, context: ToolContext): Promise<string>;
|
|
32
|
+
execute(input: unknown): Promise<{
|
|
33
|
+
content: string;
|
|
34
|
+
}>;
|
|
23
35
|
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Tool to list ERC-20 token transfers for an address
|
|
3
3
|
*/
|
|
4
|
-
import { tool } from "@opencode-ai/plugin";
|
|
5
4
|
import { EtherscanClient, EtherscanClientError, validateAddress } from "./etherscan-client";
|
|
6
5
|
import { formatTokenTransferList } from "./formatters";
|
|
7
6
|
import { DEFAULT_TRANSACTION_LIMIT, CHAIN_ID_DESCRIPTION } from "./types";
|
|
@@ -11,31 +10,33 @@ export async function getTokenTransfers(address, limit = DEFAULT_TRANSACTION_LIM
|
|
|
11
10
|
const transfers = await client.getTokenTransfers(address, limit);
|
|
12
11
|
return formatTokenTransferList(address, transfers);
|
|
13
12
|
}
|
|
14
|
-
export const ethTokenTransfersTool =
|
|
13
|
+
export const ethTokenTransfersTool = {
|
|
14
|
+
name: "eth-token-transfers",
|
|
15
15
|
description: "List ERC-20 token transfers for an Ethereum address. " +
|
|
16
16
|
"Shows token names, symbols, values, and transaction details.",
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
17
|
+
input: {
|
|
18
|
+
type: "object",
|
|
19
|
+
properties: {
|
|
20
|
+
address: { type: "string", description: "Ethereum address (0x...)" },
|
|
21
|
+
limit: {
|
|
22
|
+
type: "number",
|
|
23
|
+
description: `Maximum number of transfers to return (default: ${DEFAULT_TRANSACTION_LIMIT})`,
|
|
24
|
+
},
|
|
25
|
+
chainId: { type: "string", description: CHAIN_ID_DESCRIPTION },
|
|
26
|
+
},
|
|
27
|
+
required: ["address"],
|
|
28
|
+
additionalProperties: false,
|
|
29
29
|
},
|
|
30
|
-
async execute(
|
|
30
|
+
async execute(input) {
|
|
31
|
+
const args = input;
|
|
31
32
|
try {
|
|
32
|
-
return await getTokenTransfers(args.address, args.limit, args.chainId);
|
|
33
|
+
return { content: await getTokenTransfers(args.address, args.limit, args.chainId) };
|
|
33
34
|
}
|
|
34
35
|
catch (error) {
|
|
35
36
|
if (error instanceof EtherscanClientError) {
|
|
36
|
-
return `Error: ${error.message}
|
|
37
|
+
return { content: `Error: ${error.message}` };
|
|
37
38
|
}
|
|
38
39
|
throw error;
|
|
39
40
|
}
|
|
40
41
|
},
|
|
41
|
-
}
|
|
42
|
+
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Tool to get Ethereum transaction details by hash
|
|
3
3
|
*/
|
|
4
|
-
import { type ToolContext } from "@opencode-ai/plugin";
|
|
5
4
|
import { type TransactionDetails } from "./types";
|
|
6
5
|
export interface EthTransactionArgs {
|
|
7
6
|
hash: string;
|
|
@@ -16,19 +15,36 @@ export declare function getTransactionDetails(hash: string, chainId?: string, op
|
|
|
16
15
|
decodeLogs?: boolean;
|
|
17
16
|
}): Promise<TransactionDetails>;
|
|
18
17
|
export declare const ethTransactionTool: {
|
|
18
|
+
name: string;
|
|
19
19
|
description: string;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
input: {
|
|
21
|
+
type: string;
|
|
22
|
+
properties: {
|
|
23
|
+
hash: {
|
|
24
|
+
type: string;
|
|
25
|
+
description: string;
|
|
26
|
+
};
|
|
27
|
+
chainId: {
|
|
28
|
+
type: string;
|
|
29
|
+
description: string;
|
|
30
|
+
};
|
|
31
|
+
includeInternalTxs: {
|
|
32
|
+
type: string;
|
|
33
|
+
description: string;
|
|
34
|
+
};
|
|
35
|
+
includeTokenTransfers: {
|
|
36
|
+
type: string;
|
|
37
|
+
description: string;
|
|
38
|
+
};
|
|
39
|
+
decodeLogs: {
|
|
40
|
+
type: string;
|
|
41
|
+
description: string;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
required: string[];
|
|
45
|
+
additionalProperties: boolean;
|
|
26
46
|
};
|
|
27
|
-
execute(
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
includeInternalTxs?: boolean | undefined;
|
|
31
|
-
includeTokenTransfers?: boolean | undefined;
|
|
32
|
-
decodeLogs?: boolean | undefined;
|
|
33
|
-
}, context: ToolContext): Promise<string>;
|
|
47
|
+
execute(input: unknown): Promise<{
|
|
48
|
+
content: string;
|
|
49
|
+
}>;
|
|
34
50
|
};
|