import { Type } from "typebox";
export const PEER_ID_FIELD = "peer-id";
export const peerRouteSchema = Type.Object({
    [PEER_ID_FIELD]: Type.String({
        description: 'Executor id. Use "host" for pi-hub or peer-id from group.',
    }),
});
export function createPeerToolSchema(baseSchema) {
    const { allOf: _allOf, ...base } = baseSchema;
    const route = peerRouteSchema;
    return Type.Unsafe({
        ...base,
        type: "object",
        properties: {
            ...(base.properties ?? {}),
            ...(route.properties ?? {}),
        },
        required: [...new Set([...(base.required ?? []), ...(route.required ?? [])])],
    });
}
export function preparePeerToolArguments(args, basePrepareArguments) {
    if (!args || typeof args !== "object") {
        return args;
    }
    const rawArgs = args;
    const preparedArgs = basePrepareArguments ? basePrepareArguments(args) : rawArgs;
    return {
        ...preparedArgs,
        [PEER_ID_FIELD]: rawArgs[PEER_ID_FIELD],
    };
}
export function splitPeerToolArguments(args) {
    const { [PEER_ID_FIELD]: peerId, ...toolArgs } = args;
    return {
        peerId,
        toolArgs,
    };
}
//# sourceMappingURL=peer-tool-schema.js.map