From b865682bdb2bf4fa1675fe8107dfacf6c082ab9f Mon Sep 17 00:00:00 2001 From: Travis Fischer Date: Sat, 28 Jun 2025 23:39:23 -0500 Subject: [PATCH] feat: more refactoring work --- examples/tavily/readme.md | 24 --------------- legacy/packages/mcp/readme.md | 24 --------------- packages/ai-sdk/package.json | 3 +- packages/ai-sdk/readme.md | 24 --------------- packages/ai-sdk/src/ai-sdk.ts | 25 ++++++++++++++-- packages/core/readme.md | 24 --------------- packages/genkit/readme.md | 24 --------------- packages/json-schema/license | 21 +++++++++++++ packages/langchain/readme.md | 24 --------------- packages/llamaindex/readme.md | 24 --------------- packages/mastra/readme.md | 24 --------------- .../packages => packages}/mcp/package.json | 30 ++++++++++--------- .../packages => packages}/mcp/src/index.ts | 0 .../mcp/src/mcp-tools.ts | 0 .../packages => packages}/mcp/src/paginate.ts | 0 .../packages => packages}/mcp/src/types.ts | 0 .../packages => packages}/mcp/tsconfig.json | 0 packages/tool-client/package.json | 2 +- .../tool-client/src/agentic-tool-client.ts | 21 ++++++------- packages/xsai/readme.md | 24 --------------- pnpm-lock.yaml | 19 ++++++++++-- todo.md | 5 ++++ 22 files changed, 94 insertions(+), 248 deletions(-) delete mode 100644 examples/tavily/readme.md delete mode 100644 legacy/packages/mcp/readme.md delete mode 100644 packages/ai-sdk/readme.md delete mode 100644 packages/core/readme.md delete mode 100644 packages/genkit/readme.md create mode 100644 packages/json-schema/license delete mode 100644 packages/langchain/readme.md delete mode 100644 packages/llamaindex/readme.md delete mode 100644 packages/mastra/readme.md rename {legacy/packages => packages}/mcp/package.json (61%) rename {legacy/packages => packages}/mcp/src/index.ts (100%) rename {legacy/packages => packages}/mcp/src/mcp-tools.ts (100%) rename {legacy/packages => packages}/mcp/src/paginate.ts (100%) rename {legacy/packages => packages}/mcp/src/types.ts (100%) rename {legacy/packages => packages}/mcp/tsconfig.json (100%) delete mode 100644 packages/xsai/readme.md diff --git a/examples/tavily/readme.md b/examples/tavily/readme.md deleted file mode 100644 index 38781f32..00000000 --- a/examples/tavily/readme.md +++ /dev/null @@ -1,24 +0,0 @@ -

- - Agentic - -

- -

- AI agent stdlib that works with any LLM and TypeScript AI SDK. -

- -

- Build Status - NPM - MIT License - Prettier Code Formatting -

- -# Agentic - -**See the [github repo](https://github.com/transitive-bullshit/agentic) or [docs](https://agentic.so) for more info.** - -## License - -MIT © [Travis Fischer](https://x.com/transitive_bs) diff --git a/legacy/packages/mcp/readme.md b/legacy/packages/mcp/readme.md deleted file mode 100644 index 38781f32..00000000 --- a/legacy/packages/mcp/readme.md +++ /dev/null @@ -1,24 +0,0 @@ -

- - Agentic - -

- -

- AI agent stdlib that works with any LLM and TypeScript AI SDK. -

- -

- Build Status - NPM - MIT License - Prettier Code Formatting -

- -# Agentic - -**See the [github repo](https://github.com/transitive-bullshit/agentic) or [docs](https://agentic.so) for more info.** - -## License - -MIT © [Travis Fischer](https://x.com/transitive_bs) diff --git a/packages/ai-sdk/package.json b/packages/ai-sdk/package.json index 1ad2477f..dac7592a 100644 --- a/packages/ai-sdk/package.json +++ b/packages/ai-sdk/package.json @@ -24,7 +24,8 @@ "test:unit": "vitest run" }, "dependencies": { - "@agentic/core": "workspace:*" + "@agentic/core": "workspace:*", + "@agentic/platform-tool-client": "workspace:*" }, "peerDependencies": { "ai": "catalog:" diff --git a/packages/ai-sdk/readme.md b/packages/ai-sdk/readme.md deleted file mode 100644 index 836fa428..00000000 --- a/packages/ai-sdk/readme.md +++ /dev/null @@ -1,24 +0,0 @@ -

