Add SDK package
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
import * as plugins from './plugins.js';
|
||||
import type { ShxAutomationContext } from './classes.automationcontext.js';
|
||||
|
||||
export class AgentProxy {
|
||||
constructor(private context: ShxAutomationContext) {}
|
||||
|
||||
public async decide(optionsArg: {
|
||||
agentId: string;
|
||||
goal: string;
|
||||
scopes: plugins.shxInterfaces.data.TToolScope[];
|
||||
input?: Record<string, unknown>;
|
||||
confidence?: number;
|
||||
}) {
|
||||
const callId = `call:${Date.now()}:${Math.random().toString(36).slice(2)}`;
|
||||
const plan: plugins.shxInterfaces.data.IToolPlan = {
|
||||
id: `plan:${callId}`,
|
||||
callerId: this.context.options.callerId,
|
||||
title: `Ask ${optionsArg.agentId}`,
|
||||
reason: optionsArg.goal,
|
||||
confidence: optionsArg.confidence ?? 0.65,
|
||||
calls: [
|
||||
{
|
||||
id: callId,
|
||||
toolId: `agent:${optionsArg.agentId}:decide`,
|
||||
callerId: this.context.options.callerId,
|
||||
input: {
|
||||
goal: optionsArg.goal,
|
||||
scopes: optionsArg.scopes,
|
||||
...(optionsArg.input ?? {}),
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
return this.context.executePlan(plan);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user