import { defineHandler } from '@kb-labs/sdk';
import { SessionManager } from '@kb-labs/agent-core';

// src/rest/handlers/create-session-handler.ts
var create_session_handler_default = defineHandler({
  async execute(ctx, input) {
    const body = input.body;
    if (!body?.agentId) {
      throw new Error("Agent ID is required");
    }
    const sessionManager = new SessionManager(ctx.cwd);
    const session = await sessionManager.createSession({
      mode: "execute",
      task: body.task ?? "",
      agentId: body.agentId,
      name: body.name
    });
    ctx.platform.logger.info(`[create-session] Created session ${session.id} for agent ${body.agentId}`);
    return { session };
  }
});

export { create_session_handler_default as default };
//# sourceMappingURL=create-session-handler.js.map
//# sourceMappingURL=create-session-handler.js.map