- - Agentic - -

- -

- Agentic adapter for the Vercel AI SDK. -

- -

- Build Status - NPM - MIT License - Prettier Code Formatting -

- -# Agentic - -**See the [github repo](https://github.com/transitive-bullshit/agentic) or [docs](https://agentic.so) for more info.** - -## License - -MIT © [Travis Fischer](https://x.com/transitive_bs) diff --git a/packages/ai-sdk/src/ai-sdk.ts b/packages/ai-sdk/src/ai-sdk.ts index f133a159..0ac17f94 100644 --- a/packages/ai-sdk/src/ai-sdk.ts +++ b/packages/ai-sdk/src/ai-sdk.ts @@ -4,13 +4,22 @@ import { asAgenticSchema, isZodSchema } from '@agentic/core' -import { jsonSchema, tool } from 'ai' +import { + AgenticToolClient, + type AgenticToolClientOptions +} from '@agentic/platform-tool-client' +import { jsonSchema, type Tool, tool } from 'ai' /** * Converts a set of Agentic stdlib AI functions to an object compatible with * the Vercel AI SDK's `tools` parameter. */ -export function createAISDKTools(...aiFunctionLikeTools: AIFunctionLike[]) { +export function createAISDKTools( + ...aiFunctionLikeTools: AIFunctionLike[] +): Record< + string, + Tool & { execute: (args: any, options: any) => PromiseLike } +> { const fns = new AIFunctionSet(aiFunctionLikeTools) return Object.fromEntries( @@ -26,3 +35,15 @@ export function createAISDKTools(...aiFunctionLikeTools: AIFunctionLike[]) { ]) ) } + +export async function createAISDKToolsFromIdentifier( + projectOrDeploymentIdentifier: string, + opts: AgenticToolClientOptions = {} +) { + const toolClient = await AgenticToolClient.fromIdentifier( + projectOrDeploymentIdentifier, + opts + ) + + return createAISDKTools(toolClient) +} diff --git a/packages/core/readme.md b/packages/core/readme.md deleted file mode 100644 index 38781f32..00000000 --- a/packages/core/readme.md +++ /dev/null @@ -1,24 +0,0 @@ -

- - Agentic - -

- -

- AI agent stdlib that works with any LLM and TypeScript AI SDK. -

- -

- Build Status - NPM - MIT License - Prettier Code Formatting -

- -# Agentic - -**See the [github repo](https://github.com/transitive-bullshit/agentic) or [docs](https://agentic.so) for more info.** - -## License - -MIT © [Travis Fischer](https://x.com/transitive_bs) diff --git a/packages/genkit/readme.md b/packages/genkit/readme.md deleted file mode 100644 index e1e5bef3..00000000 --- a/packages/genkit/readme.md +++ /dev/null @@ -1,24 +0,0 @@ -

- - Agentic - -

- -

- Agentic adapter for Firebase Genkit. -

- -

- Build Status - NPM - MIT License - Prettier Code Formatting -

- -# Agentic - -**See the [github repo](https://github.com/transitive-bullshit/agentic) or [docs](https://agentic.so) for more info.** - -## License - -MIT © [Travis Fischer](https://x.com/transitive_bs) diff --git a/packages/json-schema/license b/packages/json-schema/license new file mode 100644 index 00000000..077621ec --- /dev/null +++ b/packages/json-schema/license @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2025 Travis Fischer + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/packages/langchain/readme.md b/packages/langchain/readme.md deleted file mode 100644 index 6a2f06dd..00000000 --- a/packages/langchain/readme.md +++ /dev/null @@ -1,24 +0,0 @@ -

- - Agentic - -

- -

- Agentic adapter for LangChain's JS SDK. -

- -

- Build Status - NPM - MIT License - Prettier Code Formatting -

- -# Agentic - -**See the [github repo](https://github.com/transitive-bullshit/agentic) or [docs](https://agentic.so) for more info.** - -## License - -MIT © [Travis Fischer](https://x.com/transitive_bs) diff --git a/packages/llamaindex/readme.md b/packages/llamaindex/readme.md deleted file mode 100644 index 92d6f4ec..00000000 --- a/packages/llamaindex/readme.md +++ /dev/null @@ -1,24 +0,0 @@ -

