mirror of
https://gitea.toothfairyai.com/ToothFairyAI/tf_code.git
synced 2026-03-30 05:43:55 +00:00
feat: tf code
This commit is contained in:
parent
1c0c0e6a50
commit
70341eebf5
@ -257,35 +257,25 @@ export namespace Agent {
|
|||||||
|
|
||||||
async function loadTFCoderAgents(): Promise<Info[]> {
|
async function loadTFCoderAgents(): Promise<Info[]> {
|
||||||
const toolsPath = path.join(Global.Path.data, ".tfcode", "tools.json")
|
const toolsPath = path.join(Global.Path.data, ".tfcode", "tools.json")
|
||||||
console.log("[TF Agents] Loading from:", toolsPath)
|
|
||||||
try {
|
try {
|
||||||
const content = await Bun.file(toolsPath).text()
|
const content = await Bun.file(toolsPath).text()
|
||||||
const data = JSON.parse(content)
|
const data = JSON.parse(content)
|
||||||
console.log("[TF Agents] File loaded, success:", data.success, "tools:", data.tools?.length)
|
if (!data.success || !data.tools) return []
|
||||||
if (!data.success || !data.tools) {
|
|
||||||
console.log("[TF Agents] No tools data, returning []")
|
|
||||||
return []
|
|
||||||
}
|
|
||||||
|
|
||||||
const tfAgents = data.tools
|
return data.tools
|
||||||
.filter((t: any) => t.tool_type === "agent_skill")
|
.filter((t: any) => t.tool_type === "agent_skill")
|
||||||
|
.map((t: any): Info => ({
|
||||||
console.log("[TF Agents] Found agent_skill items:", tfAgents.length)
|
name: t.name,
|
||||||
console.log("[TF Agents] Names:", tfAgents.map((t: any) => t.name))
|
description: t.description,
|
||||||
|
mode: "primary" as const,
|
||||||
return tfAgents.map((t: any): Info => ({
|
permission: Permission.fromConfig({ "*": "allow" }),
|
||||||
name: t.name,
|
native: false,
|
||||||
description: t.description,
|
options: {
|
||||||
mode: "subagent" as const,
|
tf_agent_id: t.id,
|
||||||
permission: Permission.fromConfig({ "*": "allow" }),
|
tf_auth_via: t.auth_via,
|
||||||
native: false,
|
},
|
||||||
options: {
|
}))
|
||||||
tf_agent_id: t.id,
|
} catch {
|
||||||
tf_auth_via: t.auth_via,
|
|
||||||
},
|
|
||||||
}))
|
|
||||||
} catch (e) {
|
|
||||||
console.log("[TF Agents] Error:", e)
|
|
||||||
return []
|
return []
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -295,8 +285,6 @@ export namespace Agent {
|
|||||||
const localAgents = await state()
|
const localAgents = await state()
|
||||||
const tfAgents = await loadTFCoderAgents()
|
const tfAgents = await loadTFCoderAgents()
|
||||||
|
|
||||||
console.log("[TF Agents] list() - local:", Object.keys(localAgents).length, "tf:", tfAgents.length)
|
|
||||||
|
|
||||||
return pipe(
|
return pipe(
|
||||||
{ ...localAgents, ...Object.fromEntries(tfAgents.map(a => [a.name, a])) },
|
{ ...localAgents, ...Object.fromEntries(tfAgents.map(a => [a.name, a])) },
|
||||||
values(),
|
values(),
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
export const logo = {
|
export const logo = {
|
||||||
left: [" ", "▀▀▀▀ ▀▀▀▀", "_█__ █^^~", "_█__ █___"],
|
left: [" ", "▀▀▀▀ ▀▀▀▀", "_█__ █^^~", "_█__ █___"],
|
||||||
right: [" ", "█▀▀▀ █▀▀█ █▀▀█ █▀▀█", " █___ █__█ █__█ █^^^", " ▀▀▀▀ ▀▀▀▀ ▀▀▀▀ ▀▀▀▀"],
|
right: [" ", " █▀▀▀ █▀▀█ █▀▀█ █▀▀█", " █___ █__█ █__█ █^^^", " ▀▀▀▀ ▀▀▀▀ ▀▀▀▀ ▀▀▀▀"],
|
||||||
}
|
}
|
||||||
|
|
||||||
export const marks = "_^~"
|
export const marks = "_^~"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user