feat: more refactoring work

pull/714/head
Travis Fischer 2025-06-28 23:39:23 -05:00
rodzic 0a67043c03
commit b865682bdb
22 zmienionych plików z 94 dodań i 248 usunięć

Wyświetl plik

@ -1,24 +0,0 @@
<p align="center">
<a href="https://agentic.so">
<img alt="Agentic" src="https://raw.githubusercontent.com/transitive-bullshit/agentic/main/docs/media/agentic-header.jpg" width="308">
</a>
</p>
<p align="center">
<em>AI agent stdlib that works with any LLM and TypeScript AI SDK.</em>
</p>
<p align="center">
<a href="https://github.com/transitive-bullshit/agentic/actions/workflows/main.yml"><img alt="Build Status" src="https://github.com/transitive-bullshit/agentic/actions/workflows/main.yml/badge.svg" /></a>
<a href="https://www.npmjs.com/package/@agentic/stdlib"><img alt="NPM" src="https://img.shields.io/npm/v/@agentic/stdlib.svg" /></a>
<a href="https://github.com/transitive-bullshit/agentic/blob/main/license"><img alt="MIT License" src="https://img.shields.io/badge/license-MIT-blue" /></a>
<a href="https://prettier.io"><img alt="Prettier Code Formatting" src="https://img.shields.io/badge/code_style-prettier-brightgreen.svg" /></a>
</p>
# 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)

Wyświetl plik

@ -1,24 +0,0 @@
<p align="center">
<a href="https://agentic.so">
<img alt="Agentic" src="https://raw.githubusercontent.com/transitive-bullshit/agentic/main/docs/media/agentic-header.jpg" width="308">
</a>
</p>
<p align="center">
<em>AI agent stdlib that works with any LLM and TypeScript AI SDK.</em>
</p>
<p align="center">
<a href="https://github.com/transitive-bullshit/agentic/actions/workflows/main.yml"><img alt="Build Status" src="https://github.com/transitive-bullshit/agentic/actions/workflows/main.yml/badge.svg" /></a>
<a href="https://www.npmjs.com/package/@agentic/stdlib"><img alt="NPM" src="https://img.shields.io/npm/v/@agentic/stdlib.svg" /></a>
<a href="https://github.com/transitive-bullshit/agentic/blob/main/license"><img alt="MIT License" src="https://img.shields.io/badge/license-MIT-blue" /></a>
<a href="https://prettier.io"><img alt="Prettier Code Formatting" src="https://img.shields.io/badge/code_style-prettier-brightgreen.svg" /></a>
</p>
# 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)

Wyświetl plik

@ -24,7 +24,8 @@
"test:unit": "vitest run"
},
"dependencies": {
"@agentic/core": "workspace:*"
"@agentic/core": "workspace:*",
"@agentic/platform-tool-client": "workspace:*"
},
"peerDependencies": {
"ai": "catalog:"

Wyświetl plik

@ -1,24 +0,0 @@
<p align="center">
<a href="https://agentic.so">
<img alt="Agentic" src="https://raw.githubusercontent.com/transitive-bullshit/agentic/main/docs/media/agentic-header.jpg" width="308">
</a>
</p>
<p align="center">
<em>Agentic adapter for the Vercel AI SDK.</em>
</p>
<p align="center">
<a href="https://github.com/transitive-bullshit/agentic/actions/workflows/main.yml"><img alt="Build Status" src="https://github.com/transitive-bullshit/agentic/actions/workflows/main.yml/badge.svg" /></a>
<a href="https://www.npmjs.com/package/@agentic/stdlib"><img alt="NPM" src="https://img.shields.io/npm/v/@agentic/stdlib.svg" /></a>
<a href="https://github.com/transitive-bullshit/agentic/blob/main/license"><img alt="MIT License" src="https://img.shields.io/badge/license-MIT-blue" /></a>
<a href="https://prettier.io"><img alt="Prettier Code Formatting" src="https://img.shields.io/badge/code_style-prettier-brightgreen.svg" /></a>
</p>
# 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)

Wyświetl plik

@ -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<any> }
> {
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)
}

Wyświetl plik

@ -1,24 +0,0 @@
<p align="center">
<a href="https://agentic.so">
<img alt="Agentic" src="https://raw.githubusercontent.com/transitive-bullshit/agentic/main/docs/media/agentic-header.jpg" width="308">
</a>
</p>
<p align="center">
<em>AI agent stdlib that works with any LLM and TypeScript AI SDK.</em>
</p>
<p align="center">
<a href="https://github.com/transitive-bullshit/agentic/actions/workflows/main.yml"><img alt="Build Status" src="https://github.com/transitive-bullshit/agentic/actions/workflows/main.yml/badge.svg" /></a>
<a href="https://www.npmjs.com/package/@agentic/stdlib"><img alt="NPM" src="https://img.shields.io/npm/v/@agentic/stdlib.svg" /></a>
<a href="https://github.com/transitive-bullshit/agentic/blob/main/license"><img alt="MIT License" src="https://img.shields.io/badge/license-MIT-blue" /></a>
<a href="https://prettier.io"><img alt="Prettier Code Formatting" src="https://img.shields.io/badge/code_style-prettier-brightgreen.svg" /></a>
</p>
# 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)

Wyświetl plik