- - Agentic - -

- -

- Agentic adapter for the LlamaIndex JS SDK. -

- -

- Build Status - NPM - MIT License - Prettier Code Formatting -

- -# Agentic - -**See the [github repo](https://github.com/transitive-bullshit/agentic) or [docs](https://agentic.so) for more info.** - -## License - -MIT © [Travis Fischer](https://x.com/transitive_bs) diff --git a/packages/mastra/readme.md b/packages/mastra/readme.md deleted file mode 100644 index 82d92880..00000000 --- a/packages/mastra/readme.md +++ /dev/null @@ -1,24 +0,0 @@ -

- - Agentic - -

- -

- Agentic adapter for the Mastra AI Agent SDK. -

- -

- Build Status - NPM - MIT License - Prettier Code Formatting -

- -# Agentic - -**See the [github repo](https://github.com/transitive-bullshit/agentic) or [docs](https://agentic.so) for more info.** - -## License - -MIT © [Travis Fischer](https://x.com/transitive_bs) diff --git a/legacy/packages/mcp/package.json b/packages/mcp/package.json similarity index 61% rename from legacy/packages/mcp/package.json rename to packages/mcp/package.json index d9acd4b2..00095f4f 100644 --- a/legacy/packages/mcp/package.json +++ b/packages/mcp/package.json @@ -1,7 +1,7 @@ { "name": "@agentic/mcp", "version": "7.6.9", - "description": "Agentic SDK wrapping an MCP client.", + "description": "Agentic SDK for exposing tools from an MCP client in a way that easily interops with all TypeScript AI SDKs.", "author": "Travis Fischer ", "license": "MIT", "repository": { @@ -10,25 +10,16 @@ "directory": "packages/mcp" }, "type": "module", - "source": "./src/index.ts", - "types": "./dist/index.d.ts", "sideEffects": false, + "source": "./src/index.ts", + "types": "./src/index.ts", "exports": { - ".": { - "types": "./dist/index.d.ts", - "import": "./dist/index.js", - "default": "./dist/index.js" - } + ".": "./src/index.ts" }, - "files": [ - "dist" - ], "scripts": { "build": "tsup", - "dev": "tsup --watch", "clean": "del dist", "test": "run-s test:*", - "test:lint": "eslint .", "test:typecheck": "tsc --noEmit" }, "dependencies": { @@ -39,6 +30,17 @@ "zod": "catalog:" }, "publishConfig": { - "access": "public" + "access": "public", + "files": [ + "dist" + ], + "types": "./dist/index.ts", + "exports": { + ".": { + "types": "./dist/index.d.ts", + "import": "./dist/index.js", + "default": "./dist/index.js" + } + } } } diff --git a/legacy/packages/mcp/src/index.ts b/packages/mcp/src/index.ts similarity index 100% rename from legacy/packages/mcp/src/index.ts rename to packages/mcp/src/index.ts diff --git a/legacy/packages/mcp/src/mcp-tools.ts b/packages/mcp/src/mcp-tools.ts similarity index 100% rename from legacy/packages/mcp/src/mcp-tools.ts rename to packages/mcp/src/mcp-tools.ts diff --git a/legacy/packages/mcp/src/paginate.ts b/packages/mcp/src/paginate.ts similarity index 100% rename from legacy/packages/mcp/src/paginate.ts rename to packages/mcp/src/paginate.ts diff --git a/legacy/packages/mcp/src/types.ts b/packages/mcp/src/types.ts similarity index 100% rename from legacy/packages/mcp/src/types.ts rename to packages/mcp/src/types.ts diff --git a/legacy/packages/mcp/tsconfig.json b/packages/mcp/tsconfig.json similarity index 100% rename from legacy/packages/mcp/tsconfig.json rename to packages/mcp/tsconfig.json diff --git a/packages/tool-client/package.json b/packages/tool-client/package.json index 220acbae..405ce786 100644 --- a/packages/tool-client/package.json +++ b/packages/tool-client/package.json @@ -26,7 +26,7 @@ "test:typecheck": "tsc --noEmit" }, "dependencies": { - "@agentic/core": "catalog:", + "@agentic/core": "workspace:*", "@agentic/platform-api-client": "workspace:*", "@agentic/platform-core": "workspace:*", "@agentic/platform-types": "workspace:*", diff --git a/packages/tool-client/src/agentic-tool-client.ts b/packages/tool-client/src/agentic-tool-client.ts index 35cf356f..83238f9a 100644 --- a/packages/tool-client/src/agentic-tool-client.ts +++ b/packages/tool-client/src/agentic-tool-client.ts @@ -10,6 +10,14 @@ import { assert } from '@agentic/platform-core' import { parseDeploymentIdentifier } from '@agentic/platform-validators' import defaultKy, { type KyInstance } from 'ky' +export type AgenticToolClientOptions = { + agenticApiClient?: AgenticApiClient + agenticGatewayBaseUrl?: string + ky?: KyInstance +} + +// TODO: add support for optional apiKey + /** * Agentic tool client which makes it easy to use an Agentic tool products with * all of the major TypeScript LLM SDKs, without having to go through any MCP @@ -44,8 +52,6 @@ export class AgenticToolClient extends AIFunctionsProvider { }) { super() - // TODO: add support for optional apiKey - this.project = project this.deployment = deployment this.agenticGatewayBaseUrl = agenticGatewayBaseUrl @@ -72,11 +78,6 @@ export class AgenticToolClient extends AIFunctionsProvider { ) } - override get functions(): AIFunctionSet { - assert(this._functions) - return this._functions - } - /** * Helper method to call a tool with either raw or stringified JSON arguments. */ @@ -105,11 +106,7 @@ export class AgenticToolClient extends AIFunctionsProvider { agenticApiClient = new AgenticApiClient(), agenticGatewayBaseUrl = 'https://gateway.agentic.so', ky = defaultKy - }: { - agenticApiClient?: AgenticApiClient - agenticGatewayBaseUrl?: string - ky?: KyInstance - } = {} + }: AgenticToolClientOptions = {} ): Promise { const { projectIdentifier, deploymentIdentifier, deploymentVersion } = parseDeploymentIdentifier(projectOrDeploymentIdentifier, { diff --git a/packages/xsai/readme.md b/packages/xsai/readme.md deleted file mode 100644 index fe5f7995..00000000 --- a/packages/xsai/readme.md +++ /dev/null @@ -1,24 +0,0 @@ -

