@andrewkimjoseph/celina-sdk 0.5.1 → 0.6.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 +5 -0
- package/build/tools/catalog.d.ts +1 -1
- package/build/tools/catalog.js +2 -2
- package/build/tools/domains/aave.js +2 -2
- package/build/tools/domains/browser.d.ts +2 -0
- package/build/tools/domains/{celeste.js → browser.js} +4 -4
- package/build/tools/domains/{celeste.js.map → browser.js.map} +1 -1
- package/build/tools/domains/gooddollar.js +1 -1
- package/build/tools/domains/index.js +2 -2
- package/build/tools/domains/mento-fx.js +1 -1
- package/build/tools/domains/transaction.js +1 -1
- package/build/tools/domains/uniswap.js +1 -1
- package/build/tools/filter.js +1 -1
- package/build/tools/index.d.ts +1 -1
- package/build/tools/index.js +1 -1
- package/build/tools/types.d.ts +1 -1
- package/package.json +1 -1
- package/tests/testing-entry.ts +1 -1
- package/build/tools/domains/celeste.d.ts +0 -2
package/README.md
CHANGED
|
@@ -28,11 +28,16 @@ npm i @andrewkimjoseph/celina-sdk
|
|
|
28
28
|
|
|
29
29
|
Requires Node.js ≥ 20.
|
|
30
30
|
|
|
31
|
+
### LLM tool catalog (v0.5+)
|
|
32
|
+
|
|
33
|
+
For MCP servers and chat APIs (Vercel AI SDK, etc.), import shared tool definitions from `@andrewkimjoseph/celina-sdk/tools` instead of redefining schemas. See [LLM tool catalog](docs/guides/tool-catalog.md) — includes the recommended **`dynamicTool`** pattern so TypeScript does not OOM on large tool sets.
|
|
34
|
+
|
|
31
35
|
## Documentation
|
|
32
36
|
|
|
33
37
|
**Full docs:** [celina-sdk on GitBook](https://andrewkimjoseph.gitbook.io/celina-sdk)
|
|
34
38
|
|
|
35
39
|
- [Quick start](https://andrewkimjoseph.gitbook.io/celina-sdk/getting-started/quick-start)
|
|
40
|
+
- [LLM tool catalog](docs/guides/tool-catalog.md) — `@andrewkimjoseph/celina-sdk/tools` for MCP and AI SDK hosts
|
|
36
41
|
- [Architecture](docs/concepts/architecture.md) — client composition and stack
|
|
37
42
|
- [Prepared flows](docs/concepts/prepared-flows.md) — `SerializedPreparedFlow`, CELINA calldata tag
|
|
38
43
|
- [wagmi integration](https://andrewkimjoseph.gitbook.io/celina-sdk/guides/wagmi-integration)
|
package/build/tools/catalog.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { FilterToolsOptions, ToolDefinition, ToolFamily } from "./types.js"
|
|
|
2
2
|
export declare const ALL_TOOL_DEFINITIONS: ToolDefinition[];
|
|
3
3
|
export declare function getToolNames(options?: FilterToolsOptions): string[];
|
|
4
4
|
export declare function getMcpToolNames(options?: Omit<FilterToolsOptions, "surface">): string[];
|
|
5
|
-
export declare function
|
|
5
|
+
export declare function getBrowserToolNames(options?: Omit<FilterToolsOptions, "surface">): string[];
|
|
6
6
|
export declare function getToolsByFamily(family: ToolFamily): ToolDefinition[];
|
|
7
7
|
export declare function getToolDefinition(name: string): ToolDefinition | undefined;
|
|
8
8
|
export declare function assertSnakeCaseInputKeys(definition: ToolDefinition): void;
|
package/build/tools/catalog.js
CHANGED
|
@@ -7,8 +7,8 @@ export function getToolNames(options = {}) {
|
|
|
7
7
|
export function getMcpToolNames(options = {}) {
|
|
8
8
|
return getToolNames({ ...options, surface: "mcp" });
|
|
9
9
|
}
|
|
10
|
-
export function
|
|
11
|
-
return getToolNames({ ...options, surface: "
|
|
10
|
+
export function getBrowserToolNames(options = {}) {
|
|
11
|
+
return getToolNames({ ...options, surface: "browser" });
|
|
12
12
|
}
|
|
13
13
|
export function getToolsByFamily(family) {
|
|
14
14
|
return filterToolDefinitions(ALL_TOOL_DEFINITIONS, { families: [family] });
|
|
@@ -57,7 +57,7 @@ export const aaveToolDefinitions = [
|
|
|
57
57
|
from: optionalWalletAddressSchema,
|
|
58
58
|
}),
|
|
59
59
|
families: ["prepare"],
|
|
60
|
-
surfaces: ["
|
|
60
|
+
surfaces: ["browser"],
|
|
61
61
|
handler: async (runtime, input) => {
|
|
62
62
|
const sender = resolveWalletFromRuntime(runtime, {
|
|
63
63
|
from: input.from,
|
|
@@ -76,7 +76,7 @@ export const aaveToolDefinitions = [
|
|
|
76
76
|
from: optionalWalletAddressSchema,
|
|
77
77
|
}),
|
|
78
78
|
families: ["prepare"],
|
|
79
|
-
surfaces: ["
|
|
79
|
+
surfaces: ["browser"],
|
|
80
80
|
handler: async (runtime, input) => {
|
|
81
81
|
const sender = resolveWalletFromRuntime(runtime, {
|
|
82
82
|
from: input.from,
|
|
@@ -3,7 +3,7 @@ import { getSwapQuoteWithFallback, prepareSwapWithFallback, } from "../swap-rout
|
|
|
3
3
|
import { uniswapWalletSchema } from "../schemas/common.js";
|
|
4
4
|
import { normalizeRegistryTokenInput } from "../utils/normalize-token.js";
|
|
5
5
|
import { resolveWalletFromRuntime } from "../utils/wallet.js";
|
|
6
|
-
export const
|
|
6
|
+
export const browserToolDefinitions = [
|
|
7
7
|
{
|
|
8
8
|
name: "get_swap_quote",
|
|
9
9
|
description: "Best swap quote on Celo — tries Mento FX and Uniswap v4 in parallel.",
|
|
@@ -13,7 +13,7 @@ export const celesteToolDefinitions = [
|
|
|
13
13
|
amount: z.string(),
|
|
14
14
|
}),
|
|
15
15
|
families: ["read"],
|
|
16
|
-
surfaces: ["
|
|
16
|
+
surfaces: ["browser"],
|
|
17
17
|
handler: async (runtime, input) => {
|
|
18
18
|
const from = resolveWalletFromRuntime(runtime, {});
|
|
19
19
|
return getSwapQuoteWithFallback(runtime.celina, normalizeRegistryTokenInput(input.token_in), normalizeRegistryTokenInput(input.token_out), input.amount, from);
|
|
@@ -26,7 +26,7 @@ export const celesteToolDefinitions = [
|
|
|
26
26
|
protocol: z.enum(["mento_fx", "uniswap_v4"]).optional(),
|
|
27
27
|
}),
|
|
28
28
|
families: ["prepare"],
|
|
29
|
-
surfaces: ["
|
|
29
|
+
surfaces: ["browser"],
|
|
30
30
|
handler: async (runtime, input) => {
|
|
31
31
|
const sender = resolveWalletFromRuntime(runtime, {
|
|
32
32
|
from: input.from,
|
|
@@ -39,4 +39,4 @@ export const celesteToolDefinitions = [
|
|
|
39
39
|
},
|
|
40
40
|
},
|
|
41
41
|
];
|
|
42
|
-
//# sourceMappingURL=
|
|
42
|
+
//# sourceMappingURL=browser.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"
|
|
1
|
+
{"version":3,"file":"browser.js","sourceRoot":"","sources":["../../../src/tools/domains/browser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,wBAAwB,EACxB,uBAAuB,GAExB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAE3D,OAAO,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAC;AAC1E,OAAO,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAE9D,MAAM,CAAC,MAAM,sBAAsB,GAAqB;IACtD;QACE,IAAI,EAAE,gBAAgB;QACtB,WAAW,EACT,sEAAsE;QACxE,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC;YACpB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;YACpB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;YACrB,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;SACnB,CAAC;QACF,QAAQ,EAAE,CAAC,MAAM,CAAC;QAClB,QAAQ,EAAE,CAAC,SAAS,CAAC;QACrB,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE;YAChC,MAAM,IAAI,GAAG,wBAAwB,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;YACnD,OAAO,wBAAwB,CAC7B,OAAO,CAAC,MAAM,EACd,2BAA2B,CAAC,KAAK,CAAC,QAAkB,CAAC,EACrD,2BAA2B,CAAC,KAAK,CAAC,SAAmB,CAAC,EACtD,KAAK,CAAC,MAAgB,EACtB,IAAI,CACL,CAAC;QACJ,CAAC;KACF;IACD;QACE,IAAI,EAAE,cAAc;QACpB,WAAW,EACT,sEAAsE;QACxE,WAAW,EAAE,mBAAmB,CAAC,MAAM,CAAC;YACtC,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC,CAAC,QAAQ,EAAE;SACxD,CAAC;QACF,QAAQ,EAAE,CAAC,SAAS,CAAC;QACrB,QAAQ,EAAE,CAAC,SAAS,CAAC;QACrB,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE;YAChC,MAAM,MAAM,GAAG,wBAAwB,CAAC,OAAO,EAAE;gBAC/C,IAAI,EAAE,KAAK,CAAC,IAA0B;aACvC,CAAC,CAAC;YACH,OAAO,uBAAuB,CAC5B,OAAO,CAAC,MAAM,EACd,MAAM,EACN,2BAA2B,CAAC,KAAK,CAAC,QAAkB,CAAC,EACrD,2BAA2B,CAAC,KAAK,CAAC,SAAmB,CAAC,EACtD,KAAK,CAAC,MAAgB,EACtB;gBACE,SAAS,EAAE,KAAK,CAAC,SAAsC;gBACvD,iBAAiB,EAAE,KAAK,CAAC,kBAAwC;gBACjE,eAAe,EAAE,KAAK,CAAC,gBAAsC;aAC9D,EACD,KAAK,CAAC,QAAoC,CAC3C,CAAC;QACJ,CAAC;KACF;CACF,CAAC"}
|
|
@@ -61,7 +61,7 @@ export const gooddollarToolDefinitions = [
|
|
|
61
61
|
from: optionalWalletAddressSchema,
|
|
62
62
|
}),
|
|
63
63
|
families: ["prepare"],
|
|
64
|
-
surfaces: ["
|
|
64
|
+
surfaces: ["browser"],
|
|
65
65
|
handler: async (runtime, input) => {
|
|
66
66
|
const sender = resolveWalletFromRuntime(runtime, {
|
|
67
67
|
from: input.from,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { aaveToolDefinitions } from "./aave.js";
|
|
2
2
|
import { blockchainToolDefinitions } from "./blockchain.js";
|
|
3
3
|
import { carbonToolDefinitions } from "./carbon.js";
|
|
4
|
-
import {
|
|
4
|
+
import { browserToolDefinitions } from "./browser.js";
|
|
5
5
|
import { contractToolDefinitions } from "./contract.js";
|
|
6
6
|
import { ensToolDefinitions } from "./ens.js";
|
|
7
7
|
import { gooddollarToolDefinitions } from "./gooddollar.js";
|
|
@@ -28,6 +28,6 @@ export const allDomainToolDefinitions = [
|
|
|
28
28
|
...contractToolDefinitions,
|
|
29
29
|
...selfToolDefinitions,
|
|
30
30
|
...carbonToolDefinitions,
|
|
31
|
-
...
|
|
31
|
+
...browserToolDefinitions,
|
|
32
32
|
];
|
|
33
33
|
//# sourceMappingURL=index.js.map
|
|
@@ -60,7 +60,7 @@ export const mentoFxToolDefinitions = [
|
|
|
60
60
|
description: "Prepare Mento FX swap only. For general swaps after get_swap_quote, use prepare_swap.",
|
|
61
61
|
inputSchema: mentoFxWalletSchema,
|
|
62
62
|
families: ["prepare"],
|
|
63
|
-
surfaces: ["
|
|
63
|
+
surfaces: ["browser"],
|
|
64
64
|
handler: async (runtime, input) => {
|
|
65
65
|
const sender = resolveWalletFromRuntime(runtime, {
|
|
66
66
|
from: input.from,
|
|
@@ -66,7 +66,7 @@ export const transactionToolDefinitions = [
|
|
|
66
66
|
from: optionalWalletAddressSchema,
|
|
67
67
|
}),
|
|
68
68
|
families: ["prepare"],
|
|
69
|
-
surfaces: ["
|
|
69
|
+
surfaces: ["browser"],
|
|
70
70
|
handler: async (runtime, input) => {
|
|
71
71
|
const sender = resolveWalletFromRuntime(runtime, {
|
|
72
72
|
from: input.from,
|
|
@@ -60,7 +60,7 @@ export const uniswapToolDefinitions = [
|
|
|
60
60
|
description: "Prepare Uniswap v4 swap only. Prefer prepare_swap after get_swap_quote for automatic routing.",
|
|
61
61
|
inputSchema: uniswapWalletSchema,
|
|
62
62
|
families: ["prepare"],
|
|
63
|
-
surfaces: ["
|
|
63
|
+
surfaces: ["browser"],
|
|
64
64
|
handler: async (runtime, input) => {
|
|
65
65
|
const sender = resolveWalletFromRuntime(runtime, {
|
|
66
66
|
from: input.from,
|
package/build/tools/filter.js
CHANGED
|
@@ -3,7 +3,7 @@ const CARBON_EXECUTE_PREFIX = "execute_carbon_";
|
|
|
3
3
|
export function filterToolDefinitions(definitions, options = {}) {
|
|
4
4
|
return definitions.filter((def) => {
|
|
5
5
|
if (options.surface) {
|
|
6
|
-
const surfaces = def.surfaces ?? ["mcp", "
|
|
6
|
+
const surfaces = def.surfaces ?? ["mcp", "browser"];
|
|
7
7
|
if (!surfaces.includes(options.surface)) {
|
|
8
8
|
return false;
|
|
9
9
|
}
|
package/build/tools/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { ALL_TOOL_DEFINITIONS, getToolNames, getMcpToolNames,
|
|
1
|
+
export { ALL_TOOL_DEFINITIONS, getToolNames, getMcpToolNames, getBrowserToolNames, getToolsByFamily, getToolDefinition, validateToolCatalogSnakeCase, } from "./catalog.js";
|
|
2
2
|
export { filterToolDefinitions } from "./filter.js";
|
|
3
3
|
export { getSwapQuoteWithFallback, prepareSwapWithFallback, type SwapProtocol, type SwapQuoteResult, type SwapPrepareParams, } from "./swap-routing.js";
|
|
4
4
|
export * from "./schemas/common.js";
|
package/build/tools/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { ALL_TOOL_DEFINITIONS, getToolNames, getMcpToolNames,
|
|
1
|
+
export { ALL_TOOL_DEFINITIONS, getToolNames, getMcpToolNames, getBrowserToolNames, getToolsByFamily, getToolDefinition, validateToolCatalogSnakeCase, } from "./catalog.js";
|
|
2
2
|
export { filterToolDefinitions } from "./filter.js";
|
|
3
3
|
export { getSwapQuoteWithFallback, prepareSwapWithFallback, } from "./swap-routing.js";
|
|
4
4
|
export * from "./schemas/common.js";
|
package/build/tools/types.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { z } from "zod";
|
|
2
2
|
import type { CelinaClient } from "../index.js";
|
|
3
3
|
import type { CarbonWriteBody } from "../services/carbon.service.js";
|
|
4
|
-
export type ToolSurface = "mcp" | "
|
|
4
|
+
export type ToolSurface = "mcp" | "browser";
|
|
5
5
|
export type ToolFamily = "read" | "prepare" | "execute";
|
|
6
6
|
export type WalletInput = {
|
|
7
7
|
address?: string;
|
package/package.json
CHANGED
package/tests/testing-entry.ts
CHANGED