Skip to content
Source
Sign inSign up
TanStack/ai
Open History to see the last commit

harness-protocol-tools.ts

41 lines1.2 KB

1import { toolDefinition } from '@tanstack/ai'
2import { z } from 'zod'
3​
4/**
5 * Tools of the harness protocol route. The specs import the same
6 * definitions, so a `ChatClient` knows `deploy` is an approval.
7 */
8export const deploy = toolDefinition({
9 name: 'deploy',
10 description: 'Deploy to an environment. Needs approval.',
11 needsApproval: true,
12 inputSchema: z.object({ env: z.string() }),
13})
14​
15/** Returns the context of the turn, so a spec can see what a tool got. */
16export const probe = toolDefinition({
17 name: 'probe',
18 description: 'Show the context of this turn.',
19 inputSchema: z.object({}),
20})
21​
22/** Asks the user for a name, so the turn keeps running until the answer. */
23export const askName = toolDefinition({
24 name: 'askName',
25 description: 'Ask the user for their name.',
26 inputSchema: z.object({}),
27})
28​
29/** Returns the id of the user that the turn runs as. */
30export const whoami = toolDefinition({
31 name: 'whoami',
32 description: 'Show who runs this turn.',
33 inputSchema: z.object({}),
34})
35​
36/** Builds until the test sends `release`, so a spec can move it to the background. */
37export const slowBuild = toolDefinition({
38 name: 'slowBuild',
39 description: 'Build the project. It takes a while.',
40 inputSchema: z.object({}),
41})