Add SDK package

This commit is contained in:
2026-05-05 12:03:46 +00:00
commit d74a0871b4
10 changed files with 266 additions and 0 deletions
+36
View File
@@ -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);
}
}