Files

75 lines
1.4 KiB
TypeScript
Raw Permalink Normal View History

2026-05-05 12:03:46 +00:00
import type { TAgentMode } from './agent.js';
export type TToolScope =
| '*.read'
| 'device.read'
| 'device.write'
| 'light.read'
| 'light.write'
| 'climate.read'
| 'climate.write'
| 'energy.read'
| 'energy.write'
| 'lock.read'
| 'lock.write'
| 'camera.read'
| 'alarm.write'
| 'agent.invoke'
| 'automation.write'
| 'approval.write';
export type TToolJsonSchema = Record<string, unknown>;
export interface IToolDefinition {
id: string;
ownerId: string;
name: string;
description: string;
inputSchema: TToolJsonSchema;
requiredScopes: TToolScope[];
mode: TAgentMode;
}
export interface IToolCall {
id: string;
toolId: string;
callerId: string;
input: Record<string, unknown>;
}
export interface IToolPlan {
id: string;
callerId: string;
title: string;
reason: string;
confidence: number;
calls: IToolCall[];
}
export interface IToolExecutionResult {
callId: string;
status: 'executed' | 'queuedForApproval' | 'suggested' | 'failed';
output?: Record<string, unknown>;
approvalId?: string;
errorMessage?: string;
}
export interface IToolPlanResult {
planId: string;
results: IToolExecutionResult[];
}
export interface IApprovalRequest {
id: string;
planId: string;
callId: string;
agentId: string;
title: string;
reason: string;
confidence: number;
requestedScopes: TToolScope[];
status: 'pending' | 'approved' | 'rejected' | 'expired';
createdAt: string;
decidedAt?: string;
}