- - Agentic - -

- -

- Agentic adapter for the [xsAI SDK](https://github.com/moeru-ai/xsai). -

- -

- Build Status - NPM - MIT License - Prettier Code Formatting -

- -# Agentic - -**See the [github repo](https://github.com/transitive-bullshit/agentic) or [docs](https://agentic.so) for more info.** - -## License - -MIT © [Travis Fischer](https://x.com/transitive_bs) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index cd042076..de9119f9 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -955,6 +955,9 @@ importers: '@agentic/core': specifier: workspace:* version: link:../core + '@agentic/platform-tool-client': + specifier: workspace:* + version: link:../tool-client devDependencies: ai: specifier: 'catalog:' @@ -1230,6 +1233,18 @@ importers: specifier: 'catalog:' version: 0.10.8(openapi-types@12.1.3)(react@19.1.0)(zod@3.25.67) + packages/mcp: + dependencies: + '@agentic/core': + specifier: workspace:* + version: link:../core + '@modelcontextprotocol/sdk': + specifier: 'catalog:' + version: 1.13.2 + zod: + specifier: 'catalog:' + version: 3.25.67 + packages/openapi-utils: dependencies: '@agentic/platform-core': @@ -1331,8 +1346,8 @@ importers: packages/tool-client: dependencies: '@agentic/core': - specifier: 'catalog:' - version: 7.6.9(zod@3.25.67) + specifier: workspace:* + version: link:../core '@agentic/platform-api-client': specifier: workspace:* version: link:../api-client diff --git a/todo.md b/todo.md index 4e3c2055..9b09e62d 100644 --- a/todo.md +++ b/todo.md @@ -99,3 +99,8 @@ - make json `$schema` public for `agentic.config.json` - handle hosting of deployment and user images - about page inspiration: https://mastra.ai/about +- simplify overlap between `@agentic/core` and `@agentic/platform-core` +- consider moving packages to correspond to their licenses and public/private + - platform AGPL-3.0 private + - platform AGPL-3.0 public; maybe this should be MIT? + - stdlib MIT public