Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | 2209x 2209x 14x 14x 14x | import { AvailableTool } from "@/objects/Tool";
import { Dictionary } from "@/types/ext";
import { AxiosRequestConfig } from "axios";
import { APIRouter } from "../ApiRouter";
/**
* svc-ai's built-in tool registry, read-only.
*
* Not a `HistoricalAPIRouter` any more: there is no `Tool` resource to have a
* version trail. Built-ins are a platform capability, so the only operation is
* listing them — for the skill-graph builder's palette, which is the one place
* a user picks a tool by name.
*/
export class ToolRouter extends APIRouter {
constructor(
host: string,
token: string | null = null,
default_config: AxiosRequestConfig | null = null,
headers: Dictionary<string> = {},
) {
super("tools", host, token, default_config, headers);
}
available = async (): Promise<AvailableTool[]> => {
const res = await this.api.get(this.endpoint("available"));
Eif (super.validRes(res)) {
return (res.data as { tools: AvailableTool[] }).tools ?? [];
}
return [];
};
}
|