mirror of
https://gitea.toothfairyai.com/ToothFairyAI/tf_code.git
synced 2026-04-09 02:09:12 +00:00
feat(skill): add per-agent filtering to skill tool description (#6000)
This commit is contained in:
committed by
GitHub
parent
44fd0eee64
commit
3a54ab68d1
@@ -1,11 +1,16 @@
|
||||
import z from "zod"
|
||||
import type { MessageV2 } from "../session/message-v2"
|
||||
import type { Agent } from "../agent/agent"
|
||||
|
||||
export namespace Tool {
|
||||
interface Metadata {
|
||||
[key: string]: any
|
||||
}
|
||||
|
||||
export interface InitContext {
|
||||
agent?: Agent.Info
|
||||
}
|
||||
|
||||
export type Context<M extends Metadata = Metadata> = {
|
||||
sessionID: string
|
||||
messageID: string
|
||||
@@ -17,7 +22,7 @@ export namespace Tool {
|
||||
}
|
||||
export interface Info<Parameters extends z.ZodType = z.ZodType, M extends Metadata = Metadata> {
|
||||
id: string
|
||||
init: () => Promise<{
|
||||
init: (ctx?: InitContext) => Promise<{
|
||||
description: string
|
||||
parameters: Parameters
|
||||
execute(
|
||||
@@ -42,8 +47,8 @@ export namespace Tool {
|
||||
): Info<Parameters, Result> {
|
||||
return {
|
||||
id,
|
||||
init: async () => {
|
||||
const toolInfo = init instanceof Function ? await init() : init
|
||||
init: async (ctx) => {
|
||||
const toolInfo = init instanceof Function ? await init(ctx) : init
|
||||
const execute = toolInfo.execute
|
||||
toolInfo.execute = (args, ctx) => {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user