// @bun
var __defProp = Object.defineProperty;
var __returnValue = (v) => v;
function __exportSetter(name, newValue) {
  this[name] = __returnValue.bind(null, newValue);
}
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, {
      get: all[name],
      enumerable: true,
      configurable: true,
      set: __exportSetter.bind(all, name)
    });
};
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
var __require = import.meta.require;

// src/tools/operation-tool-handler.ts
function toolCtxToHandlerCtx(ctx) {
  return {
    traceId: ctx.metadata?.traceId,
    organizationId: ctx.tenantId ?? null,
    userId: ctx.actorId ?? null,
    actor: ctx.actorId ? "user" : "anonymous",
    channel: "agent",
    roles: []
  };
}
function createOperationToolHandler(registry, operationRef) {
  return async (input, context) => {
    const handlerCtx = toolCtxToHandlerCtx(context);
    const result = await registry.execute(operationRef.key, operationRef.version, input ?? {}, handlerCtx);
    return result;
  };
}
export {
  createOperationToolHandler
};
