@ton-agent-kit/core 1.0.0 → 1.0.2

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.
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ton-agent-kit/core",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "Core SDK for TON Agent Kit — plugin system, wallet abstraction, agent class",
5
5
  "main": "src/index.ts",
6
6
  "types": "src/index.ts",
@@ -22,8 +22,19 @@
22
22
  "@ton/ton": ">=14.0.0",
23
23
  "@ton/core": ">=0.63.0"
24
24
  },
25
- "keywords": ["ton", "blockchain", "ai", "agent", "sdk"],
25
+ "keywords": [
26
+ "ton",
27
+ "blockchain",
28
+ "ai",
29
+ "agent",
30
+ "sdk"
31
+ ],
26
32
  "license": "MIT",
27
- "publishConfig": { "access": "public" },
28
- "repository": { "type": "git", "url": "https://github.com/Andy00L/ton-agent-kit.git" }
33
+ "publishConfig": {
34
+ "access": "public"
35
+ },
36
+ "repository": {
37
+ "type": "git",
38
+ "url": "https://github.com/Andy00L/ton-agent-kit.git"
39
+ }
29
40
  }
package/src/agent.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { readFileSync } from "fs";
2
+ import { toJSONSchema } from "zod";
2
3
  import { TonClient4 } from "@ton/ton";
3
4
  import { PluginRegistry } from "./plugin";
4
5
  import type {
@@ -202,6 +203,24 @@ export class TonAgentKit {
202
203
  return this.wallet.address.toString();
203
204
  }
204
205
 
206
+ /**
207
+ * Returns OpenAI-compatible function calling tools, ready to use with any LLM provider
208
+ * (OpenAI, Anthropic, Google, Groq, Mistral, OpenRouter, Together).
209
+ */
210
+ toAITools(): Array<{ type: "function"; function: { name: string; description: string; parameters: any } }> {
211
+ return this.getAvailableActions().map((action) => {
212
+ const { $schema, ...parameters } = toJSONSchema(action.schema);
213
+ return {
214
+ type: "function" as const,
215
+ function: {
216
+ name: action.name,
217
+ description: action.description,
218
+ parameters,
219
+ },
220
+ };
221
+ });
222
+ }
223
+
205
224
  // ============================================================
206
225
  // Autonomous Agent Loop
207
226
  // ============================================================
@@ -222,9 +241,8 @@ export class TonAgentKit {
222
241
  );
223
242
  }
224
243
 
225
- // Dynamic imports so the SDK works without these deps installed
244
+ // Dynamic import so the SDK works without openai installed
226
245
  const { default: OpenAI } = await import("openai");
227
- const { toJSONSchema } = await import("zod");
228
246
  const client = new OpenAI({ apiKey, baseURL });
229
247
 
230
248
  // Ensure plugins are initialized