function createServerRpc(connection) {
  return {
    ping: async (params) => connection.sendRequest("ping", params),
    models: {
      list: async () => connection.sendRequest("models.list", {})
    },
    tools: {
      list: async (params) => connection.sendRequest("tools.list", params)
    },
    account: {
      getQuota: async () => connection.sendRequest("account.getQuota", {})
    }
  };
}
function createSessionRpc(connection, sessionId) {
  return {
    model: {
      getCurrent: async () => connection.sendRequest("session.model.getCurrent", { sessionId }),
      switchTo: async (params) => connection.sendRequest("session.model.switchTo", { sessionId, ...params })
    },
    mode: {
      get: async () => connection.sendRequest("session.mode.get", { sessionId }),
      set: async (params) => connection.sendRequest("session.mode.set", { sessionId, ...params })
    },
    plan: {
      read: async () => connection.sendRequest("session.plan.read", { sessionId }),
      update: async (params) => connection.sendRequest("session.plan.update", { sessionId, ...params }),
      delete: async () => connection.sendRequest("session.plan.delete", { sessionId })
    },
    workspace: {
      listFiles: async () => connection.sendRequest("session.workspace.listFiles", { sessionId }),
      readFile: async (params) => connection.sendRequest("session.workspace.readFile", { sessionId, ...params }),
      createFile: async (params) => connection.sendRequest("session.workspace.createFile", { sessionId, ...params })
    },
    /** @experimental */
    fleet: {
      start: async (params) => connection.sendRequest("session.fleet.start", { sessionId, ...params })
    },
    /** @experimental */
    agent: {
      list: async () => connection.sendRequest("session.agent.list", { sessionId }),
      getCurrent: async () => connection.sendRequest("session.agent.getCurrent", { sessionId }),
      select: async (params) => connection.sendRequest("session.agent.select", { sessionId, ...params }),
      deselect: async () => connection.sendRequest("session.agent.deselect", { sessionId }),
      reload: async () => connection.sendRequest("session.agent.reload", { sessionId })
    },
    /** @experimental */
    skills: {
      list: async () => connection.sendRequest("session.skills.list", { sessionId }),
      enable: async (params) => connection.sendRequest("session.skills.enable", { sessionId, ...params }),
      disable: async (params) => connection.sendRequest("session.skills.disable", { sessionId, ...params }),
      reload: async () => connection.sendRequest("session.skills.reload", { sessionId })
    },
    /** @experimental */
    mcp: {
      list: async () => connection.sendRequest("session.mcp.list", { sessionId }),
      enable: async (params) => connection.sendRequest("session.mcp.enable", { sessionId, ...params }),
      disable: async (params) => connection.sendRequest("session.mcp.disable", { sessionId, ...params }),
      reload: async () => connection.sendRequest("session.mcp.reload", { sessionId })
    },
    /** @experimental */
    plugins: {
      list: async () => connection.sendRequest("session.plugins.list", { sessionId })
    },
    /** @experimental */
    extensions: {
      list: async () => connection.sendRequest("session.extensions.list", { sessionId }),
      enable: async (params) => connection.sendRequest("session.extensions.enable", { sessionId, ...params }),
      disable: async (params) => connection.sendRequest("session.extensions.disable", { sessionId, ...params }),
      reload: async () => connection.sendRequest("session.extensions.reload", { sessionId })
    },
    /** @experimental */
    compaction: {
      compact: async () => connection.sendRequest("session.compaction.compact", { sessionId })
    },
    tools: {
      handlePendingToolCall: async (params) => connection.sendRequest("session.tools.handlePendingToolCall", { sessionId, ...params })
    },
    commands: {
      handlePendingCommand: async (params) => connection.sendRequest("session.commands.handlePendingCommand", { sessionId, ...params })
    },
    ui: {
      elicitation: async (params) => connection.sendRequest("session.ui.elicitation", { sessionId, ...params })
    },
    permissions: {
      handlePendingPermissionRequest: async (params) => connection.sendRequest("session.permissions.handlePendingPermissionRequest", { sessionId, ...params })
    },
    log: async (params) => connection.sendRequest("session.log", { sessionId, ...params }),
    shell: {
      exec: async (params) => connection.sendRequest("session.shell.exec", { sessionId, ...params }),
      kill: async (params) => connection.sendRequest("session.shell.kill", { sessionId, ...params })
    }
  };
}
export {
  createServerRpc,
  createSessionRpc
};
