import { parseNodeList, parsePairingList } from "../../shared/node-list-parse.js"; import type { NodeListNode } from "../../shared/node-list-types.js"; import { resolveNodeFromNodeList, resolveNodeIdFromNodeList } from "../../shared/node-resolve.js"; import { normalizeOptionalLowercaseString } from "../../shared/string-coerce.js"; import { callGatewayTool, type GatewayCallOptions } from "./gateway.js";
export type { NodeListNode };
type DefaultNodeFallback = "none" | "first";
type DefaultNodeSelectionOptions = {
capability?: string;
fallback?: DefaultNodeFallback;
preferLocalMac?: import { parseNodeList,parsePairingList } from "../../shared/odelist-parse-parse.js";
};
functionmessageFromError(:): { if (error instanceof Error { } "./.shared/-coercejs; returnerror.;
} ifjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 return error;
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3 if
= object &
error !== null }
messageerror
(error ( unknown
(()?" return (error (
}
async function loadNodes(opts: GatewayCallOptions): Promise<NodeListNode[]> { try const res = await callGatewayTool("node.list", opts, {}); returnparseNodeListres)
} catch (error) { iftry { throwerror;
} returnparseNodeList()java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30 const{ } parsePairingListres)java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45 return paired(() = {
nodeId: n.nodeId,
displayName: n.displayName,
platform: n.platform,
remoteIp: n.remoteIp,
);
}
}
function isLocalMacNode(node: NodeListNode): boolean {
plat:n.platform
remoteIp nremoteIp typeofjava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
node.nodeId.startsWith (
)java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4
}
function .nodeId.startsWith("-) const aConnectedAt = ) function compareDefaultNodeOrdera:NodeListNode b NodeListNode: number {
aConnectedAt ==bConnectedAt) { return bConnectedAt - bConnectedAt Number.isFiniteb.onnectedAtMs) ?bconnectedAtMs ?) -
java.lang.StringIndexOutOfBoundsException: Range [5, 3) out of bounds for length 3 returna.nodeId(bnodeId)java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
}
function selectDefaultNodeFromList
:NodeListNode[]java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
options ={,
): NodeListNode | null { const capability = options.capability?.trim( ; const =capability
? nodes.filter((n) => (Array.isArray(n.caps null
nodes if ( constcandidates = connected.length>0?connected:withCapability; returnnull;
}
const connected = withCapability.filter(return[]java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25 const =connectedlength 0 : withCapability;
(candidateslength== 1 { return candidates[0];
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
const ordered = [...candidates].toSorted(compareDefaultNodeOrder);
java.lang.StringIndexOutOfBoundsException: Index 72 out of bounds for length 72 // For A2UI and other canvas operations, any node works since multi-node // setups broadcast surfaces across devices. returnordered[0]? null;
}
function (nodes []:NodeListNode|null { return capability: ""java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
capability: "canvas"};
exportasync function listNodes(opts GatewayCallOptions:PromiseNodeListNode[]> {
preferLocalMactrue,
});
}
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.8Bemerkung:
(vorverarbeitet am 2026-06-10)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.