@ -1,24 +0,0 @@
<p align="center">
<a href="https://agentic.so">
<img alt="Agentic" src="https://raw.githubusercontent.com/transitive-bullshit/agentic/main/docs/media/agentic-header.jpg" width="308">
</a>
</p>
<p align="center">
<em>Agentic adapter for Firebase Genkit.</em>
</p>
<p align="center">
<a href="https://github.com/transitive-bullshit/agentic/actions/workflows/main.yml"><img alt="Build Status" src="https://github.com/transitive-bullshit/agentic/actions/workflows/main.yml/badge.svg" /></a>
<a href="https://www.npmjs.com/package/@agentic/stdlib"><img alt="NPM" src="https://img.shields.io/npm/v/@agentic/stdlib.svg" /></a>
<a href="https://github.com/transitive-bullshit/agentic/blob/main/license"><img alt="MIT License" src="https://img.shields.io/badge/license-MIT-blue" /></a>
<a href="https://prettier.io"><img alt="Prettier Code Formatting" src="https://img.shields.io/badge/code_style-prettier-brightgreen.svg" /></a>
</p>
# 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)

Wyświetl plik

@ -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.

Wyświetl plik

@ -1,24 +0,0 @@
<p align="center">
<a href="https://agentic.so">
<img alt="Agentic" src="https://raw.githubusercontent.com/transitive-bullshit/agentic/main/docs/media/agentic-header.jpg" width="308">
</a>
</p>
<p align="center">
<em>Agentic adapter for LangChain's JS SDK.</em>
</p>
<p align="center">
<a href="https://github.com/transitive-bullshit/agentic/actions/workflows/main.yml"><img alt="Build Status" src="https://github.com/transitive-bullshit/agentic/actions/workflows/main.yml/badge.svg" /></a>
<a href="https://www.npmjs.com/package/@agentic/stdlib"><img alt="NPM" src="https://img.shields.io/npm/v/@agentic/stdlib.svg" /></a>
<a href="https://github.com/transitive-bullshit/agentic/blob/main/license"><img alt="MIT License" src="https://img.shields.io/badge/license-MIT-blue" /></a>
<a href="https://prettier.io"><img alt="Prettier Code Formatting" src="https://img.shields.io/badge/code_style-prettier-brightgreen.svg" /></a>
</p>
# 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)

Wyświetl plik

@ -1,24 +0,0 @@
<p align="center">
<a href="https://agentic.so">
<img alt="Agentic" src="https://raw.githubusercontent.com/transitive-bullshit/agentic/main/docs/media/agentic-header.jpg" width="308">
</a>
</p>
<p align="center">
<em>Agentic adapter for the LlamaIndex JS SDK.</em>
</p>
<p align="center">
<a href="https://github.com/transitive-bullshit/agentic/actions/workflows/main.yml"><img alt="Build Status" src="https://github.com/transitive-bullshit/agentic/actions/workflows/main.yml/badge.svg" /></a>
<a href="https://www.npmjs.com/package/@agentic/stdlib"><img alt="NPM" src="https://img.shields.io/npm/v/@agentic/stdlib.svg" /></a>
<a href="https://github.com/transitive-bullshit/agentic/blob/main/license"><img alt="MIT License" src="https://img.shields.io/badge/license-MIT-blue" /></a>
<a href="https://prettier.io"><img alt="Prettier Code Formatting" src="https://img.shields.io/badge/code_style-prettier-brightgreen.svg" /></a>
</p>
# 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)

Wyświetl plik

@ -1,24 +0,0 @@
<p align="center">
<a href="https://agentic.so">
<img alt="Agentic" src="https://raw.githubusercontent.com/transitive-bullshit/agentic/main/docs/media/agentic-header.jpg" width="308">
</a>
</p>
<p align="center">
<em>Agentic adapter for the Mastra AI Agent SDK.</em>
</p>
<p align="center">
<a href="https://github.com/transitive-bullshit/agentic/actions/workflows/main.yml"><img alt="Build Status" src="https://github.com/transitive-bullshit/agentic/actions/workflows/main.yml/badge.svg" /></a>
<a href="https://www.npmjs.com/package/@agentic/stdlib"><img alt="NPM" src="https://img.shields.io/npm/v/@agentic/stdlib.svg" /></a>
<a href="https://github.com/transitive-bullshit/agentic/blob/main/license"><img alt="MIT License" src="https://img.shields.io/badge/license-MIT-blue" /></a>
<a href="https://prettier.io"><img alt="Prettier Code Formatting" src="https://img.shields.io/badge/code_style-prettier-brightgreen.svg" /></a>
</p>
# 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)

Wyświetl plik

@ -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 <travis@transitivebullsh.it>",
"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"
}
}
}
}

Wyświetl plik

@ -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:*",

Wyświetl plik

@ -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<AgenticToolClient> {
const { projectIdentifier, deploymentIdentifier, deploymentVersion } =
parseDeploymentIdentifier(projectOrDeploymentIdentifier, {

Wyświetl plik

@ -1,24 +0,0 @@
<p align="center">
<a href="https://agentic.so">
<img alt="Agentic" src="https://raw.githubusercontent.com/transitive-bullshit/agentic/main/docs/media/agentic-header.jpg" width="308">
</a>
</p>
<p align="center">
<em>Agentic adapter for the [xsAI SDK](https://github.com/moeru-ai/xsai).</em>
</p>
<p align="center">
<a href="https://github.com/transitive-bullshit/agentic/actions/workflows/main.yml"><img alt="Build Status" src="https://github.com/transitive-bullshit/agentic/actions/workflows/main.yml/badge.svg" /></a>
<a href="https://www.npmjs.com/package/@agentic/stdlib"><img alt="NPM" src="https://img.shields.io/npm/v/@agentic/stdlib.svg" /></a>
<a href="https://github.com/transitive-bullshit/agentic/blob/main/license"><img alt="MIT License" src="https://img.shields.io/badge/license-MIT-blue" /></a>
<a href="https://prettier.io"><img alt="Prettier Code Formatting" src="https://img.shields.io/badge/code_style-prettier-brightgreen.svg" /></a>
</p>
# 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)

Wyświetl plik

@ -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

Wyświetl plik

@ -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