-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtool-descriptor.ts
More file actions
58 lines (50 loc) · 1.95 KB
/
Copy pathtool-descriptor.ts
File metadata and controls
58 lines (50 loc) · 1.95 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import type { Type } from '@angular/core';
import type { ZodType } from 'zod';
// Local OpenAPI-Lite mirror so callers need not import the SDK type.
export interface FunctionDeclaration {
readonly name: string;
readonly description: string;
readonly parameters: FunctionParametersSchema;
}
export interface FunctionParametersSchema {
readonly type: 'OBJECT';
readonly properties: Readonly<Record<string, FunctionPropertySchema>>;
readonly required?: readonly string[];
}
export interface FunctionPropertySchema {
readonly type: 'STRING' | 'INTEGER' | 'NUMBER' | 'BOOLEAN' | 'ARRAY' | 'OBJECT';
readonly description?: string;
readonly enum?: readonly string[];
readonly items?: FunctionPropertySchema;
readonly format?: string;
readonly properties?: Readonly<Record<string, FunctionPropertySchema>>;
readonly required?: readonly string[];
}
export interface ToolMeta {
readonly name: string;
readonly description: string;
readonly declaration: FunctionDeclaration;
readonly interruptive?: boolean;
readonly interruptReason?: string;
// Singleton: only latest (non-failed) instance shown when agent calls more than once per turn.
readonly singleton?: boolean;
}
export interface ToolManifest<TArgs = unknown, TResult = unknown> extends ToolMeta {
load(): Promise<ToolDescriptor<TArgs, TResult>>;
}
// Documents NgComponentOutlet inputs; components use signal input(), not `implements`.
export interface ToolComponentInputs<TArgs = unknown, TResult = unknown> {
readonly args: TArgs;
readonly result: TResult | null;
readonly status: 'running' | 'complete' | 'error';
readonly errorMessage: string | null;
}
export interface ToolDescriptor<TArgs = unknown, TResult = unknown> extends ToolMeta {
readonly argsSchema: ZodType<TArgs>;
readonly component: Type<unknown>;
execute(args: TArgs, ctx: ToolExecutionContext): Promise<TResult>;
}
export interface ToolExecutionContext {
readonly callId: string;
readonly signal: AbortSignal;
}