feat: add exec approvals allowlists
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { callGatewayTool, type GatewayCallOptions } from "./gateway.js";
|
||||
|
||||
type NodeListNode = {
|
||||
export type NodeListNode = {
|
||||
nodeId: string;
|
||||
displayName?: string;
|
||||
platform?: string;
|
||||
@@ -99,12 +99,15 @@ function pickDefaultNode(nodes: NodeListNode[]): NodeListNode | null {
|
||||
return null;
|
||||
}
|
||||
|
||||
export async function resolveNodeId(
|
||||
opts: GatewayCallOptions,
|
||||
export async function listNodes(opts: GatewayCallOptions): Promise<NodeListNode[]> {
|
||||
return loadNodes(opts);
|
||||
}
|
||||
|
||||
export function resolveNodeIdFromList(
|
||||
nodes: NodeListNode[],
|
||||
query?: string,
|
||||
allowDefault = false,
|
||||
) {
|
||||
const nodes = await loadNodes(opts);
|
||||
): string {
|
||||
const q = String(query ?? "").trim();
|
||||
if (!q) {
|
||||
if (allowDefault) {
|
||||
@@ -138,3 +141,12 @@ export async function resolveNodeId(
|
||||
.join(", ")})`,
|
||||
);
|
||||
}
|
||||
|
||||
export async function resolveNodeId(
|
||||
opts: GatewayCallOptions,
|
||||
query?: string,
|
||||
allowDefault = false,
|
||||
) {
|
||||
const nodes = await loadNodes(opts);
|
||||
return resolveNodeIdFromList(nodes, query, allowDefault);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user