feat: add exec approvals allowlists

This commit is contained in:
Peter Steinberger
2026-01-18 01:33:52 +00:00
parent 3a0fd6be3c
commit 0674f1fa3c
21 changed files with 1019 additions and 101 deletions

View File

@@ -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);
}